Home > OS >  invalid literal for int() with base 10: '3906.00'
invalid literal for int() with base 10: '3906.00'

Time:10-28

Unable to parse string "3,906.00" at position 0 I tried:

df["sales"]=df["sales"].str.replace(",","").astype(int)

then ,it turns out this:

Unable to parse string "3906.00" at position 0

CodePudding user response:

IIUC use:

df["sales"]=df["sales"].str.replace(",","").astype(float).astype(int)
  • Related