Analyzing IoT Data in Python
Matthias Voppichler
IT Developer
IoT == Internet of Things
Connected devices
Industrial connected devices
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
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