1. Learn
  2. /
  3. Courses
  4. /
  5. Working with Categorical Data in Python

Connected

Exercise

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

Instructions

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