Everything useful before you download or buy.
Totals per group, and joins that cannot multiply your rows without telling you.
Two A4 pages on grouping, joining and reshaping with pandas, on the Verdant Union tables of Green on Paper: emissions, energy production, population, air quality, cities and waste. Every snippet was run (pandas 3) and its real output is printed under it.
It covers named aggregation, size versus count, the rows groupby drops when a key is missing, transform versus agg, top n per group, change within a group, merge with validate= and indicator=, key names and types, units before a per-person figure, a whole-Union figure as a ratio of sums, pivot_table with totals, melt, and the check on rows and totals after every step.
It shows the traps with their numbers: a join that turns 40 rows into 183 and the Union's CO2 from 7,791 into 38,106 million tonnes, a pct_change that compares Dovrena with Coralis, and an average of five countries' rates that puts the Union's CO2 per person at 5.61 tonnes in 2022 instead of 6.44.
PDF to print, and an HTML version to read on screen.
Check the resource before buying — a limited-page preview.
This is a limited-page preview. If it does not load, open the PDF directly.
One review per person. Submitting again updates your existing review.
Be the first to review this resource.