Package: covidmx
covidmxPython API to get information about COVID-19 in México.Requirementsmore-itertools>=6.0.0
pandas>=0.25.2
Unidecode>=1.1.1
requests==2.21.0
xlrd==1.2.0
mapsmx==0.0.3
matplotlib==3.0.3
mapclassify==2.2.0
descartes==1.1.0How to installpip install covidmxHow to useDirección General de EpidemiologíaThe mexicanDirección General de Epidemiologíahas released open dataabout COVID-19 in México. This source contains information at the individual level such as gender, municipality and health status (smoker, obesity, etc). The packagecovidmxnow can handle this source as default. Some variables are encoded as integers and the source also includes a data dictionary with all relevant information. When you passclean=True(default option) returns the decoded data. You can also have access to the catalogue usingreturn_catalogo=Trueand to the description of each one of the variables withreturn_descripcion=True. When you use some of this parameters, the API returns a tuple.fromcovidmximportCovidMXcovid_dge_data=CovidMX().get_data()raw_dge_data=CovidMX(clean=False).get_data()covid_dge_data,catalogo_data=CovidMX(return_catalogo=True).get_data()covid_dge_data,descripcion_data=CovidMX(return_descripcion=True).get_data()covid_dge_data,catalogo_data,descripcion_data=CovidMX(return_catalogo=True,return_descripcion=True).get_data()To get historical data use:covid_dge_data=CovidMX(date='12-04-2020').get_data()Default date format is%d-%m-%Y, but you can also use a particular format with:covid_dge_data=CovidMX(date='2020-04-12',date_format='%Y-%m-%d').get_data()Plot moduleAs of version 0.3.0,covidmxincludes a module to create maps of different COVID-19 status at the national and state levels, with the possibility of including municipalities (using information of theDirección General de Epidemiologia).fromcovidmximportCovidMXdge_plot=CovidMX().get_plot()You can check available status and available states using:dge_plot.available_statesarray(['MÉXICO','CIUDAD DE MÉXICO','TAMAULIPAS','BAJA CALIFORNIA','YUCATÁN','GUERRERO','BAJA CALIFORNIA SUR','JALISCO','NUEVO LEÓN','SONORA','VERACRUZ DE IGNACIO DE LA LLAVE','PUEBLA','CAMPECHE','GUANAJUATO','SAN LUIS POTOSÍ','MICHOACÁN DE OCAMPO','COAHUILA DE ZARAGOZA','QUERÉTARO','AGUASCALIENTES','TABASCO','HIDALGO','ZACATECAS','DURANGO','CHIHUAHUA','CHIAPAS','SINALOA','QUINTANA ROO','MORELOS','TLAXCALA','NAYARIT','OAXACA','COLIMA'],dtype=object)dge_plot.available_status['confirmados','negativos','sospechosos','muertos']To plot a national map just use:dge_plot.plot_map(status='confirmados')If you want to include municipalities use:dge_plot.plot_map(status='confirmados',add_municipalities=True)You can pass a particular state filling thestateargument with a valid name included in theavailable_statesattribute:dge_plot.plot_map(status='confirmados',state='CIUDAD DE MÉXICO',add_municipalities=True)state='CIUDAD DE MÉXICO'state='JALISCO'state='MORELOS'state='MÉXICO'Finally you can plot another interest variable (according toavailable_statusattribute):dge_plot.plot_map(status='sospechosos',add_municipalities=True)You can save your maps usingsave_file_name:dge_plot.plot_map(status='sospechosos',add_municipalities=True,save_file_name='sospechosos-nacional.png')SerendipiaSerendipiapublishes daily informationof the mexicanSecretaría de Saludabout covid in open format (.csv). This api downloads this data easily, making it useful for task automation.fromcovidmximportCovidMXlatest_published_data=CovidMX(source='Serendipia').get_data()ThenCovidMXinstances aSerendipiaclass, searches the latest published data for both confirmed and suspects individuals and finally clean the data. Nevertheless, a more specific search can be conducted (see docs for details).raw_data=CovidMX(source='Serendipia',clean=False).get_data()confirmed=CovidMX(source='Serendipia',kind="confirmed").get_data()suspects=CovidMX(source='Serendipia',kind="suspects").get_data()particular_published_date=CovidMX(source='Serendipia',date='2020-04-10',date_format='%Y-%m-%d').get_data()Cite asFederico Garza Ramírez (2020).covidmx: Python API to get information about COVID-19 in México. Python package version 0.3.1.https://github.com/FedericoGarza/covidmx.AcknowledgmentsMax MergenthalerMario JimenezRelease information0.3.1 (Current version)2020-06-01Updated new urls from serendipia source. (Thanks toMario Jimenez.)0.3.02020-04-26.Includes a plot module at state and municipality leveles.Includes a better handling of encodings. (Thanks toMario Jimenez.)0.2.52020-04-20. TheDirección General de Epidemiología:Added an id column.Released historical information.Now the API can handle this changes.0.2.42020-04-16. TheDirección General de Epidemiologíasource renamed two columns:HABLA_LENGUA_INDI->HABLA_LENGUA_INDIG(column name and description are now homologated)OTRA_CON->OTRA_COMNow the API can handle this change.0.2.3Now works withpython3.5+.Usingclean=Truereturns encoded data instead of decoded data without cleaning columns (as works in0.2.0and0.2.1).0.2.1Minor changes to README.0.2.0Added new source:Dirección General de Epidemiología. Default source.Only works withpython3.7+.0.1.1Minor changes to README.0.1.0First realease.Only one source,Serendipia. Default source.