Can you please help me how to disentangle the following issue. I have a column in pandas df called "names" that contains links to webpages. I need to create a variable called "total categories" that will contain the parts of the link that appears after the last appearance of "/" sign. Example:
names
https://www1.abc.com/aaa/72566-finance
https://www1.abc.com/aaa1/725-z2
https://www1.abc.com/aaa2/75-z3
total categories
72566-finance
725-z2
75-z3
I tried this code:
def find_index(x):
return x.rindex('/')
data_pd['total categories'] = data_pd['names'].apply(find_index)
I receive the following error:
AttributeError: 'float' object has no attribute 'rindex'