Session Ready
Exercise

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.

Instructions
100 XP
  • 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.