In [17]:
cat_col = train_df[["X0"]]
cat_col.head()
Out[17]:
X0
0 k
1 k
2 az
3 az
4 az
In [20]:
pd.get_dummies(cat_col).head()
Out[20]:
X0_a X0_aa X0_ab X0_ac X0_ad X0_af X0_ai X0_aj X0_ak X0_al ... X0_q X0_r X0_s X0_t X0_u X0_v X0_w X0_x X0_y X0_z
0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
2 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
3 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0
4 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0

5 rows × 47 columns