我遇到了大熊猫的麻烦,下面是代码:
print(right_df)
print(right_top)
g = right_df.groupby('exam_id').apply(right_top)
print(g)
错误是“TypeError:'DataFrame'对象是可变的,因此它们不能被散列” 我怎么解决呢?
答案 0 :(得分:1)
您应该将功能传递给apply(...)
。
在您的代码中,您传递了 DataFrame ,因此,pandas尝试调用对象pandas.DataFrame的数据帧(__call__
方法),从而导致错误。
请参阅 apply here的说明。
为了帮助您解决具体问题,请提供有关您意图的更多信息。