Quantitative modeling with stock prices using pandas

pandas was first written to be used in financial datasets, and it includes many convenient functions for dealing with time series data. In this section, you will see how you can handle stock price series, using the pandas library.

You will use the quandl Python library to get financial data for companies. Take a look at this code:

import quandl msft = quandl.get('WIKI/MSFT') msft.columns # Index(['Open', 'High', 'Low', 'Close', 'Volume', 'Ex-Dividend', 'Split Ratio', 'Adj. Open', 'Adj. High', 'Adj. Low', 'Adj. Close', 'Adj. Volume'], dtype='object') msft.tail()

This table shows the output of msft.tail():

Let's customize our plot with the following settings import:

matplotlib.font_manager ...

Get Mastering Numerical Computing with NumPy now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.