I use the following dictionary to replace missing values in a column in my dataframe:
dct = {
'Central and Eastern Europe': [
'Albania','Bosnia and Herzegovina','Bulgaria','Croatia','Czech Republic','Estonia','Hungary','Kosovo',
'Latvia','Lithuania','Montenegro','North Macedonia','Poland','Romania','Serbia','Slovakia','Slovenia'],
'Commonwealth of Independent States': [
'Armenia','Azerbaijan','Belarus','Georgia','Kazakhstan','Kyrgyzstan','Moldova','Russia','Tajikistan','Turkmenistan','Ukraine','Uzbekistan'],
...
}
Now i use the following code to invert the dictionary:
revdct = {c: r for r, lst in dct.items() for c in lst}
nan = float('NaN')
df = df.set_index('Country')['Region'].fillna(revdct).reset_index()
df
df only shows the dataframe with the two columns 'Country' and 'Region' how do i get the whole dataframe printed, since it has also other columns?