Question
Task 1: Data cleansing (50pt) - Week 3 [5pt] Please describe the data type for each variable in the dataset - whether it is a
Task 1: Data cleansing (50pt) - Week 3
[5pt] Please describe the data type for each variable in the dataset - whether it is a numerical or categorical or other variable. (You can add a text block in the notebook to answer the question).
Assuming we want to run analysis using variables: Survived, Pclass, Sex, Age, Fare, Embarked, and want to prepare a dataset for the analysis. Please do the items below:
[5pt] Create a subset of data which only contains selected variables. This should be a new Python variable only containing selected columns.
[5pt] For each variable, please check whether it has any missing values. If yes, how many missing values are there.
[10pt] If you see missing values on variables Survived, Pclass, Sex, Embarked, please removing the missing records.
[10pt] For missing values on variables Age, Fare, please replace the missing value using average age and average fare.
[10pt] If you identify any categorical variable(s), please use one-hot encoding to convert the variables.
[5pt] At the end, please print the final dataset, which only contains selected variable and is well cleaned. Please indicate the number of observations in the dataset.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started