我正在尝试删除列内的行之后的所有yes
行'Ammend'
东风:
Ammend
0 no
1 yes
2 no
3 no
4 yes
5 no
所需的输出df:
Ammend
0 no
1 yes
3 no
4 yes
看下面的代码:
df = df.drop(df[df['Amended' == 'yes']], inplace=True)
返回KeyError: False
错误消息
我已经使用不同的方法尝试了许多不同的变体,.index.tolist()
但.loc
我似乎无法弄清楚。
我也试过截断:
filings_df.truncate(after=filings_df.loc[filings_df['Filings'] == '10-K/A'].index[0], before = filings_df.loc[filings_df['Filings'] == '10-K/A'].index[1])
这将返回:
IndexError:索引 1 超出轴 0 的范围,大小为 1