Challenge - 5 Problems
Describe Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
Output of describe() on numeric data
What is the output of the describe() method on this DataFrame's numeric column?
Data Analysis Python
import pandas as pd df = pd.DataFrame({'scores': [10, 20, 20, 30, 40]}) result = df['scores'].describe() print(result)
Attempts:
2 left
💡 Hint
Remember that describe() returns count, mean, std, min, quartiles, and max for numeric data.
✗ Incorrect
The describe() method calculates statistics including count, mean, standard deviation, min, 25th percentile, median (50%), 75th percentile, and max. The values match option C exactly.
❓ data_output
intermediate2:00remaining
describe() on categorical data output
What does describe() return when applied to a categorical column in a DataFrame?
Data Analysis Python
import pandas as pd df = pd.DataFrame({'colors': ['red', 'blue', 'red', 'green', 'blue', 'blue']}) result = df['colors'].describe() print(result)
Attempts:
2 left
💡 Hint
For categorical data, describe() shows count, unique values, most frequent value (top), and its frequency (freq).
✗ Incorrect
The describe() method for categorical data returns count, number of unique values, the most common value (top), and how often it appears (freq). Here, 'blue' appears 3 times, which matches option A.
🧠 Conceptual
advanced1:30remaining
Understanding describe() output for mixed data
If a DataFrame has both numeric and categorical columns, what does describe() return by default?
Attempts:
2 left
💡 Hint
By default, describe() focuses on numeric data unless specified otherwise.
✗ Incorrect
By default, pandas describe() returns statistics only for numeric columns. To include categorical columns, you must specify include='all'.
🔧 Debug
advanced1:30remaining
Error when calling describe() on empty DataFrame
What error occurs when calling describe() on an empty DataFrame with no columns?
Data Analysis Python
import pandas as pd df = pd.DataFrame() result = df.describe() print(result)
Attempts:
2 left
💡 Hint
Check what pandas returns when describe() is called on an empty DataFrame.
✗ Incorrect
Calling describe() on an empty DataFrame returns an empty DataFrame with no columns and no rows, not an error.
🚀 Application
expert2:30remaining
Using describe() to compare two datasets
You have two DataFrames df1 and df2 with a numeric column 'age'. You want to quickly compare their age distributions. Which code snippet correctly prints the summary statistics side by side?
Data Analysis Python
import pandas as pd df1 = pd.DataFrame({'age': [23, 45, 31, 35, 40]}) df2 = pd.DataFrame({'age': [30, 22, 40, 50, 60]})
Attempts:
2 left
💡 Hint
Think about how to combine two Series objects side by side in pandas.
✗ Incorrect
pd.concat with axis=1 stacks the two describe() Series side by side as columns, allowing easy comparison. Other options either add values incorrectly, append rows, or use merge which is not valid for Series.