I have a list of words which i need to match as a whole string in a column named "Description"
For example : Description- Robert is a great R PROGRAMMER!
My Code:
`m=['Refresh','Update','R','Notebook']
The next piece of code is where I need help on:
data['Matched_count']=data.description.str.count('|'.join(m))
The above gives me a count of the substring match. For example - all the 'R' being used in the description is counted
data['Matched_count']=data.description.str.contains('|'.join(m)).astype(int)
The above just gives me a flag of 0 and 1 for the substring match
data['Matched_count']=data.description.str.match('|'.join(m)).astype(int)
This comes close to the entire String matching . However this doesnt give me the count of the string .It just flags it as 1 or 0 based on it being present in the Description
I need to count the occurrence of the entire string in the dataframe in a new column