MulaiMulai sekarang secara gratis

Destination

Now you'll encode the dest column just like you did in the previous exercise.

Latihan ini adalah bagian dari kursus

Foundations of PySpark

Lihat Kursus

Petunjuk latihan

  • Create a StringIndexer called dest_indexer by calling StringIndexer() with inputCol="dest" and outputCol="dest_index".
  • Create a OneHotEncoder called dest_encoder by calling OneHotEncoder() with inputCol="dest_index" and outputCol="dest_fact".

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Create a StringIndexer
dest_indexer = ____

# Create a OneHotEncoder
dest_encoder = ____
Edit dan Jalankan Kode