【发布时间】:2020-06-07 00:03:49
【问题描述】:
我有两个不同长度的 DataFrame。在 df1 中,我也需要只保留 df2 中的 df1 行,并删除所有不在 df1 中的行。 我使用了下面的函数来查找 2 df 之间的差异,但我无法删除 df1 中的所有行。
df1[~(df1['F_Code'].isin(df2['Codice']))]
【问题讨论】:
-
df1[(df1['F_Code'].isin(df2['Codice']))]?
标签: python pandas dataframe spyder