O'Reilly logo

Mastering Numerical Computing with NumPy by Mert Cuhadaroglu, Umit Mert Cakmak

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

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 ...

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