0

I've been trying to change from object to int64 but I got this error message, how can i solve this issue?


df.head()

screenshot

df.info()

screenshot

df_int = df['상담신청 유저획득 단가'].astype(int)

ValueError: invalid literal for int() with base 10: '3,119'

FObersteiner
  • 22,500
  • 8
  • 42
  • 72

1 Answers1

0

Your 3rd column is of type object, meaning it is not an integer because it has a comma in it. You can treat the type object as type string or convert it to string, and remove the comma using the str.replace(",","") syntax, and then convert the string to integer.

Gautam Chettiar
  • 449
  • 2
  • 11