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

Using saved mappings

You are using a subset of a dataset and have been asked to create visualizations summarizing the output. As the dataset currently stands, all you see are numbers! Luckily, you had created and saved dictionaries (color_map, fuel_map, and transmission_map) that will map these columns back to their original categorical names. The dataset used_cars_updated has been preloaded. A preview of the dataset is shown. Check out the console to view the column data types.

       engine_fuel  color  transmission  price_usd
0                3      8             0   10900.00
1                3      1             0    5000.00
2                3      7             0    2800.00

Bu egzersiz

Working with Categorical Data in Python

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

Egzersiz talimatları

  • Update the "color" column back to its original values using the color_map dictionary.
  • Update the "engine_fuel" column back to its original values using the fuel_map dictionary.
  • Update the "transmission" column back to its original values using the transmission_map dictionary.
  • Use .info() on the dataset to see if the dtypes have changed.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Update the color column using the color_map
used_cars_updated["color"] = ____
# Update the engine fuel column using the fuel_map
used_cars_updated["engine_fuel"] = ____
# Update the transmission column using the transmission_map
used_cars_updated["transmission"] = ____

# Print the info statement
print(____)
Kodu Düzenle ve Çalıştır