Project 18: Signups by Country
Data Analyst
Builds on these lessons
Current Task
Objective
.groupby() splits a DataFrame into groups by a column's values, ready for an aggregation like .sum() to be applied per group.
Task: group signups by country and print the total count per country.
index.py
import pandas as pd
signups = pd.DataFrame({'country': ['US', 'UK', 'US', 'UK'], 'count': [10, 5, 8, 3]})
grouped = signups.groupby('country')['count'].sum()
print(grouped)
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview