Catalogue · First steps in Python and SQL, with AI

Totals by store

You total sales by store and rank them from largest to smallest.

JupyterLiteIntermediate0:16Capsule 5 of 12
SkillKapsul

Space: play · ← →: 5 seconds · M: sound · F: full screen

The steps

The exact sequence, in order.

  1. 01

    Type by_store = df.groupby("store")["amount"].sum().

  2. 02

    Type by_store.sort_values(ascending=False).

  3. 03

    Shift + Enter: Lyon Croix-Rousse on top with 2016.0.

  4. 04

    Nantes Talensac brings up the rear with 637.0.

The habit to keep

groupby groups, sum adds up, sort_values ranks.

Related capsules

You might also like

Newsletter

Monday's capsule

One skill a week, straight to your inbox. The easiest way to keep learning without thinking about it.

No spam, no reselling. One-click unsubscribe.

Your data stays in the EU. Never sold.

SkillKapsul