I have a dataframe containing sentences like the following but with more rows:
data= {"text":["see you in five minutes.", "she is my friend.", "she goes to school in five minutes."]}
I would like to extract the sentences containing 'five minutes' in the manner presented below:
desired output:
first part desired part
0 see you in five minutes.
1 NaN NaN
2 she goes to school in five minutes.
I am using the following code but it returns NaN :
data.text.str.extract(r"(?i)(?P<before>.*)\s(?P<minutes>(?=five minutes\s))\w+ \w+")