Skip to content
Advertisement

Tag: dataframe

Get index of row where pandas column contains regex

I am checking to see if a pandas column matches a pre-defined regex, using .any() to get the first match if found. However, I need to return the index/row where this match occurred so that I can get the value of another column in that row. I have the below to check where the reg_ex pattern exists in df[‘id_org’] Once

Advertisement