I have this for with the name of the text columns of my Dataframe, I want to replace the '' and nan by None for the database to be NULL, but when I try to replace nan to None it gives an error, so I tried to change from nan to '' and then None, but it is sending to the bank as a string "None"
for item in ['column1', 'column2', 'column3']:
DataFrame[item] = DataFrame[item].astype(str).str.strip().replace('nan', np.nan).replace(np.nan, '').replace('', None)
del item
Does anyone know how to fix this or have a better idea of how to replace empty texts or 'nan' with None?