[英]Getting error in dataframe typeError: 'Series' objects are mutable, thus they cannot be hashed
I am trying to apply this operation on my dataframe df:我正在尝试在我的 dataframe df 上应用此操作:
df[df.a, 'b'] = df.c*df.b
where data types of a,b,c are:其中 a,b,c 的数据类型为:
a: bool
b: float64
c: float64
But I am getting the error TypeError: 'Series' objects are mutable, thus they cannot be hashed
但我收到错误
TypeError: 'Series' objects are mutable, thus they cannot be hashed
Is it happening because of na value present in column b or c?发生这种情况是因为 b 列或 c 中存在 na 值吗? If yes, is there a way to ignore the operation for na values?
如果是,有没有办法忽略 na 值的操作?
Thanks.谢谢。
Please try use the loc
accessor and it should be fine.请尝试使用
loc
访问器,它应该没问题。
df.loc[df.a,'b']=df.c*df.b
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.