pbPassingBI
/

Aggregation & reshaping — flashcards

One card per lesson — 4 in this module. Recall the key points, then check. 4 cards. Click a card to flip, or use the arrow keys and space bar.

  1. Grouping and aggregating — what are the key points?

    Use the named agg form to get clean column names · reset_index() after groupby, or the grouping column stays in the index · transform keeps every row; agg collapses them Read the lesson

  2. Sorting and ranking — what are the key points?

    nlargest is clearer and faster than sorting then slicing · rank() defaults to average, giving decimal ranks on ties · groupby().rank() is the equivalent of a SQL windowed rank Read the lesson

  3. Merging and joining — what are the key points?

    Check row counts before and after every merge · validate="many_to_one" turns a silent fan-out into an error · indicator=True shows which rows matched and which did not Read the lesson

  4. Pivoting and reshaping — what are the key points?

    pivot_table aggregates duplicates; pivot raises on them · melt is the unpivot — the fix for spreadsheet-shaped data · Long form is what groupby and plotting libraries expect Read the lesson