I have written the following code:
import pandas as pd
housing_pd = pd.read_csv("housing.csv")
housing_pd
housing_pd["ocean_proximity"].value_counts()
housing_pd_shuffled = housing_pd.sample(n=len(housing_pd), random_state=1)
housing_pd_shuffled
pd.get_dummies(housing_pd_shuffled['ocean_proximity']).head()
Everything seems to working just fine until it execute the last line of code (line 7). Can I get an extra help please on why this is happening knowing that the instructor that I am following the tutorial with is not facing this issue.
Tried Executing it multiple times but I face the same issue which is shown in the following pictures:
maybe you should examine
housing_pd_shuffled
?@ScaryWombat can you elaborate more please?
use a debugger or print statement to examine the value – this is basic debugging which is an essential part of programming.
After you create
housing_pd_shuffled
, examine its columns to make sure the desired column is still present.Please do not upload images of code/data/errors.
Show 2 more comments