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
  • 10,450
  • 29
  • 41
  • 68
Archer
  • 1
  • 4

1 Answers1

0

You can use :

pd.factorize()

to change categories in to numbers.

Archer
  • 1
  • 4