BaşlayınÜcretsiz Başlayın

Acquire data with pandas

As you just saw, consuming the public API, converting the data and transforming this into a DataFrame required multiple lines of code.

This can be simplified by using pandas' pd.read_json(), which handles the above steps for you.

You will consume the same API again. However this time, you'll be using pandas to consume the API and store the result to disk for further analysis. The URL to consume data from has been defined for you.

Bu egzersiz

Analyzing IoT Data in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import pandas as pd.
  • Read the data from URL directly into the DataFrame df_temp.
  • Print the first 5 rows.
  • Print the data types of the DataFrame df_temp.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import pandas
____

# Load URL to DataFrame
df_temp = ____

# Print first 5 rows
print(____)

# Print datatypes
____
Kodu Düzenle ve Çalıştır