Как преобразовать код страны в название с помощью country_converter в pandas

#python #python-3.x #pandas #dataframe

#python #python-3.x #pandas #фрейм данных #коды стран

Вопрос:

 df
         Date        Value CODE
0      2020-03-12      7  AFG
1      2020-03-11      7  AFG
...
  

Как я могу сгенерировать страну из кода? Я попробовал, который просто сгенерировал код из переменной CODE

 import country_converter as coco
df['country'] = df['CODE'].apply(coco.convert)
  
 Actual Output:
         Date        Value CODE  country
0      2020-03-12      7  AFG     AFG  
1      2020-03-11      7  AFG     AFG 
  
 Expected Output:
         Date        Value CODE  country
0      2020-03-12      7  AFG     Afghanistan  
1      2020-03-11      7  AFG     Afghanistan  
  

Ответ №1: