0

I have a Dataframe and I want to change 'video' and 'photo' as objects to 1 and 2 as int's.
I use the following code but get error:

invalid literal for int() with base 10: 'video'

Can you help me?

df = pd.read_csv('dataset.csv')    
df[['status_type']] = df[['status_type']].astype('int')
Zephyr
  • 11,891
  • 53
  • 45
  • 80
Archer
  • 11
  • 5

1 Answers1

0

You can use :

pd.factorize()

to change categories in to numbers.

Archer
  • 11
  • 5