0

I am trying to apply this operation on my dataframe df:

df[df.a, 'b'] = df.c*df.b

where data types of a,b,c are:

a: bool
b: float64
c: float64

But I am getting the error TypeError: 'Series' objects are mutable, thus they cannot be hashed

Is it happening because of na value present in column b or c? If yes, is there a way to ignore the operation for na values?

Thanks.

1 Answer 1

1

Please try use the loc accessor and it should be fine.

df.loc[df.a,'b']=df.c*df.b
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.