Challenge: Preprocessing the Dataset
Task
Swipe to start coding
You are given a synthetic dataset stored in the data variable.
- Replace missing values in the
'Age'column with the mean value of this column and store the result in this column. - Create an instance of an appropriate encoder, which will be used for the
'City'column and store it in thecity_encodervariable. Make sure to specify the removal of the first column. - Encode the values in the
'City'column usingcity_encoderand store the result in thecity_encodedvariable. - Create an instance of an appropriate encoder, which will be used for the
'Income'column and store it in theincome_encodervariable. Note that'High'>'Middle'>'Low'. - Encode the values in the
'Income'column usingincome_encoderand store the result in the'Income'column.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 6
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 2.94
Challenge: Preprocessing the Dataset
Swipe to show menu
Task
Swipe to start coding
You are given a synthetic dataset stored in the data variable.
- Replace missing values in the
'Age'column with the mean value of this column and store the result in this column. - Create an instance of an appropriate encoder, which will be used for the
'City'column and store it in thecity_encodervariable. Make sure to specify the removal of the first column. - Encode the values in the
'City'column usingcity_encoderand store the result in thecity_encodedvariable. - Create an instance of an appropriate encoder, which will be used for the
'Income'column and store it in theincome_encodervariable. Note that'High'>'Middle'>'Low'. - Encode the values in the
'Income'column usingincome_encoderand store the result in the'Income'column.
Solution
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 6
single