AzulGarza / covidmx

Python API to get information about COVID-19 in México.
MIT License
19 stars 7 forks source link

KeyError: 'HABLA_LENGUA_INDIG' #7

Closed cruzdany closed 4 years ago

cruzdany commented 4 years ago

Hi! I'm running the following command: covid_dge_data, catalogo_data, descripcion_data = CovidMX(return_catalogo=True, return_descripcion=True).get_data() And I am getting the following error:

KeyError Traceback (most recent call last)

in 3 #covid_dge_data, catalogo_data = CovidMX(return_catalogo=True).get_data() 4 #covid_dge_data, descripcion_data = CovidMX(return_descripcion=True).get_data() ----> 5 covid_dge_data, catalogo_data, descripcion_data = CovidMX(return_catalogo=True, return_descripcion=True).get_data() ~\AppData\Local\Continuum\anaconda3\lib\site-packages\covidmx\dge.py in get_data(self) 36 if self.clean: 37 print('Cleaning data') ---> 38 df = self.clean_data(df, catalogo, descripcion) 39 40 print('Ready!') ~\AppData\Local\Continuum\anaconda3\lib\site-packages\covidmx\dge.py in clean_data(self, df, catalogo, descripcion) 172 for col in df.columns: 173 df[col] = self.replace_values( --> 174 df, col, desc_dict, catalogo_dict) 175 176 ~\AppData\Local\Continuum\anaconda3\lib\site-packages\covidmx\dge.py in replace_values(self, data, col_name, desc_dict, catalogo_dict) 130 def replace_values(self, data, col_name, desc_dict, catalogo_dict): 131 --> 132 formato = desc_dict[col_name] 133 if 'FECHA' in col_name: 134 return pd.to_datetime( KeyError: 'HABLA_LENGUA_INDIG'
AzulGarza commented 4 years ago

Hi!

I think this is due to the change made yesterday by the Dirección General de Epidemiología (april 16). Two columns were renamed. I fixed this update trough a new version of the package (0.2.4).

In short, try updating the package using

pip install covidmx --upgrade
cruzdany commented 4 years ago

It worked, thanks!