I have a pandas dataframe similar to this:
Col1 ABC 0 XYZ A 1 XYZ B 2 XYZ C
By using the pandas get_dummies()
get_dummies()
if you have a data-frame df with categorical column ABC then you could use to create a new column of one-hot vectors
df
ABC
df['new_column'] = list(pandas.get_dummies(df['AB]).get_values())