California Housing Price Prediction Exception [closed]

I have written the following code:

  1. import pandas as pd
  2. housing_pd = pd.read_csv("housing.csv")
  3. housing_pd
  4. housing_pd["ocean_proximity"].value_counts()
  5. housing_pd_shuffled = housing_pd.sample(n=len(housing_pd), random_state=1)
  6. housing_pd_shuffled
  7. 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: Issue Visual Description

  • 1

    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.

    – 

  • 1

    Please do not upload images of code/data/errors.

    – 

Leave a Comment