Skip to content

Instantly share code, notes, and snippets.

@restrepo
Last active March 23, 2020 23:07
Show Gist options
  • Save restrepo/a09c006f3a4591d989b8d08e05e30ed3 to your computer and use it in GitHub Desktop.
Save restrepo/a09c006f3a4591d989b8d08e05e30ed3 to your computer and use it in GitHub Desktop.
Datos oficiales COVID-19 Colombia de @MinSaludCol en https://infogram.com/covid-2019-ins-colombia-1hnq41zg9ord63z
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
},
"colab": {
"name": "COCOVID-19.ipynb",
"provenance": [],
"include_colab_link": true
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/restrepo/a09c006f3a4591d989b8d08e05e30ed3/COCOVID-19.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "0v39TKzxW2Rp",
"colab_type": "code",
"colab": {}
},
"source": [
"import requests\n",
"import pandas as pd\n",
"\n",
"r=requests.get('https://infogram.com/covid-2019-ins-colombia-1hnq41zg9ord63z')\n",
"\n",
"head='\"data\":[[[\"ID de caso\",'\n",
"tail=']]]'\n",
"js='{}{}{}'.format( head.split(':')[-1],\n",
" r.text.split(head)[-1].split(tail)[0],\n",
" tail\n",
" )\n",
"\n",
"df=pd.read_json(js)\n",
"\n",
"coco=pd.DataFrame([l for l in df[range(1,df.columns[-1]+1)].values[0]],columns=df[0][0] )\n",
"#coco['Fecha']=pd.to_datetime(coco['Fecha de diagnóstico'],format=\"%d/%m/%Y\")"
],
"execution_count": 0,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment