I have datarame and I need to replace the missing value with the given default value from dictionary. the dictionary:
col_to_def_val = {'director_name':'unknown',
'actor_1_name':'unknown', 'actor_2_name':'unknown', 'actor_3_name':'unknown', 'genres':'unknown',
'plot_keywords':'unknown', 'movie_title':'unknown', 'movie_imdb_link':'unknown', 'country':'unknown'}
key is column and value is the default value. any suggestions?
I tried using
df[key]= df[key].fillna(col_to_def_val[key])
but didn't work