MulaiMulai sekarang secara gratis

Create a label encoding and map

A used car company believes that they can predict a car's sales price reasonably well using their used_cars dataset. One of the variables they want to use, "color", needs to be converted to codes. The company believes that a car's color will be important when predicting sales price.

Latihan ini adalah bagian dari kursus

Working with Categorical Data in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Convert to categorical and print the frequency table
used_cars["color"] = ____
print(used_cars["color"].value_counts())
Edit dan Jalankan Kode