#OneHot Encoding import pandas as pd from sklearn.preprocessing import OneHotEncoder data_one_hot = pd.get_dummies(data['Color'], prefix = 'Color') df = pd.DataFrame(data_one_hot) df
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter