I have this following df:
d = {'role': ['admin/tech', 'admin', 'programming/asst/design']}
df = pd.DataFrame(data=d)
My goal is:
In other words, extract everything before the first '/' IF row contains '/'
I came up with:
and now I need to add a IF statement for this function
I tried something like:
But it doesn´t work.
Thanks in advance, I really appreciate suggestions!!




elsestatement, hence the error. Otherwise what should happen ifx.loweris notTrue? docs.python.org/2.5/whatsnew/pep-308.html