Lab | Data cleaning and wrangling
For this lab, we will be using the Marketing Customer Value Analysis database from before. Feel free to build on top of your previous notebooks, since there could be overlap with variable names.
Instructions
This lab will focus on data cleaning and wrangling, this is a crucial step in the EDA process.
- Remove the outliers in the dataset using one of the methods we've discussed by defining a function and applying it to the dataframe.
- Create a copy of the dataframe for the data wrangling.
- Normalize the continuous variables.
- Encode the categorical variables
- Transform the time variables (
day
,week
andmonth
) to integers. - Since the model will only accept numerical data, check and make sure that every column is numerical, if some are not, change it using encoding.
Hint for Categorical Variables
- Use either encoding or
get_dummies
to deal with the categorical variables (example below):
data["coverage"] = data["coverage"].map({"Basic" : 0, "Extended" : 1, "Premium" : 2})
# given that column "coverage" in the dataframe "data" has three categories:
# "basic", "extended", and "premium" and values are to be represented in the same order.