I have a pandas data frame like this:
and I need to convert it into the below:
So, the unique values in column 'camps' part of the original data set, gets turned into columns with values 0 and 1 for each id. How can I achieve this using Pandas or anything else in Python? Any help is greatly appreciated. Thanks
Below is the code to create the original data set:
import pandas as pd
cust = {'id': [212175, 286170, 361739, 297438, 415712, 415777, 261700, 314624, 170365, 333254],
'camps': [':_Camp1_CC SC_Statemt_CCSTMT', ':_Camp1_CC SC_Statemt_CCSTMT', ':_Camp1_Free_DS0742203H_BD03',
':_Camp1_Over_EO3982112A_BD07', ':_Camp1_Over_EO4022202A_BD16', ':_Camp1_Over_EO4022202A_BD16',
':_Camp1_AS07_DS0722204H_DD02', ':_Camp1_AS07_DS0722204H_DD02', ':_Camp1_AS07_DS0722204H_DD02',
':_Camp1_AS07_DS0722204H_DD02']}
cust_df = pd.DataFrame(cust)