I have row values as such:
ID MyColumn
0 A "Best Position 3 5"
1 B "Healthy (unexpired)
2 C "At-Large"
3 D "Run 2 Position 1"
4 E "Hello"
4 E "None"
4 E "Tomorrow"
I want to scan this table for any rows that contain substrings "Position", and then for those rows keep only the first instance of an int. I have the Lambda / regex for taking the first instance of an int in a value:
...str.replace(r'\D+', '').str.split()
but I'm not sure how to apply it on the condition of substring appearances.
Resulting set:
ID MyColumn
0 A "3"
1 B "Healthy (unexpired)
2 C "At-Large"
3 D "2"
4 E "Hello"
4 E "None"
4 E "Tomorrow"