Skip to main contentSkip to solution

Which statistical function of pandas is used to display the average of squared differences from the mean?

Solution

✅ Correct Option: 4

DataFrame.var() returns the variance, which is the average of the squared differences from the mean. By default pandas divides by n−1n - 1 (sample variance, ddof=1).


Option 1: std() is the square root of the variance, so it is in the original units of the data and is not the average of squared differences.

Option 2: describe() gives a summary (count, mean, std, min, quartiles, max), not the variance itself.

Option 3: quantile() returns values at given percentiles (default 0.5, the median), which has nothing to do with squared differences.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question