I am trying to use Regular expression to look at multiple contract specifications in a data frame to then use them in a filter. Below is a snippet of my code.
import pandas as pd
import re
Example_dict = {'S_1':pd.DataFrame({'Product1 Hours':'Lowest priced 5 concecutive hours in HE09 thru HE16',
'Product2 Hours': 'Highest priced 4 consecutive hours in HE17 through HE22'},index=[1,2]).T.reset_index(),
'S_2':pd.DataFrame({'Product1 Hours':'Lowest priced 5 concecutive hours in HE09 thru HE16',
'Product2 Hours': 'Highest priced 4 consecutive hours in HE17 through HE23'},index=[1,2]).T.reset_index()
}
So what I am looking to grab are the hours 09, 16 in one tuple or list and 17, 22 in the next list/tuple. The code I have written will pull the first line of HE for each so when I run this program it will pull 09 and 17. I am not able to find a way to "Jump" to the next occurrence of "HE". Please let me know if this makes sense - thank you
Edit
I wanted to update what my end goal dataframe/dictionary looks like. I am using a nested dictionary of data frames that has different spec information. I am curious how we could loop through these keys to get the hours of each key so for S_1 it would be (9,16), (17,22) and for S_2 it would be (09,16) , (17,23). Let me know if this clarifies the end goal