Python Practice › Pandas Programs › Program 20

Items not in another Series

EasyPandas Programs · 20 of 95

Write a pandas program to get the items of one Series not present in another.

Advertisement
Input
[4, 7, 3], [9, 4, 3]
Output
1    7
dtype: int64

Approach

  1. ~a.isin(b).

Solution

Python
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
Advertisement

Learn the concept

New to this topic? Read the lesson, then come back.

More pandas programs

← All 95 Pandas Programs