I'm trying to iterate on a dataframe. I want to replace a few characters by anothers, unless the item I'm iterating is null/nan/NaN/etc.
For that I'm trying to use this line below:
lista['ultima_receita'] = lista['ultima_receita'].apply(lambda rstr: float(rstr.replace('.','').replace(',','.')[3:]) if pd.isnull(rstr) == False)
However it keeps getting me a invalid synthax error:
lista['ultima_receita'] = lista['ultima_receita'].apply(lambda rstr: float(rstr.replace('.','').replace(',','.')[3:]) if pd.isnull(rstr) == False)
^
SyntaxError: invalid syntax
I've tried everything I could and didn't find out the reason why the synthax is wrong. Can someone help?