Load multiple time series
Whether it is during personal projects or your day-to-day work as a Data Scientist, it is likely that you will encounter situations that require the analysis and visualization of multiple time series at the same time.
Provided that the data for each time series is stored in distinct columns of a file, the pandas
library makes it easy to work with multiple time series. In the following exercises, you will work with a new time series dataset that contains the amount of different types of meat produced in the USA between 1944 and 2012.
This exercise is part of the course
Visualizing Time Series Data in Python
Exercise instructions
We've imported pandas
using the pd
alias.
- Read in the the csv file located at
url_meat
into a DataFrame calledmeat
. - Convert the
date
column inmeat
to thedatetime
type. - Set the
date
column as the index ofmeat
. - Print the summary statistics of all the numeric columns in
meat
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Read in meat DataFrame
meat = ____.____(____)
# Review the first five lines of the meat DataFrame
print(meat.head(5))
# Convert the date column to a datestamp type
meat['date'] = ____(____)
# Set the date column as the index of your DataFrame meat
meat = ____.____(____)
# Print the summary statistics of the DataFrame
print(meat.____)