Home > Mobile >  Error when converting a pandas column price to integer
Error when converting a pandas column price to integer

Time:09-01

I got this error when trying to convert pandas column price to integer. I've attached the code problem Can you help please?

enter image description here

CodePudding user response:

You're getting this error because the price column isn't of string type to begin with

CodePudding user response:

change the type of a dataframe column using "astype" method.

car_sales['Price'].astype(int)

in general:

df['column_name'].astype(type)

  • Related