twoHelixestwoHelixes Start free

Datasets / City air quality

Average PM2.5 by city

Averaged over the year, the ranking is stable - the worst city is not the one with the worst single month.

Question which cities have the worst PM2.5?
Mean PM2.5 by city0204060DelhiTokyoCairoLondonSao PauloMexico CityChicagoLos AngelesCity
City air quality — 8 rows charted from 96, drawn as a bar
How it decided
Finding the data97 ms

City air quality: 96 rows, 11 columns. city and pm25_ug_m3, averaged over the months present.

Shaping the data8 ms

96 rows in, 8 out across 2 columns. Averaged over the year, the ranking is stable - the worst city is not the one with the worst single month.

Choosing the chart8 ms

bar. Named categories ranked on one measure: horizontal bars if the names are long, vertical here - twelve cities fit either way.

Applying defaults1 ms

Palette, spacing, axis titles and legend placement applied. 0 issues found.

The transformation

This is the code, not a description of it — the chart above was drawn from what it returns, and the notebook download runs the same lines against the same file.

result = df.groupby("city", as_index=False)["pm25_ug_m3"].mean().sort_values("pm25_ug_m3", ascending=False)

What it charted

8 rows out of 96, 2 columns. First 8 shown.

citypm25_ug_m3
Delhi56.1833
Tokyo42.6833
Cairo41.6833
London29.1833
Sao Paulo24.6833
Mexico City20.1833
Chicago15.6833
Los Angeles11.1833