I am trying to figure out how to incorporate regex into a python if statement. I have a pandas dataframe where I am iterating over the rows and want to perform an action every time the row has a specific combination of text. The regex should match any 7 character string that begins with a capital letter followed by 6 numbers (ie. R142389)
for index, row in df1.iterrows():
if row[4] == REGEX HERE:
Perform Action
Am I going about this the right way? Any help would be greatly appreciated!