O'Reilly logo

Learning pandas - Second Edition by Michael Heydt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieving summary descriptive statistics

pandas objects provide the .describe() method, which returns a set of summary statistics of the object's data. When applied to a DataFrame, .describe() will calculate the summary statistics for each column. The following code calculates these statistics for both stocks in omh.

With one quick method call, we have calculated the count, mean, standard deviation, minimum, and maximum values, and even the 25, 50, and 75 percentiles for both series of stock data.

.describe() can also be applied to a Series. The following code calculates summary statistics for just MSFT.

And only the mean can be obtained ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required