Let's begin by inspecting the data points for each of our columns. We want to look for odd and outlier values in our data. We will start by looking at the bedroom and bathroom columns:
- In the following code, we look at the unique values for bedrooms:
df['beds'].unique()
The preceding code results in the following output:
- Now, let's look at bathrooms. We do that in the following code:
df['baths'].unique()
The preceding code results in the following output:
- Based on the output from the two preceding queries, we see that we need to correct some items that have a leading underscore. Let's do that now:
df['beds'] = df['beds'].map(lambda x: x[1:] if x.startswith('_') else x) df['baths'] = df['baths'].map(lambda x: x[1:] if x.startswith('_') else...