Select the inverse index in pd.Dataframe

后端 未结 3 526
我在风中等你
我在风中等你 2021-01-04 11:56

How to select the inverse index in pd.DataFrame by using loc or iloc?

I tried df.loc[!my_index,my_feature] but fail.

3条回答
  •  长发绾君心
    2021-01-04 12:49

    Assuming my_index are the row indices you want to ignore, you could drop these where they exist in the dataframe df:

    df = df.drop(my_index, errors='ignore')

提交回复
热议问题