zero-to-mastery-ml icon indicating copy to clipboard operation
zero-to-mastery-ml copied to clipboard

Fix the doller sign replacement regex issue on the car_sales Price column

Open chanakaHetti opened this issue 5 months ago • 0 comments

I found an error while executing the code as bellow screenshot

image


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,

  1. Convert the Price column to string type car_sales["Price"] = car_sales["Price"].astype(str)

  2. 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!

chanakaHetti avatar Sep 12 '24 21:09 chanakaHetti