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

Transforming and cleaning DataFrames

Once data has been curated into a cleaned Python data structure, such as a list of lists, it's easy to convert this into a pandas DataFrame. You'll practice doing just this with the data that was curated in the last exercise.

Per usual, pandas has been imported as pd, and the normalized_testing_scores variable stores the list of each schools testing data, as shown below.

[
    ['01M539', '111 Columbia Street', 'Manhattan', 657.0, 601.0, 601.0],
    ...
]   

Bu egzersiz

ETL and ELT in Python

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

Egzersiz talimatları

  • Create a pandas DataFrame from the list of lists stored in the normalized_testing_scores variable.
  • Set the columns names for the normalized_data DataFrame.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Create a DataFrame from the normalized_testing_scores list
normalized_data = ____(normalized_testing_scores)

# Set the column names
normalized_data.____ = ["school_id", "street_address", "city", "avg_score_math", "avg_score_reading", "avg_score_writing"]

normalized_data = normalized_data.set_index("school_id")
print(normalized_data.head())
Kodu Düzenle ve Çalıştır