Data Wrangling with Pandas — Quiz

Answer all 12 questions, then submit. You need 70% to pass. Log in to save progress.

Question 1
Which selector picks rows and columns by their LABEL?
A .iloc
B .loc
C .at_position
D .pick
Question 2
How do you combine two filter conditions in Pandas?
A df[cond1 and cond2]
B df[(cond1) & (cond2)]
C df[cond1 + cond2]
D df.both(...)
Question 3
What does df.isna().sum() tell you?
A The total of all numbers
B The count of missing values per column
C The number of rows
D The data types
Question 4
Why often fill missing numbers with the MEDIAN rather than the mean?
A It is faster
B The median resists outliers
C Pandas requires it
D It is always larger
Question 5
Which converts a text column to numbers, turning bad values into NaN?
A col.astype(int)
B pd.to_numeric(col, errors='coerce')
C col.number()
D int(col)
Question 6
Which accessor cleans a whole text column at once (e.g. strip, lower)?
A .text
B .str
C .clean
D .string
Question 7
A LEFT join (how='left') keeps…
A only matching rows
B every row from the left table plus matches from the right
C only the right table
D no rows
Question 8
Which function stacks two DataFrames with the same columns?
A pd.merge()
B pd.concat([df1, df2])
C pd.join()
D pd.stack()
Question 9
Which pattern answers 'total sales per region'?
A df.sum()
B df.groupby('region')['amount'].sum()
C df.region.total()
D df.pivot()
Question 10
pivot_table() is most like which spreadsheet feature?
A VLOOKUP
B A PivotTable / cross-tab
C Conditional formatting
D A macro
Question 11
melt() converts data from…
A long to wide
B wide to long (tidy)
C rows to columns only
D text to numbers
Question 12
After setting a datetime index, which call rolls daily data up to monthly totals?
A resample('M').sum()
B groupby('M')
C rolling('M')
D monthly()