I have this dataframe:
d = {'HP': ['Eu',np.nan, 'Ma'], 'DK': ['A','B','C']}
df = pd.DataFrame(data=d)
df
I am now trying to create a function which will update the Nan Values of the column HP according to the dictionary translation of the column 'DK' I tried this :
def fill_HP(df):
dictt={'A':'Eu','B':'Ma','C':'Ve'}
for i, row in df.iterrows():
if pd.isnull(row['HP']):
df.at(i,'HP')=dictt(row['DK'])
so, logically, I want the NaN filled with "Ma".
I get an error message reading: SyntaxError: can't assign to function call pointing at my "df.at" statement.
What am I doing wrong?