I'm new to python and I'm trying to use fillna() functionality and facing some problem. I have a DataFrame called Temp_Data_DF which has two columns like below:
Temp_Data_DF:
A B
1 NAN
2 NAN
3 {'KEY':1,'VALUE':2}
I want to replace all NAN with Dict value and resulted dataframe should be like this:
Temp_Data_DF:
A B
1 {'KEY':1,'VALUE':2}
2 {'KEY':1,'VALUE':2}
3 {'KEY':1,'VALUE':2}
I tried the below code:
Bvalue = {'KEY':1,'VALUE':2}
Temp_Data_DF['B']=Temp_Data_DF['B'].fillna(Bvalue)
But its not replacing the NAN with desired value Any help will be appreciated.
I was refering to below link.