0
0
SciPydata~20 mins

Descriptive statistics (describe) in SciPy - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Descriptive Statistics Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of scipy.stats.describe on a simple array
What is the output of the following code snippet using scipy.stats.describe on a simple numeric array?
SciPy
from scipy.stats import describe
import numpy as np

arr = np.array([1, 2, 3, 4, 5])
result = describe(arr)
print(result)
ADescribeResult(nobs=5, minmax=(1, 5), mean=3.0, variance=2.5, skewness=0.0, kurtosis=-1.3)
BDescribeResult(nobs=5, minmax=(1, 5), mean=3.0, variance=2.0, skewness=0.0, kurtosis=-1.3)
C)3.1-=sisotruk ,0.0=ssenweks ,5.2=ecnairav ,0.3=naem ,)5 ,1(=xamnim ,5=sbon(tluseRebircseD
DDescribeResult(nobs=5, minmax=(1, 5), mean=3.0, variance=2.5, skewness=0.0, kurtosis=0.0)
Attempts:
2 left
💡 Hint
Recall that variance is calculated with denominator n-1 by default in scipy.stats.describe.
data_output
intermediate
1:30remaining
Number of observations from describe on 2D array
Given the following 2D array, what is the number of observations (nobs) reported by scipy.stats.describe when applied along axis=1?
SciPy
from scipy.stats import describe
import numpy as np

arr = np.array([[1, 2, 3], [4, 5, 6]])
result = [describe(row).nobs for row in arr]
print(result)
A[6, 6]
B[1, 1]
C[3, 3]
D[2, 2]
Attempts:
2 left
💡 Hint
Each row has 3 elements, so nobs per row is 3.
🔧 Debug
advanced
2:00remaining
Identify the error in using describe on a list with mixed types
What error will the following code raise when using scipy.stats.describe on a list with mixed types?
SciPy
from scipy.stats import describe
mixed_list = [1, 'two', 3]
describe(mixed_list)
ATypeError: unsupported operand type(s) for -: 'str' and 'int'
BValueError: could not convert string to float: 'two'
CTypeError: object of type 'str' has no len()
DNo error, returns descriptive statistics ignoring strings
Attempts:
2 left
💡 Hint
The function tries to perform numeric operations on all elements.
🧠 Conceptual
advanced
1:30remaining
Understanding kurtosis output from describe
Which statement correctly describes the kurtosis value returned by scipy.stats.describe?
AKurtosis is the same as variance but scaled differently
BKurtosis is the excess kurtosis, where 0 means normal distribution kurtosis
CKurtosis is the raw fourth moment without adjustment
DKurtosis is always positive and measures skewness
Attempts:
2 left
💡 Hint
Think about what excess kurtosis means in statistics.
🚀 Application
expert
2:30remaining
Calculate skewness from describe output
You have the following output from scipy.stats.describe on a dataset: DescribeResult(nobs=4, minmax=(2, 10), mean=6.5, variance=12.33, skewness=1.2, kurtosis=0.5). What does the skewness value tell you about the data distribution?
ASkewness value indicates the data has no outliers
BThe data is perfectly symmetrical with no skew
CThe data is skewed to the left, meaning a longer tail on the lower values
DThe data is skewed to the right, meaning a longer tail on the higher values
Attempts:
2 left
💡 Hint
Positive skewness means the tail is on the right side.