picking out elements based on complement of indices in Python pandas

前端 未结 1 524
故里飘歌
故里飘歌 2021-02-13 23:53

I have a dataframe out of which I pick two subset dfs, df_a and df_b. For example in iris dataset:

df_a = iris[iris.Name =         


        
1条回答
  •  灰色年华
    2021-02-14 00:40

    This seems a bit faster than your second solution. There's a bit more overhead when indexing with .ix:

    df[~df.index.isin(df_a.index+df_b.index)]
    

    0 讨论(0)
提交回复
热议问题