-6

I have a column of strings in abcd@xxxxx@yyyyy@zzzz format,in a dataframe column . I want to iterate over all the values of the column, split the value using delimiter and extract the last part in a newly created column . To do so, I tried the below approach :

data['Issues']=data.Summary.str.split('@')[-1]

Where, 'Issues' is the newly created column and 'Summary' is the column I am iterating over. However doing so , I am getting the below error: KeyError: -1

Can anyone please help with the solution ?

Niladri
  • 29
  • 4

1 Answers1

0

No need for regex here:

result = input_str.split('@')[-1]
Konrad Rudolph
  • 530,221
  • 131
  • 937
  • 1,214