The module test2 contains a pandas DataFrame colors with a list of colors along with their hexadecimal color codes and RGB channel values between 0 and 255 (i.e., the mixture of the basic colors red, green, and blue that gives the color). The first few entries look like this: color hex red channel green channel blue channel O dark sea green #8fbc8f 143 188 143 1 gray #808080 128 128 128 2 orange red #ff8c00 255 69 0 3 lime green 4 lavendar #32cd32 50 #e6e6fa 230 205 50 230 250 1. Take the original table, augment it by one column, "grayscale", and assign the new table to the variable colors_extra. The values of the grayscale column should be the grayscale values of the colors, i.e., the mean of their red, green, and blue channel values. 2. Define a second DataFrame mixed_color_table whose entries are mixtures of subsequent colors in colors, i.e., the first entry is the mixture of the first and second original color, the second entry is the mixture of the third and fourth original color, and so on. The new DataFrame should have four columns, "mix", "red channel", "green channel", and "blue channel". The value of mix should be the name of the first color, followed by a plus sign, followed by the name of the second color. For example, "blue+crimson" when mixing "blue" and "crimson". The values of the three color channels should be the mean of the corresponding color channels of the original colors. (Note: You can assume that the total number of colors in the original colors DataFrame is even.)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
The module test2 contains a pandas DataFrame colors with a list of colors along with their hexadecimal color codes and RGB channel values between 0 and 255 (i.e.,
the mixture of the basic colors red, green, and blue that gives the color). The first few entries look like this:
color
hex red channel green channel blue channel
O dark sea green #8fbc8f 143
188
143
1 gray
#808080 128
128
128
2 orange red
#ff8c00 255
69
0
3 lime green
4 lavendar
#32cd32 50
#e6e6fa 230
205
50
230
250
1. Take the original table, augment it by one column, "grayscale", and assign the new table to the variable colors_extra. The values of the grayscale column should be
the grayscale values of the colors, i.e., the mean of their red, green, and blue channel values.
2. Define a second DataFrame mixed_color_table whose entries are mixtures of subsequent colors in colors, i.e., the first entry is the mixture of the first and second
original color, the second entry is the mixture of the third and fourth original color, and so on. The new DataFrame should have four columns, "mix", "red channel",
"green channel", and "blue channel". The value of mix should be the name of the first color, followed by a plus sign, followed by the name of the second color. For
example, "blue+crimson" when mixing "blue" and "crimson". The values of the three color channels should be the mean of the corresponding color channels of the
original colors. (Note: You can assume that the total number of colors in the original colors DataFrame is even.)
Transcribed Image Text:The module test2 contains a pandas DataFrame colors with a list of colors along with their hexadecimal color codes and RGB channel values between 0 and 255 (i.e., the mixture of the basic colors red, green, and blue that gives the color). The first few entries look like this: color hex red channel green channel blue channel O dark sea green #8fbc8f 143 188 143 1 gray #808080 128 128 128 2 orange red #ff8c00 255 69 0 3 lime green 4 lavendar #32cd32 50 #e6e6fa 230 205 50 230 250 1. Take the original table, augment it by one column, "grayscale", and assign the new table to the variable colors_extra. The values of the grayscale column should be the grayscale values of the colors, i.e., the mean of their red, green, and blue channel values. 2. Define a second DataFrame mixed_color_table whose entries are mixtures of subsequent colors in colors, i.e., the first entry is the mixture of the first and second original color, the second entry is the mixture of the third and fourth original color, and so on. The new DataFrame should have four columns, "mix", "red channel", "green channel", and "blue channel". The value of mix should be the name of the first color, followed by a plus sign, followed by the name of the second color. For example, "blue+crimson" when mixing "blue" and "crimson". The values of the three color channels should be the mean of the corresponding color channels of the original colors. (Note: You can assume that the total number of colors in the original colors DataFrame is even.)
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education