Python Practice › Pandas Programs › Program 20
Items not in another Series
Write a pandas program to get the items of one Series not present in another.
Input
[4, 7, 3], [9, 4, 3]
Output
1 7 dtype: int64
Approach
~a.isin(b).
Solution
import pandas as pda, b = pd.Series([4, 7, 3]), pd.Series([9, 4, 3])print(a[~a.isin(b)])Output
1 7 dtype: int64
Learn the concept
New to this topic? Read the lesson, then come back.