提问人:BrsG 提问时间:1/30/2023 最后编辑:BrsG 更新时间:1/30/2023 访问量:103
Pandas df 通过 slice 分配会引发未来警告 - 如何解决与 pd.isin 一起使用
Pandas df assignment via slice throws future warning - how to resolve using with pd.isin
问:
[蟒蛇 3.9]
我的代码中有这一行
tbl = table.loc[_slice, :] if axis == 'rows' else table.loc[:, _slice]
哪里是这样的_slice
(['A','B'], ['Z','V'], slice(None, None, None))
代码运行良好,但将来会广播警告:
The behavior of indexing on a MultiIndex with a nested sequence of labels is deprecated
and will change in a future version. `series.loc[label, sequence]` will raise if any
members of 'sequence' or not present in the index's second level. To retain the old
behavior, use `series.index.isin(sequence, level=1)`
我已经研究过了,但不知道如何重写该行以符合要求。我知道我可以抑制警告。pd.isin
答: 暂无答案
评论
table.head()