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

1 Answer 1

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.