ComeçarComece de graça

Data acquisition

Let's get our first set of IoT data.

You will get started by consuming an environmental API provided by a public community. The API consists of multiple endpoints, and you will start by consuming the temperature data. The data is in 10-minute intervals and limited historical data is available.

You will use requests to download the last 5 records. Since the endpoint provides json encoded data, you can use .json() on the response object to get a python object (in this case a list).

Then you convert the list to a pandas DataFrame to be able to easily work with the data.

The constant URL to consume data from has been defined for you. Please note that this URL is different from the URL used in the video.

Este exercício faz parte do curso

Analyzing IoT Data in Python

Ver curso

Instruções do exercício

  • Import requests and pandas as pd.
  • Download data from URL using requests and store the result in res.
  • Convert the JSON-encoded result res into a python object and store the result in data_temp.
  • Convert data_temp into a pandas DataFrame df_temp.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Imports
____
____

# Download data from URL
res = ____

# Convert the result
data_temp = ____
print(data_temp)

# Convert json data to DataFrame
df_temp = pd.____(____)

print(df_temp.head())
Editar e executar o código