I have a dataframe like as shown below
df = pd.DataFrame({'person_id': [11,11,11],'text':['DOSE: 667 mg - TDS with food - Inject hypo > 4 test value here','DOSE: 667 mg - TDS with food - Tube','DOSE: 667 mg - TDS with food - PO'],'Summary':['Test','Test1','Test2']})
From the above data frame, I would like to extract everything that
a) comes after DOSE: and before 1st hyphen -
b) Again extract everything that comes after 2nd hyphen -.
I was trying something like below
df['text'].str.extract('(\d+[A-Za-ZS]*(\-))',expand=True) # doesn't work
s1 = df['text'].str.split() # I tried using `str.split`
s1[0][1] # it goes on like for loop which is not elegant.
Can help me with the above?
I expect my output to be like as shown below
