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
Exercise instructions
- Create a
StringIndexer
calleddest_indexer
by callingStringIndexer()
withinputCol="dest"
andoutputCol="dest_index"
. - Create a
OneHotEncoder
calleddest_encoder
by callingOneHotEncoder()
withinputCol="dest_index"
andoutputCol="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 = ____