Category >
PYTHON
|| Published on :
Saturday, February 20, 2021 || Views:
1984
||
Create two dummy columns from one column Python
Here Pawan Kumar will explain how to Create two dummy columns from one column in Python
import numpy as np
import pandas as pd
one = pd.DataFrame({'col':np.random.randint(0,2,10)})
two = pd.get_dummies(one.loc[:,'col'])
print(one)
print('----------------------------------')
print(two)