LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Visualizing Time Series Data in Python

Kurs anzeigen

Anleitung zur Übung

We've imported pandas using the pd alias.

  • Read in the the csv file located at url_meat into a DataFrame called meat.
  • Convert the date column in meat to the datetime type.
  • Set the date column as the index of meat.
  • Print the summary statistics of all the numeric columns in meat.

Interaktive Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# 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.____)
Code bearbeiten und ausführen