Different result
When I created dummy variables as shown in the video lecture, I got results slightly different than yours. The difference is that I got True or False instead of 0 and 1s. Could you help me to fix this issue? Thanks beforehand
Hey Nijat,
Thank you for reaching out and apologies for the late reply!
Could you please provide a screenshot of the code you are using to create the dummies as well as the output?
If you run the notebook provided in the resources (called "Linear Regression Practical Example (Part 3) Notebook.ipynb"), do you obtain the same result?
Kind regards,
365 Hristina
Here is the screenshot and yes, the result is the same when we run "Linear Regression Practical Example (Part 3) Notebook.ipynb" in our PC.
Hey Harsh,
Thanks for reaching out.
I've now seen where the discrepancy comes from. Go to pandas
' documentation:
In the top right corner, next to the magnifying glass, you will find the option to study the documentation for previous versions.
If you select versions 1.5 and older, you will see that the default data type of the new columns is np.uint8
which stands for a "NumPy
8-bit unsigned integer number". As of versions 2.0 and newer, the default data type for these new columns is a Boolean instead. Therefore, the difference between the outputs in the lecture and in your notebook stems from different versions of the pandas
library.
Hope this helps!
Kind regards,
365 Hristina
Hi,
data_with_dummies_int = data_with_dummies.astype(int)
just use this to get true as 1 and false as 0.
hope this helps...