I have a pandas dataframe like this..
df = pd.DataFrame({'A' : [5,6,3,4,4,5,6,7,12,13], 'B' :
[1,2,3,5,5,6,7,8,9,10,]})
df
A B
0 5 1
1 6 2
2 3 3
3 4 5
4 4 5
5 5 6
6 6 7
7 7 8
8 12 9
9 13 10
and I have an array of indices
array = np.array([0,1,2,4,7,8])
Now I can subset the dataframe with the array indices like this
df.iloc[array]
Which gives me a dataframe with indices present in the array.
A B
0 5 1
1 6 2
2 3 3
4 4 5
7 7 8
8 12 9
Now I want all the rows which are not present in the array index, row index which i want is [3,5,6,9]
I am trying to do something like this but it gives me an error.
df.iloc[~loc]