Question: Use the given data HW 2 _ Data _ B for the following tasks: B 1 . ( 4 points ) Read and

Use the given data "HW2_Data_B" for the following tasks:
B1.(4 points)Read and display the dataset provided. Determine the number of rows and columns present. Additionally, identify the columns containing missing data, list their names (if any).
B2.(5 points) From the given dataset using the python script identify the columns with categorical data. Furthermore, identify every column type. Indicate the type of consistency in the given dataset, if any. Convert the Id column from numerical to object type for ease of numeric operation such as normalization.
B3.(6 points)Look at the given dataset. Using python commands filter out negative values in the following two columns bmi and children. Furthermore, some values are in decimal by mistake in age columns. Correct it using appropriate method. Also, find the unique categorical values and remove unknown values, if any (note that Nan is not considered as unknown).
B4.(6 points)Drop all columns containing 23% or more missing values. Then impute the columns having missing values using median if the column is numerical and using mode if the column is categorical.
B5.(6 points)Transform the charges column such that the minimum value is 0 and maximum value is 1. Furthermore, transform the age column to have a mean of zero and a standard deviation of one. Print only the transformed columns.
B6.(5 points)Discretize "bmi" column into the following four bins using only Pandas. Save it into another column as bmi_status.
bmi
Bin
Below 18.5
Underweight
18.524.9
Healthy Weight
25.029.9
Overweight
30.0 and Above
Obesity
B7.(4 points)Convert region using one-hot encoder. The new name should start with reg(reg_northeast). Remove the original column.
B8.(4 points)For the column smoker, convert it yes to 1 and no to 0. The column name should remain unchanged.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!