...

/

Data Preprocessing

Data Preprocessing

Perform the data preprocessing.

We can do extensive EDA to understand the data well. Let's focus on preprocessing and consider handling the missing data, feature engineering, interactions, creating dummies, and so on. Let's start with converting the target (class column) to 0/1 from notckad/ckd. We can also change the name of the class column to target. However, class is a keyword in Python, and we should not be confused.

Press + to interact
ckd['target']=[1 if i=='ckd' else 0 for i in ckd['class']] # recall list comprehension
print(ckd['target'].value_counts())
# we don't need the class column any more.... lets drop it
if 'class' in ckd.columns:
ckd.drop('class', axis=1, inplace=True)
print("Dropping class column.")
else:
print("The class column is already dropped")

Since we are done with the class column, let’s deal with the missing data values.

Dealing with the missing data

Let’s start with filling the data to create our prototype. We can always refine ...

Access this course and 1400+ top-rated courses and projects.