Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chanakaHetti
Copy link

@chanakaHetti chanakaHetti commented Sep 12, 2024

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.
#87

Thank you. Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant