Skip to content

Instantly share code, notes, and snippets.

@alonsosilvaallende
Created July 20, 2021 12:30
Show Gist options
  • Save alonsosilvaallende/34be275862e96872377d8ebbd190d3bc to your computer and use it in GitHub Desktop.
Save alonsosilvaallende/34be275862e96872377d8ebbd190d3bc to your computer and use it in GitHub Desktop.
Poblacion-objetivo.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Poblacion-objetivo.ipynb",
"provenance": [],
"authorship_tag": "ABX9TyO3RTwOg/BphIo8e1sZkNc6",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/alonsosilvaallende/34be275862e96872377d8ebbd190d3bc/poblacion-objetivo.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "GZZOcNmY4nOE"
},
"source": [
"import pandas as pd"
],
"execution_count": 1,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "hkTY5Dl74os5"
},
"source": [
"poblacion_raw = pd.read_csv(\"https://raw.githubusercontent.com/alonsosilvaallende/COVID-19/master/data/ine_estimaciones-y-proyecciones-de-poblaci%C3%B3n-1992-2050_base-2017_base-de-datos.csv\", encoding='ISO-8859-1', sep=\";\", thousands='.')"
],
"execution_count": 2,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"id": "KVySw6t94q1w"
},
"source": [
"poblacion = pd.DataFrame()\n",
"poblacion[\"Edad\"] = poblacion_raw.iloc[1:102,0]\n",
"poblacion[\"Poblacion\"] = poblacion_raw.iloc[1:102,30] # Población 2021\n",
"poblacion = poblacion.set_index(\"Edad\")"
],
"execution_count": 3,
"outputs": []
},
{
"cell_type": "code",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "qaayns0Y4wV-",
"outputId": "33f42673-1b70-4592-fd1b-429cbe28a6e6"
},
"source": [
"print(f\"Población objetivo anterior: {poblacion.iloc[18:].sum().values[0]}\")\n",
"print(f\"Población objetivo actual: {poblacion.iloc[12:].sum().values[0]}\")"
],
"execution_count": 4,
"outputs": [
{
"output_type": "stream",
"text": [
"Población objetivo anterior: 15200840.0\n",
"Población objetivo actual: 16696002.0\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "f7hnEPdA46bD"
},
"source": [
""
],
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment