Introduction to IoT data

Analyzing IoT Data in Python

Matthias Voppichler

IT Developer

Course overview

  • Collect and analyze IoT data
  • Gather data
    • API Endpoints
    • Data Streams
  • Visualize data
  • Combine datasets
  • Detect patterns
  • ML Model based alerts
Analyzing IoT Data in Python

What is IoT?

IoT == Internet of Things

  • Network of connected devices
  • Measure and collect data
  • Interact with environment
Analyzing IoT Data in Python

IoT Devices

Connected devices

  • Smart locks
  • Connected thermostats
  • Temperature sensors

Temperature sensor

Industrial connected devices

  • Connected machines
  • Robots / Cobots
  • Package tracking

Industrial robots / Robotic arms

Analyzing IoT Data in Python

IoT Data formats

  • http / json
  • plain text
  • binary data
  • XML
  • Proprietary protocols
Analyzing IoT Data in Python

Data aquisition

  • Data streams
  • Gathered from a device
  • API endpoints
Analyzing IoT Data in Python

Data aquisition - 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
Analyzing IoT Data in Python

Data aquisition - 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
Analyzing IoT Data in Python

Let's Practice

Analyzing IoT Data in Python

Preparing Video For Download...