IoT 資料導論

使用 Python 分析 IoT 資料

Matthias Voppichler

IT Developer

課程總覽

  • 蒐集與分析 IoT 資料
  • 蒐集資料
    • API 端點
    • 資料串流
  • 視覺化資料
  • 合併資料集
  • 偵測模式
  • 以 ML 模型發出警示
使用 Python 分析 IoT 資料

什麼是 IoT?

IoT == Internet of Things(物聯網)

  • 連網裝置的網路
  • 量測並蒐集資料
  • 與環境互動
使用 Python 分析 IoT 資料

IoT 裝置

連網裝置

  • 智慧門鎖
  • 連網恆溫器
  • 溫度感測器

溫度感測器

工業連網裝置

  • 連網機台
  • 機器人/協作型機器人
  • 包裹追蹤

工業機器人/機械手臂

使用 Python 分析 IoT 資料

IoT 資料格式

  • http / json
  • 純文字
  • 二進位資料
  • XML
  • 專有通訊協定
使用 Python 分析 IoT 資料

資料擷取

  • 資料串流
  • 從裝置蒐集
  • API 端點
使用 Python 分析 IoT 資料

資料擷取 - requests

import requests
url = "https://demo.datacamp.com/api/temp?count=3"
r = requests.get(url)
print(r.json())
[{'timestamp': 1536924000000, 'value': 22.3},
 {'timestamp': 1536924600000, 'value': 22.8},
 {'timestamp': 1536925200000, 'value': 23.3}]
print(pd.DataFrame(r.json()).head())
       timestamp  value
0  1536924000000   22.3
1  1536924600000   22.8
2  1536925200000   23.3
使用 Python 分析 IoT 資料

資料擷取 - pandas

import pandas as pd
df_env = pd.read_json("https://demo.datacamp.com/api/temp?count=3")

print(df_env.head())
            timestamp  value
0 2018-09-14 11:20:00   22.3
1 2018-09-14 11:30:00   22.8
2 2018-09-14 11:40:00   23.3
print(df_env.dtypes)
timestamp    datetime64[ns]
value               float64
dtype: object
使用 Python 分析 IoT 資料

一起來練習吧!

使用 Python 分析 IoT 資料

Preparing Video For Download...