pandas - filter dataframe by another dataframe by row elements

前端 未结 6 1207
后悔当初
后悔当初 2020-11-27 14:12

I have a dataframe df1 which looks like:

   c  k  l
0  A  1  a
1  A  2  b
2  B  2  a
3  C  2  a
4  C  2  d

and another called

6条回答
  •  野性不改
    2020-11-27 15:00

    This is pretty succinct and works well:

    df1 = df1[~df1.index.isin(df2.index)]
    

提交回复
热议问题