I'm struggling to remove the first part of my URLs in column myId in csv file.
my.csv
myID
https://mybrand.com/trigger:open?Myservice=Email&recipient=brn:zib:b1234567-9ee6-11b7-b4a2-7b8c2344daa8d
desired output for myID
b1234567-9ee6-11b7-b4a2-7b8c2344daa8d
my code:
df['myID'] = df['myID'].map(lambda x: x.lstrip('https://mybrand.com/trigger:open?Myservice=Email&recipient=brn:zib:'))
output in myID (first letter 'b' is missing in front of the string):
1234567-9ee6-11b7-b4a2-7b8c2344daa8d
the above code removes https://mybrand.com/trigger:open?Myservice=Email&recipient=brn:zib: However it also removes the first letter from myID if there is one in front of the ID, if it's a number then it remains unchanged.
Could someone help with this? thanks!
:and take last element,df.myID.str.split(":").str[-1]