Python practice: Series & DataFrame Anatomy
Chapter 19 · 8 questions · included in full access
Question 1 · easy
Load sales dataset and print shape
Solve it in your browserImport
pandas as pd. Load"sales.csv"intosalesusingpd.read_csv("sales.csv"). Printsales.shape:Question 2 · easy
Inspect first rows with .head()
Solve it in your browserLoad
"sales.csv". Print the row count ofsales.head(3)usinglen(sales.head(3)):Question 3 · easy
Select single column as Series
Solve it in your browserLoad
"sales.csv". Select the"Units"column intounits_coland print its sum usingunits_col.sum():Question 4 · easy
Select multiple columns as DataFrame
Solve it in your browserLoad
"sales.csv". Select["OrderID", "Rep", "Revenue"]intosub_dfand printlist(sub_df.columns):Question 5 · easy
Count distinct regions with nunique
Solve it in your browserLoad
"sales.csv". Print the number of unique regions usingsales["Region"].nunique():Question 6 · easy
Summary statistics with describe
Solve it in your browserLoad
"sales.csv". Compute summary statistics on"Revenue": printround(sales["Revenue"].mean(), 2):Question 7 · easy
Value counts of categories
Solve it in your browserLoad
"sales.csv". Get order frequency per category usingsales["Category"].value_counts(). Printcounts["Sheets"]:Question 8 · easy
DataFrame concept check
Solve it in your browserIn Pandas, what is the key difference between a DataFrame and a Series?
These questions are part of full access.
The first chapters of every track are free. Full access is a one-time payment.
See pricing