Check whether elements in the series are greater than other series

In this python pandas program, we will elements in the series are greater than other series.

Steps to solve the program
  1. Import pandas library as pd.
  2. Create two series using pd.Series().
  3. Check whether elements in the series are greater than other series or not using ” > “.
  4. Print the output.
				
					import pandas as pd
df1 = pd.Series([1,6,9,5])
df2 = pd.Series([5,2,4,5])
print("Greater than:")
print(df1 > df2)
				
			

Output :

				
					Greater than:
0    False
1     True
2     True
3    False
dtype: bool
				
			

check whether elements in the series are equal or not

convert a dictionary to a series

Leave a Comment