Chapter 6. Data Analysis with pandas
Data! Data! Data! I can’t make bricks without clay!
Sherlock Holmes
pandas builds on NumPy to provide labeled, table-like data structures that make
real-world financial datasets easier to explore, clean, and analyze. This chapter
introduces Series and DataFrame objects, shows how to work with time-indexed data,
and prepares you for later chapters on time series, I/O, and asset management.
The chapter shows how to represent financial data as pandas Series and DataFrame
objects, select and filter rows and columns, handle missing values, and compute common
aggregates and returns. It also shows how to read simple comma-separated value (CSV)
files, work with time-indexed data, and convert back and forth between pandas and NumPy.
To follow along, you need a working python 3.11+ interpreter with pandas and numpy
installed (see Chapter 3), comfort with Python containers
and control flow from
Chapter 4, and basic familiarity with NumPy
arrays from Chapter 5.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access