Answers for "def to_one_hot(dataframe, columns): ''' Convert columns in dataframe to one-hot encoding. Args:"

4

one hot encoding python pandas

y = pd.get_dummies(df.Countries, prefix='Country')
print(y.head())
# from here you can merge it onto your main DF
Posted by: Guest on May-12-2020

Code answers related to "def to_one_hot(dataframe, columns): ''' Convert columns in dataframe to one-hot encoding. Args:"

Python Answers by Framework

Browse Popular Code Answers by Language