Add two Series

EasyPandas Programs · 3 of 95

Write a pandas program to add two Series.

Advertisement
Input
[1, 6, 9, 5], [5, 2, 4, 5]
Output
[6, 8, 13, 10]

Approach

  1. + adds values with the same index.

Solution

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

Learn the concept

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

More pandas programs

← All 95 Pandas Programs