Skip to content
Quiz · NumPy and pandas · lesson 11 of 12

Quiz — the median per group

What does this program print?

Python
import pandas as pd

df = pd.DataFrame({
    "team": ["a", "a", "a", "b", "b"],
    "salary": [100, 110, 600, 120, 130],
})
med = df.groupby("team")["salary"].median()
print(med.to_dict())

Subscribe to take the course

The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.

Sign in another way