azulgarza / covidmx Goto Github PK
View Code? Open in Web Editor NEWPython API to get information about COVID-19 in México.
License: MIT License
Python API to get information about COVID-19 in México.
License: MIT License
I'm trying to run the covid_dge_data = CovidMX().get_data()
line, but it get the runtime error Cannot read the data
. Also get the following: URLError: <urlopen error [Errno 60] Operation timed out>.
I've failed to pull request at the dge.py file to change the URL_DESCRIPTION
and URL_HISTORICAL
for the updated ones:
URL_DESCRIPTION = 'http://epidemiologia.salud.gob.mx/gobmx/salud/datos_abiertos/diccionario_datos_covid19.zip' URL_HISTORICAL = 'http://epidemiologia.salud.gob.mx/gobmx/salud/datos_abiertos/datos_abiertos_covid19.zip'
Hi,
when I run covid_dge_data,
catalogo_data = CovidMX(return_catalogo=True).get_data()
get:
Traceback (most recent call last) <ipython-input-8-9c05e955ccf6> in <module>() 3 covid_dge_data = CovidMX().get_data() 4 raw_dge_data = CovidMX(clean=False).get_data() ----> 5 covid_dge_data, catalogo_data = CovidMX(return_catalogo=True).get_data() 6 covid_dge_data, descripcion_data = CovidMX(return_descripcion=True).get_data() 7 covid_dge_data, catalogo_data, descripcion_data = CovidMX(return_catalogo=True, return_descripcion=True).get_data() /usr/local/lib/python3.6/dist-packages/covidmx/covidmx.py in CovidMX(source, **kwargs) 27 28 if source == "Serendipia": ---> 29 return Serendipia(**kwargs) TypeError: __init__() got an unexpected keyword argument 'return_catalogo'
and covid_dge_data, descripcion_data = CovidMX(return_descripcion=True).get_data()
get:
Traceback (most recent call last) <ipython-input-22-1b8abfd4e7ee> in <module>() 4 #raw_dge_data = CovidMX(clean=False).get_data() 5 #covid_dge_data, catalogo_data = CovidMX(return_catalogo=True).get_data() ----> 6 covid_dge_data, descripcion_data = CovidMX(return_descripcion=True).get_data() 7 #covid_dge_data, catalogo_data, descripcion_data = CovidMX(return_catalogo=True, return_descripcion=True).get_data() /usr/local/lib/python3.6/dist-packages/covidmx/covidmx.py in CovidMX(source, **kwargs) 27 28 if source == "Serendipia": ---> 29 return Serendipia(**kwargs) TypeError: __init__() got an unexpected keyword argument 'return_descripcion'
By the way, Unidecode package is required, so could be usefull to add this line to install instructions:
pip install unidecode
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'
covid_dge_data = CovidMX().get_data()
data = pd.read_csv(url_data, encoding='UTF-8')
73 except BaseException:
---> 74 raise RuntimeError('Cannot read the data.')
75
76 try:
RuntimeError: Cannot read the data.
I was trying to update the last release to date version 0.3.0 and I got this error when installing:
A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
When I am calling this line
covid_dge_data = CovidMX().get_data()
I have this error:
"There is no item named 'Catalogos_0412.xlsx' in the archive"
Sería bueno agregar la forma correcta de citar este repo.
It is quite long the web dataset reading, for debugin or adding new functions. I have a quick fix for it garciaguevara@ca80395. If you think it is useful I could improve/clean it and do a merge request. Nice and useful repo BTW!
Hola!! I am about to do the weekly multipliers (https://www.facebook.com/gapminder.org/posts/3397004387001162) a very simple yet not common metric of evaluation (I have not seen it for Mexico, yet). I will start by states but then do it per metropolitan regions or municipalities. Let me know if you have suggestions or if you think it could be useful to add this in repo.
When running Python to get information through the get_data method of the CovidMX object, it returns the following error:
raceback (most recent call last):
File "c:/Users/Alejandro Rebollo/Documents/Covid19MX.py", line 4, in
raw_dge_data = CovidMX(clean=False).get_data()
File "C:\Users\Alejandro Rebollo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\covidmx\dge.py", line 33, in get_data
df, catalogo, descripcion = self.read_data()
File "C:\Users\Alejandro Rebollo\AppData\Local\Programs\Python\Python38-32\lib\site-packages\covidmx\dge.py", line 59, in read_data
raise RuntimeError('Cannot read data description.')
RuntimeError: Cannot read data description.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.