Python lesson
Picking a column
You get one column, called a Series, with the row numbers on the left. Column names must match exactly, capitals included: df["revenue"] won't work here.
Try this lesson free →Example
Put a column's name in square brackets and quotes after df:
df["Revenue"]0 70
1 15
2 24
3 35
4 140
5 30
6 40
7 105Key points
df["Revenue"]Square brackets, then the column name in quotes.
Exact namesRevenue with a capital R. Check df.columns if unsure.
df["Product"]Any column works the same way.
Next level, you'll add a method to the column, like df["Revenue"].sum().
Practice
1. Build a line that shows the Product column.
df["Product"]2. Build a line that shows the Qty column.
df["Qty"]3. Show the Store column.
df["Store"]4. Show the Day column.
df["Day"]5. Show the Revenue column.
df["Revenue"]Learn it by doing. This lesson is a short hands-on level on Bampaa: see it work, then build and write it yourself, with instant feedback.
Try this lesson free →