0 votes
in Python Pandas by
How to get the items of series A not present in series B?

1 Answer

0 votes
by

We can remove items present in p2 from p1 using isin() method.

import pandas as pd

p1 = pd.Series([2, 4, 6, 8, 10])

p2 = pd.Series([8, 10, 12, 14, 16])

p1[~p1.isin(p2)]

Solution

0    2

1    4

2    6

dtype: int64

Related questions

0 votes
asked Nov 9, 2021 in Python Pandas by Robin
0 votes
asked Aug 13, 2021 in Python Pandas by SakshiSharma
...