enter image description here
I have the dataset above.
I use:
car_sales["Price"] = car_sales["Price"].str.replace('[$,.]', '', regex=True).astype(int)
I get prices:
400000, 500000 etc. I need to remove the last two zeros – how can I do this?
3
Divide by 100 to remove the last 2 digits.
car_sales["Price"] = car_sales["Price"].str.replace('[$,.]', '', regex=True).astype(int) // 100
Or remove the digits after the decimal point in the replacement:
car_sales["Price"] = car_sales["Price"].str.replace(r'[$,]|.dd$', '', regex=True).astype(int)