Catalogue · First steps in Python and SQL, with AI

Keep only the rows you need

You filter a table on a value: a city, a product.

JupyterLiteBeginner0:26Capsule 3 of 12
SkillKapsul

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

The steps

The exact sequence, in order.

  1. 01

    Type df[df["city"] == "Lyon"]: two equals signs to compare.

  2. 02

    Shift + Enter: 68 rows, the count is written under the table.

  3. 03

    Same move for a product: df[df["product"] == "Atlas Refill"].

  4. 04

    Shift + Enter: 77 rows.

The habit to keep

Write the column name and the value exactly as they are in the file.

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