Importing, Wrangling and Visualizing GDP and Market Data

Welcome to our opening section on GDP, the measure of the size the economy. GDP is much talked about and if you have studied macroeconomics formally or informally, it’s probably quite familiar to you. In this opening section, we will spend time with GDP data, importing it, wrangling it and visualizing it. Our goal is to cover the fundamental skills we will need for the rest of the book, and throughout our journey in economic data science.

This section proceeds as follows:

In the first chapter, GDP, we lay the good ground work for exploring quarterly macroeconomic data and also to equip ourselves with sufficient programming skills for the remainder of the book. We import and wrangle a spreadsheet, and we import data from FRED. If you’re already an intermediate coder and familiar with the pandas library, importing spreadsheets and FRED data, this first chapter might be just review but it’s a good idea to pass your eyes over it and get familiar with some of the objects and style in this book. Plus we will wrangle a pretty nasty spreadsheet into shape, and if you plan to work in the financial industry, nasty spreadsheets will become your constant companion. The code should help.

In the second chapter, Markets we introduce market prices and returns, and walk through how to import and wrangle that data into a format that can be combined with other data. This chapter is important because we will use that market data throughout the rest of the book, and converting daily prices to returns of various periodicities is a skill that will stay with us for a long time.

The last chapter, Joining GDP and Market Data, is about about combining GDP and market returns. We expect these two variables to be related, market returns should be closely aligned with future economic growth. This chapter is important because it shows some of the challenges we face when we work with multiple data series, even when they are as closely related as GDP and market returns.