Pandas Fundamentals for Financial Time-Series Data
Summary
This tutorial introduces Pandas as a toolkit for working with financial data, focusing on its Series and DataFrame structures. It demonstrates creating indexed data, inspecting rows, columns, values, and types, sorting, transposing, selecting columns and date ranges, filtering with conditions, dropping rows or columns, and shifting observations to calculate returns.
The examples use Chinese stock price data and show how to group and aggregate with functions such as resampling, including converting daily observations into weekly OHLC values and summing intraday data into five-minute bins. It also illustrates pivoting prices across several instruments and plotting price histories. These are programming and data-handling examples rather than a trading strategy or performance study. The guide does not assess data quality, corporate actions, missing observations, or whether any resulting analysis is suitable for live trading.
Key ideas
- Series stores values with an associated index, while a DataFrame organizes multiple labeled columns and rows.
- Date indexes support selecting specific trading periods and aligning financial observations.
- Shifting a price series by one observation enables calculation of period returns.
- Boolean conditions can filter rows or values, while sorting and dropping help reshape datasets.
- Resampling can aggregate higher-frequency observations or derive weekly OHLC data from daily prices.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.