6

I'm trying to sum my dataframe across axis = 1 but for some reason its not working for me. I'm not entirely sure why its not working. Any help would be appreciated.

Original DataFrame:

enter image description here

Attempt at summing along axis = 1

enter image description here

bugsyb
  • 5,662
  • 7
  • 31
  • 47

1 Answers1

6

There is problem type of your data is not float but string.

So need cast to float by astype:

norm = data[colors.keys()].astype(float).sum(axis=1)
jezrael
  • 822,522
  • 95
  • 1,334
  • 1,252