How to select the inverse index in pd.DataFrame by using loc or iloc?
loc
iloc
I tried df.loc[!my_index,my_feature] but fail.
df.loc[!my_index,my_feature]
You may take advantage of index.difference.
index.difference
idx2 = df.index.difference(my_index)
Or, set.difference
set.difference
idx2 = set(df.index).difference(my_index) # note, order not guaranteed
df.loc[idx2, ...]