gpt4 book ai didi

python - pandas,分割或划分(减去)数据框

转载 作者:太空宇宙 更新时间:2023-11-03 21:41:24 25 4
gpt4 key购买 nike

我有一个数据框“moment_f”。我必须从 moment_f 中删除一些包含名称“AH”的行。但是我不会删除每个“AH”行,所以我创建了一个新的数据框包含我要删除的“AH”。

ah1 = moment_f[moment_f["TextGridLabel"] == "AH"]
ah_d = ah1.iloc[::2]
# got the odd rows of "AH" which is what I need to get rid of from the original dataframe "moment_f".

所以现在我想从数据帧“moment_f”中删除数据帧“ah_d”。

串联的反义词是什么?我尝试过删除、拆分等,但不起作用。

最佳答案

IIUC 需要:

df = moment_f[~moment_f.index.isin(ah_d.index)]

关于python - pandas,分割或划分(减去)数据框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52830239/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com