Welcome to the course!

Visualizzare dati di serie temporali in Python

Thomas Vincent

Head of Data Science, Getty Images

Prerequisites

Visualizzare dati di serie temporali in Python

Time series in the field of Data Science

  • Time series are a fundamental way to store and analyze many types of data
  • Financial, weather and device data are all best handled as time series
Visualizzare dati di serie temporali in Python

Time series in the field of Data Science

An example of time series data

Visualizzare dati di serie temporali in Python

Course overview

  • Chapter 1: Getting started and personalizing your first time series plot
  • Chapter 2: Summarizing and describing time series data
  • Chapter 3: Advanced time series analysis
  • Chapter 4: Working with multiple time series
  • Chapter 5: Case Study
Visualizzare dati di serie temporali in Python

Reading data with Pandas

import pandas as pd

df = pd.read_csv('ch2_co2_levels.csv') print(df)
       datestamp    co2
0     1958-03-29  316.1
1     1958-04-05  317.3
2     1958-04-12  317.6
...
...
...
2281  2001-12-15  371.2
2282  2001-12-22  371.3
2283  2001-12-29  371.5
Visualizzare dati di serie temporali in Python

Preview data with Pandas

print(df.head(n=5))
    datestamp    co2
0  1958-03-29  316.1
1  1958-04-05  317.3
2  1958-04-12  317.6
3  1958-04-19  317.5
4  1958-04-26  316.4
print(df.tail(n=5))
       datestamp    co2
2279  2001-12-01  370.3
2280  2001-12-08  370.8
2281  2001-12-15  371.2
2282  2001-12-22  371.3
2283  2001-12-29  371.5
Visualizzare dati di serie temporali in Python

Check data types with Pandas

print(df.dtypes)
datestamp     object
co2          float64
dtype: object
Visualizzare dati di serie temporali in Python

Working with dates

To work with time series data in pandas, your date columns needs to be of the datetime64 type.

pd.to_datetime(['2009/07/31', 'test'])
ValueError: Unknown string format
pd.to_datetime(['2009/07/31', 'test'], errors='coerce')
DatetimeIndex(['2009-07-31', 'NaT'], 
    dtype='datetime64[ns]', freq=None)
Visualizzare dati di serie temporali in Python

Let's get started!

Visualizzare dati di serie temporali in Python

Preparing Video For Download...