繁体   English   中英

在 dataframe 类型错误中出现错误:“系列”对象是可变的,因此无法对其进行哈希处理

[英]Getting error in dataframe typeError: 'Series' objects are mutable, thus they cannot be hashed

我正在尝试在我的 dataframe df 上应用此操作:

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

其中 a,b,c 的数据类型为:

a: bool
b: float64
c: float64

但我收到错误TypeError: 'Series' objects are mutable, thus they cannot be hashed

发生这种情况是因为 b 列或 c 中存在 na 值吗? 如果是,有没有办法忽略 na 值的操作?

谢谢。

请尝试使用loc访问器,它应该没问题。

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM