How it works...

The result of the describe method in step 2 is itself a Series with the identifying summary statistic as its index labels. This summary Series is used to store the tenth and ninetieth percentiles as their own variables. Step 3 uses boolean indexing to select only those values in the upper and lower tenth of the distribution.

Both Series and DataFrames have direct plotting capabilities through the plot method. This first call to the plot method comes from the slb_close Series, which contains all the SLB closing prices. This is the black line in the plot. The points from slb_filtered are plotted as gray markers directly on top of the closing prices. The style parameter is set to a single blank space so that no line is drawn. The ms parameter sets the marker size.

Matplotlib comes with a convenience function, hlines, that plots horizontal lines. It takes a list of y values and plots them from xmin to xmax.

Judging from our new perspective from the plots that we created, it's clear to see that although SLB's all-time high is close to $120 per share, only 10% of the trading days in the last seven years have been above $93 per share.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.151.45