Book Image

Learning pandas - Second Edition

By : Michael Heydt
Book Image

Learning pandas - Second Edition

By: Michael Heydt

Overview of this book

You will learn how to use pandas to perform data analysis in Python. You will start with an overview of data analysis and iteratively progress from modeling data, to accessing data from remote sources, performing numeric and statistical analysis, through indexing and performing aggregate analysis, and finally to visualizing statistical data and applying pandas to finance. With the knowledge you gain from this book, you will quickly learn pandas and how it can empower you in the exciting world of data manipulation, analysis and science.
Table of Contents (16 chapters)

Historical Stock Price Analysis

In this final chapter, we will use pandas to perform various financial analyses of stock data obtained from Google Finance. This will also cover several topics in financial analysis. The emphasis will be on using pandas to derive practical time-series stock data and not on details of the financial theory. However, we will cover many useful topics and learn how easy it is to apply pandas to this domain and to others.

Specifically, in this chapter, we will progress through the following tasks:

  • Fetching and organizing stock data from Google Finance
  • Plotting time-series prices
  • Plotting volume-series data
  • Calculating simple daily percentage change
  • Calculating simple daily cumulative returns
  • Resampling data from daily to monthly returns
  • Analyzing distribution of returns
  • Performing moving-average calculations
  • Comparing average daily returns across stocks...