Python lesson
Column totals
One column, one method. It's the Python version of =SUM(F2:F9), and it works the same on a million rows.
Try this lesson free →Example
Pick a column, then add a method with a dot:
df["Revenue"].sum()459Key points
.sum()Add up every value in the column.
.mean()The average.
.max() .min()The biggest and smallest values.
Pick a column with df["Revenue"], then add a method like .sum(). Don't forget the brackets at the end.
Practice
1. Build a line that finds the average revenue.
df["Revenue"].mean()2. Build a line that finds the total quantity sold.
df["Qty"].sum()3. Find the total revenue.
df["Revenue"].sum()4. Find the revenue of the biggest single order.
df["Revenue"].max()5. Find the average quantity per order.
df["Qty"].mean()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 →