I have a pandas dataframe like below with column name 'texts'
texts
throne one
bar one
foo two
bar three
foo two
bar two
foo one
foo three
one three
I want to count presence of three words 'one' and 'two' and 'three' for each row and return count of matches for these words, if it is a complete word. Output will look like below.
texts counts
throne one 1
bar one 1
foo two 1
bar three 1
foo two 1
bar two 1
foo one 1
foo three 1
one three 2
you can see than for the first row, count is 1 as 'throne' was not considered as one of the value being searched 'one' is not a complete word and instead it is 'throne'.
Any help on this?
one threehas count 2 as i am originally searching for count ofone,twoandthree. in the last row, both the values are present. So it is rightly giving count of 2