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

Analyzing distribution of returns

It is possible to get a feel for the difference in distribution of the daily percentage changes for a specific stock by plotting that data in a histogram. A trick with generating histograms for data such as daily returns is to select the number of bins to lump values into. The example will use 50 bins, which gives a good feel for the distribution of daily changes across three years of data.

The following shows you the distribution of the daily percentage change for AAPL:

This visualization tells us several things. First, most of the daily movements center around 0.0. Second, there is a small amount of skew ...

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