Are Series elements equal?

EasyPandas Programs · 7 of 95

Write a pandas program to compare two Series element by element.

Advertisement
Input
[1, 6, 9, 5], [5, 2, 4, 5]
Output
[False, False, False, True]

Approach

  1. ==.

Solution

Python
import pandas as pda, b = pd.Series([1, 6, 9, 5]), pd.Series([5, 2, 4, 5])print((a == b).tolist())
Output
[False, False, False, True]
Advertisement

Learn the concept

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

More pandas programs

← All 95 Pandas Programs