Book Image

Mastering Pandas for Finance

By : Michael Heydt
Book Image

Mastering Pandas for Finance

By: Michael Heydt

Overview of this book

Table of Contents (16 chapters)
Mastering pandas for Finance
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Visualizing financial time-series data


One of the best ways to determine patterns and relationships in financial data is to create visualizations of the information. We will examine a number of common financial visualizations and how to create them before diving into the various analyses.

Plotting closing prices

The closing price of a stock can be easily plotted with matplotlib for either a single stock or multiple stocks on the same graph. We have already pulled down all the historical data for our stocks, so to visualize the closing prices, we will need to extract those values and pass and plot them with .plot().

Most of the examples will focus on the adjusted closing price instead of the close price as this takes into account splits and dividends and reflects a continuous change in the value of each stock. To facilitate the use of this field, we can extract just the adjusted close value for each stock into its own pandas object.

This happens to be very simple because of the way we organized...