Get startedGet started for free

Destination

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

This exercise is part of the course

Foundations of PySpark

View Course

Exercise instructions

  • 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".

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Create a StringIndexer
dest_indexer = ____

# Create a OneHotEncoder
dest_encoder = ____
Edit and Run Code