I have a dataframe as below:
df = pd.DataFrame({'a': [10, 11, None],
'b': ['apple;', None, 'orange;'],
'c': ['red', 'blue', 'green']})
I'm trying to strip the ';' of those strings. I tried
df.select_dtypes(include=['object']).applymap(lambda x: x.strip(';'))
I got error message:
AttributeError: ("'NoneType' object has no attribute 'strip'", 'occurred at index b')
Seems like the None gave me some trouble. Help is greatly appreciated. Thanks a lot.