I'm currently learning python and trying few pandas functions in Jupyter notebook. I'm trying to split the column values based on '/' delimiter using lambda function and the error 'list index out of range' threw. The column looks as below
column_name
---------------
screen1/screen2
screen2
screen3/screen4
Now, I've used the lambda functions as below:
df['new_column_name'] = df['column_name'].apply(lambda x:x.split('/')[1])
df.head()
Can someone pls help me out how can I overcome the 'list index out of range' error and split these values into a new column ?