Im trying creating a function in python to replace any forms of NaN to NaN.
import pandas as pd
import numpy as np
data=pd.read_csv("diabetes.csv")
def proc_all_NaN(data):
nan_sym=["_","-","?","","na","n/a"]
for i in nan_sym:
data.replace(i,np.nan)
proc_all_NaN(data)
I expect the output of my fuction to be a dataframe with NaN where the dataframe had all these types of NaN: "_","-","?","","na","n/a".
The output when i call the function is just my data without any change.
Could you help me, because i dont get my coding mistake