Python Practice › Pandas Programs › Program 39

Sum of a column

EasyPandas Programs · 39 of 95

Write a pandas program to sum the age column.

Advertisement
Output
119

Approach

  1. df["age"].sum().

Solution

Python
import pandas as pddf = pd.DataFrame({"name": ["Alex", "John", "Peter", "Klaus"], "age": [30, 27, 29, 33]})print(df["age"].sum())
Output
119
Advertisement

Learn the concept

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

More pandas programs

← All 95 Pandas Programs