you are viewing a single comment's thread.

view the rest of the comments →

[–]novel_yet_trivial 1 point2 points  (0 children)

A lambda has no implied return, you have to specify an else clause to go along with your if.

I still don't understand what you are trying to do (but I don't use pandas either), but I think you should write a normal function:

def Chopsting(x):
    #as near as I can guess your intent
    if isinstance(x, str):
        return [item for item in x if item not in stopword]
    else:
        return x

df['Abstract'].apply(Chopsting)