I have the following nested_dict:
{'view_0': {'spain': -1}, 'view_1': {'portugal': 0}, 'view_2': {'morocco': 1.0, 'france': -1.0}, 'view_3': {'germany': 0.5, 'italy': 0.5, 'uk': -0.5, 'ireland': -0.5}}
On the other side, I have the following empty_df, wherein the index appears the keys of the nested_dict. and in the columns the key found in the values of each nested_dict.
spain portugal morocco france germany italy uk ireland
view_0 0 0 0 0 0 0 0 0
view_1 0 0 0 0 0 0 0 0
view_2 0 0 0 0 0 0 0 0
view_3 0 0 0 0 0 0 0 0
I would like to place the values.values() of nested_dict in the empty_df to obtain the following output:
spain portugal morocco france germany italy uk ireland
view_0 -1 0 0 0 0 0 0 0
view_1 0 0 0 0 0 0 0 0
view_2 0 0 1 -1 0 0 0 0
view_3 0 0 0 0 0.5 0.5 -0.5 -0.5
And in order to do so I tried a
empty_df.replace(nested_dict)
However returns the empty_dict filled with zeros, not substituting the values.