Reputation: 101
I got two indices, Ix1
and Ix2
.
I need the ones from Ix1
, that are not in Ix2
.
I only know
Ix1.difference(Ix2).intersection(Ix1)
But it doesn't work. I still get indices from Ix2
, which aren't in Ix1
. Ideas?
Upvotes: 1
Views: 57
Reputation: 862761
Use first part only:
Ix1 = pd.Index([1,2,3,6,7])
Ix2 = pd.Index([0,1,2,4,5])
print (Ix1.difference(Ix2))
Int64Index([3, 6, 7], dtype='int64')
Upvotes: 1