I have a string value (football score) in my Pandas dataset. I would like to extract the home goals and the away goals from this score.
The score can be written in a couple of ways (sometimes it is won on penalties and presented with brackets.
Standard score:
"4-2"
I would like to extract 4 as the home goals and 2 as the away goals.
Won on penalties:
"(5) 2-3 (4)"
I would like to extract 2 as the home goals and 3 as the away goals and ignore the brackets
Is there a reg-ex (or 2) that would give me the 2 values I require in both instances. Maybe checking for the “-” and take the number either side of it?