Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

OneHotEncoder(categorical_features=

#Encoding the categorical data
from sklearn.preprocessing import LabelEncoder

labelencoder_X = LabelEncoder()
X[:,0] = labelencoder_X.fit_transform(X[:,0])

#we are dummy encoding as the machine learning algorithms will be
#confused with the values like Spain > Germany > France
from sklearn.preprocessing import OneHotEncoder

onehotencoder = OneHotEncoder(categorical_features=[0])
X = onehotencoder.fit_transform(X).toarray()
Comment

PREVIOUS NEXT
Code Example
Python :: colored text in py 
Python :: split list in half python 
Python :: remove special characters from string python 
Python :: get month name from datetime pandas 
Python :: lecture de fichier python 
Python :: what is join use for in python 
Python :: how to translate to string to different alphabet python 
Python :: how to write a file in python 
Python :: bot wait_for discord py 
Python :: numpy standard deviation 
Python :: how to plot corilation python 
Python :: convert string to utf8 python 
Python :: how to get only certain columns in pandas 
Python :: python save output to file 
Python :: ternary operator python 
Python :: how to add delay in python 
Python :: python get memory address of variable 
Python :: get list file endswith python 
Python :: check tf verison 
Python :: python csv to list 
Python :: python regex get all matches 
Python :: pygame caption 
Python :: add age categories pandas dataframe 
Python :: python space separated input 
Python :: how to make a class in python 
Python :: python range of letters 
Python :: index of max value of sequence python 
Python :: pyspark when otherwise multiple conditions 
Python :: how to change os path in python 
Python :: # Take user input in python 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =