Say I have data like this
| Account | |
|---|---|
| 1 | Kevin (1234567) |
| 2 | Buzz (7896345) |
| 3 | Snakes (5438761) |
| 4 | Marv |
| 5 | Harry (9083213) |
I want to use an if condition to search to see if the account number exists at the end of the name in the account column, if it does split the account number off and put it in a new column, if not pass and go on to the next Account.
Something like this although it does not work
dataset.loc[dataset.Account.str.contains(r'\(d+')], 'new'=dataset.Account.str.split('',n=1, expand=True)
dataset["Account_Number"] = new[1]
\d+, notd+.