Get the items of a series not present in another series using Pandas

In this python pandas program, we will get the items of a series not present in another series using pandas library.

Steps to solve the program
  1. Import pandas library as pd.
  2. Create two series using pd.Series().
  3. Get the items of a series not present in another series using df1[~df1.isin(df2)].
  4. Print the output.
import pandas as pd
df1 = pd.Series([4,7,3,10])
df2 = pd.Series([9,4,3])
print("First series: \n",df1)
print("Second series: \n",df2)
result = df1[~df1.isin(df2)]
print(result)

Output :

First series:
 0     4
1     7
2     3
3    10
dtype: int64
Second series:
 0    9
1    4
2    3
dtype: int64
1     7
3    10
dtype: int64

find the standard deviation of the  given Series

calculate the maximum value from a series

Leave a Comment