我有一个dataframe,当使用特定列的值的字典返回的值用作返回keys值的字典键时,我需要过滤掉其中的行。你知道吗
我已经能够基于columns值过滤行,但是当我尝试以类似的方式使用字典中的columns值时,iit返回一个错误。你知道吗
TypeError: 'Series' objects are mutable, thus they cannot be hashed
indexNames = df[ accounting_type_dict[df['fund_id']] == 'ETFs' ].index
df.drop(indexNames , inplace=True)
使用
map
然后过滤您可以尝试用dict中相应的值替换列(根据数据帧的大小,您可能需要使用map而不是replace)
相关问题 更多 >
编程相关推荐