Catalogue · First steps in Python and SQL, with AI

Ask AI for the code, then check it

You get a line of code from Copilot Chat by giving only the columns, then check it against a number you know.

Copilot ChatIntermediate0:33Capsule 11 of 12
SkillKapsul

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

The steps

The exact sequence, in order.

  1. 01

    In Copilot Chat, describe the table’s columns, not the data.

  2. 02

    Read the suggested line before you copy it.

  3. 03

    Paste it into the notebook under a name: by_product = …

  4. 04

    Check: print(by_product.sum()) must give 14976.0 again.

The prompt to copy

Word for word, exactly as shown in the video.

I have a pandas DataFrame df with the columns store, product, quantity, unit_price and amount. Write one line of Python that gives the total amount per product as a Series, sorted from smallest to largest.

The habit to keep

Never put data in the prompt, and always keep a check number.

Worth knowing

What the video does not hide from you.

AI can suggest code that runs but calculates something else: the check number shows it.

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