ยินดีต้อนรับสู่คอร์ส!

การแสดงภาพข้อมูล Time Series ด้วย Python

Thomas Vincent

Head of Data Science, Getty Images

พื้นฐานที่ต้องมี

การแสดงภาพข้อมูล Time Series ด้วย Python

Time series ในสาขา Data Science

  • Time series เป็นวิธีหลักในการเก็บและวิเคราะห์ข้อมูลหลายประเภท
  • ข้อมูลการเงิน สภาพอากาศ และอุปกรณ์ต่าง ๆ ล้วนจัดการได้ดีที่สุดในรูปแบบ time series
การแสดงภาพข้อมูล Time Series ด้วย Python

Time series ในสาขา Data Science

ตัวอย่างข้อมูล time series

การแสดงภาพข้อมูล Time Series ด้วย Python

ภาพรวมคอร์ส

  • บทที่ 1: เริ่มต้นและปรับแต่งกราฟ time series แรกของคุณ
  • บทที่ 2: การสรุปและอธิบายข้อมูล time series
  • บทที่ 3: การวิเคราะห์ time series ขั้นสูง
  • บทที่ 4: การทำงานกับ time series หลายชุด
  • บทที่ 5: กรณีศึกษา
การแสดงภาพข้อมูล Time Series ด้วย Python

การอ่านข้อมูลด้วย 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
การแสดงภาพข้อมูล Time Series ด้วย Python

ดูตัวอย่างข้อมูลด้วย 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
การแสดงภาพข้อมูล Time Series ด้วย Python

ตรวจสอบชนิดข้อมูลด้วย Pandas

print(df.dtypes)
datestamp     object
co2          float64
dtype: object
การแสดงภาพข้อมูล Time Series ด้วย Python

การทำงานกับวันที่

การทำงานกับข้อมูล time series ใน pandas คอลัมน์วันที่ต้องมีชนิดเป็น datetime64

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)
การแสดงภาพข้อมูล Time Series ด้วย Python

มาเริ่มกันเลย!

การแสดงภาพข้อมูล Time Series ด้วย Python

Preparing Video For Download...