I have the following "TL" column in a pandas dataframe:
ID TL
1 alfdjalk
2 jafd;jsa
3
4
5 ajf;dlka;fd
6 ajdf;k
Right now the TL has dtype of object. The blanks are empty strings.
I want to make the empty strings nulls instead. So I tried the following code:
df_EVENT5_28['TL'] = df_EVENT5_28['TL'].apply(lambda x: x.str.strip()).replace('', np.nan)
But I'm getting the error below: AttributeError: 'str' object has no attribute 'str'
Thoughts?