79238816

Date: 2024-11-30 04:36:48
Score: 1
Natty:
Report link

I think the problem was probably the fact that I was using the replace function wrong, but anyway I have found another way to do this which is to use the copy function.

car_sales_cp = car_sales.copy()
car_sales_cp["Price"] = car_sales_cp["Price"].str.replace(r"[$,]", "", regex=True)
car_sales_cp["Price"] = pd.to_numeric(car_sales_cp["Price"])
car_sales_cp.groupby("Make")["Price"].mean()
Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: 200 OK