The median is the middle value of an ordered set. Sort the values first; with an even number of values, average the two innermost values. Unlike the mean, the median changes relatively little when one unusually large or small value is introduced. section 1.5
In pandas, Series.median() returns the median, while Series.quantile(0.5) expresses the same measurement. The describe() method includes it as the 50% entry alongside the mean, quartiles, minimum, and maximum. section 1.15
Compare center and spread
Generate 100,000 normally distributed values with mean 0 and standard deviation 100, then inspect s.describe(). The displayed mean is 0.157670 and the median, or 50% quantile, is 0.172022, so they are close. Replacing every minimum value with five times the maximum raises the maximum dramatically, while the median changes only slightly; the mean and standard deviation respond more noticeably.
Use the median when a central value should represent a population without being dominated by extreme observations. Compare it with the mean and standard deviation: closeness between mean and median can suggest a balanced distribution, while a gap can signal asymmetry or influential values. section 1.5 section 1.9
Practical exercises include comparing taxi passenger quantiles, measuring city growth with mean and median changes, and considering how unusual observations affect descriptive statistics. section 1.25 section 3.23






