Error while encoding categorical values

I have tried many things but it is not working.
Can you please help me resolve this

linke to the notebook : Machinelearning_algos/Weather Rain Prediction - Log Reg for classification.ipynb at main · Aaryansohani/Machinelearning_algos · GitHub

Can u show the code which you are using while encoding before transform…

Its the same notebook which is provided in the lecture i didn’t changed anything.
The same error was there when i run the linear regression note book.

Did you run the code below before transforming

encoded_cols = list(encoder.get_feature_names(categorical_cols))

Please include your notebook when you need help

Yes i did run it. i dont know whats the problem with this part all the cells are as it is in the notebook as shown in the Jovian notebook.

I repeat, please include a link to your notebook

Why are you encoding the encoded_cols? Shouldn’t you encode categorical_cols?

1 Like

sorry about that link to the notebook is updated in the post.

updated please check the notebook for better understanding

There doesn’t seem to be any error. Restart the notebook and run all cells from top to bottom.

I did that many times and got the same error all the time. I dont know why

That’s impossible, since I’ve downloaded the notebook and been able to run it without a problem. Just rerun.

There’s also a possibility that you’re using some old version of python/libs. In such case it would be good idea to update everything updateable.

it is working in google colab but not in jupyter notebook any hint whats the problem?

try using encoder.transform(train_inputs[categorical_cols]) in a prior cell and see if your encoder works fine.
Also, can you show me the code you used for fitting your encoder.

encoder is working fine i think the problem is with train_inputs[encoded_cols].
I have shared the link to the notebook, it is working with google colab but the problem arrives when i run it with jupyter notebook.

Jupyter notebook sounds like you’re running it locally.

Did you update pandas as well?

BTW I’ve used jupyter notebook (local) as well, so it’s not related to the platform. It has something to do with the way you have your libs installed.

Yes, @Sebgolos is right, if you’re facing issues while running it locally… check your library versions and maybe create an environment to install the correct versions for all libraries you’re using.

You can check your library versions (in google colab and jupyter) using the command: !pip list.