Creating dummy variables in python




Currently I am working on megastar contest on AV. Below is the structure of data set :

I want to create new variables for each skill as shown below for two cadidates :
1->['sas','python','r'] 2->['r','tableau']
output :

I have changed the “Skills” variable in from of a list for each candidate as shown above(for the two candidates), furthermore I have tried pd.get_dummies but it is taking each element as different levels.

Please suggest the fastest way to do so in Python.



Hi @syed.danish

Is there any way to join 2 dataframes in python on different columns. I am trying to think on these lines


If i want to join a1 and b0, then i can use the comand
a1.join(b0,on= )

I am having trouble here. Can i mention two different column names on the two different data frames?


You can perform join operation by renaming the columns in both a1 and b0 on which you have to join or you can make the desired columns as the index and by default join will merge on the basis of index.
I cannot see how this approach will help in creating dummy varibles, Can you please explain that too?