zero-to-mastery-ml
zero-to-mastery-ml copied to clipboard
Fix the doller sign replacement regex issue on the car_sales Price column
I found an error while executing the code as bellow screenshot
Solution:
In this solution I fixed the doller sign replacement regex issue on the car_sales Price column on introduction-to-pandas.ipynb
file
I followed two steps to fix this,
-
Convert the Price column to string type
car_sales["Price"] = car_sales["Price"].astype(str)
-
Use str.replace() to remove $, commas, and periods ans convert to the integer
car_sales["Price"] = car_sales["Price"].str.replace(r'[\$\,\.]', '', regex=True)
I think from this changes this 87 issue will be solved. https://github.com/mrdbourke/zero-to-mastery-ml/issues/87
Thank you. Enjoy!