I have a dataframe composed of text job descriptions, and 3 empty columns
index job_description level_1 level_2 level_3
0 this job requires masters in.. 0 0 0
1 bachelor degree needed for.. 0 0 0
2 ms is preferred or phd.. 0 0 0
I'm trying to go through each job description string and count the frequency of each degree level that was mentioned in the job description. A sample output should look like this.
index job_description level_1 level_2 level_3
0 this job requires masters in.. 0 1 0
1 bachelor degree needed for.. 1 0 0
2 ms is preferred or phd.. 0 1 1
I created the dictionaries to do the comparison as seen below, but I'm somewhat clueless on how I can look for those words in the strings of the dataframe "job description" column and populate the dataframe columns depending on whether the words exist or not.
my_dict_1 = dict.fromkeys(['bachelors', 'bachelor', 'ba','science
degree','bs','engineering degree'], 1)
my_dict_2 = dict.fromkeys(['masters', 'ms', 'master'], 1)
my_dict_3 = dict.fromkeys(['phd','p.h.d'], 1)
I really appreciate the support on this..