Data Transformation, Sklearn, Machine Learning, One Hot Encoding, Label Encoding.
Married, Single, and Divorced [4]. pd.get_dummies(df['Marital Status'],drop_first=False).head() 2- OneHotEncoder Example 1 As mentioned, we can also implement one-hot encoding through OneHotEncoder from sklearn [4]. from sklearn.preprocessing import OneHotEncoder ohe = OneHotEncoder(sparse=False)