BaşlayınÜcretsiz Başlayın

Read data with a time index

pandas DataFrame objects can have an index denoting time, this recognized by Matplotlib for axis labeling.

This exercise involves reading data from climate_change.csv, containing CO2 levels and temperatures recorded on the 6th of each month from 1958 to 2016, using pandas' read_csv function. The parse_dates and index_col arguments help set a DateTimeIndex.

Don't forget to check out the Matplotlib Cheat Sheet for a quick overview of essential concepts and methods.

Bu egzersiz

Introduction to Data Visualization with Matplotlib

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import the pandas library as pd.
  • Read in the data from a CSV file called 'climate_change.csv' using pd.read_csv.
  • Use the parse_dates key-word argument to parse the "date" column as dates.
  • Use the index_col key-word argument to set the "date" column as the index.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import pandas as pd
____

# Read the data from file using read_csv
climate_change = pd.read_csv(____, ____, ____)
Kodu Düzenle ve Çalıştır