Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

convert categorical data type to int in pandas

from sklearn import preprocessing

lab_encoder = preprocessing.LabelEncoder()
df['column'] = lab_encoder.fit_transform(df['column'])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #categorical #data #type #int #pandas
ADD COMMENT
Topic
Name
6+1 =