I have an excel file like as shown below. File can be downloaded from the link here
each color has a score. ex: red color = 0, green color = 90 and Tacao = 50
So, for each row, I would like to compute the average score and store it in a new column.
For instance,
1st row contains 4 green, 4 red, 2 tacao
2nd row contains 2 green, 3 red, 3 tacao
based on the score for each color,
1st row average = 46 (obtained by the formula = ((4 * 90) + (4 * 0) + (2 * 50))/10. So, total is 460. divided by 10 colors = 46)
2nd row average = 41.25
I expect my output to be like as shown below
I tried the below but it doesn't work. file itself doesn't get read properly.
from styleframe import StyleFrame, utils
# from StyleFrame import StyleFrame, utils (if using version < 3.X)
sf = StyleFrame.read_excel('DUMMY_DATA_TEST.xlsx', read_style=True)
print(sf)
sf = sf[[col for col in sf.columns if col.style.fill.fgColor.rgb in ('#FF0000', utils.colors.red)]]