I have a column within a dataframe that is composed of lists. I am trying to use an if statement to identify values in these lists that contain any special character or number. The numbers I am trying to identify are string values, not numeric. I have tried using regex to identify these values, but I don't know exactly how to use this in an if statement.
The code below gives me what I want, but I know there has to be a more succinct way to do it:
if '-' in row['col_name'].iloc[0] or '/' in row['col_name'].iloc[0] or '0' in row['col_name'].iloc[0] or '1' in row['col_name'].iloc[0]:
return action
I only included a few special characters and numbers in this example. I would like to find ANY special character or numeric value. Thank you in advance!