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.)

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter16: Graphics
Section: Chapter Questions
Problem 17RQ
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
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT