I have data like this:
user reg ind prod
A Asia Tele TV
A Asia Bank Phone
A Japan Tele Book
B US Fin Paper
B US Data Shop
B Asia Tele TV
B Africa Invest Book
C Asia Tele Paper
C Japan Fin TV
I want to convert the categories in each columns into individual columns and mark them as 1/0 if they there under the user, something like this:
User Asia Japan US Africa Tele Bank Fin Data Invest TV Phone Book Paper Shop
A 1 1 0 0 1 1 0 0 0 1 1 1 0 0
B 1 0 1 1 1 0 1 1 1 1 0 1 1 1
C 1 1 0 0 1 0 1 0 0 1 0 0 1 0
Essentially coding them to mark their association with each category. Also, if i can rename the columns such that it has the main column in it such as "reg_Asia" etc. I tried using Pivot, Pivot_table, Stack, Unstack but was not able to do it.