Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q5 of 15
SciPy - Integration with Scientific Ecosystem
What will be the output of this code?
import pandas as pd
from scipy import stats

df = pd.DataFrame({'values': [10, 20, 30, 40, 50]})
result = stats.zscore(df['values'])
print(result.round(2).tolist())
A[1, 2, 3, 4, 5]
B[-1.41, -0.71, 0.00, 0.71, 1.41]
C[10, 20, 30, 40, 50]
D[0, 0, 0, 0, 0]
Step-by-Step Solution
Solution:
  1. Step 1: Understand z-score calculation

    Z-score standardizes data by subtracting mean and dividing by std deviation.
  2. Step 2: Calculate z-scores for values

    Values are equally spaced; z-scores will be symmetric around 0 with values approximately -1.41 to 1.41.
  3. Final Answer:

    [-1.41, -0.71, 0.00, 0.71, 1.41] -> Option B
  4. Quick Check:

    Z-score output = [-1.41, -0.71, 0.00, 0.71, 1.41] [OK]
Quick Trick: Z-score centers data around zero with std deviation scale [OK]
Common Mistakes:
  • Expecting original values
  • Confusing z-score with rank
  • Ignoring rounding

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More SciPy Quizzes