{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "2b8d4789-78b3-4f31-9207-4ba6fcf90ad4", "metadata": {}, "outputs": [], "source": [ "# data = \"data/data-3d9Ex.csv\"\n", "import plotly.express as px\n", "import pandas as pd\n", "import geopandas as gpd\n", "import numpy as np\n", "import json\n", "import datetime as dt\n", "\n", "from dash import Dash, dcc, html, Input, Output\n", "import dash_bootstrap_components as dbc\n", "import os\n", "\n", "colorscales = px.colors.named_colorscales()" ] }, { "cell_type": "code", "execution_count": 2, "id": "1b985925-91c8-4eb9-bb41-293318bd924e", "metadata": {}, "outputs": [], "source": [ "## Local settings to be able to test the app in the user environment and for running as a report\n", "URL_PREFIX = os.path.join(\"/\", os.getenv(\"REPORT_URL\"))\n", "PORT = os.getenv(\"REPORT_PORT\", 9000)\n", "HOSTNAME = os.getenv(\"HOSTNAME\")\n", "SERVER_NAME = os.getenv(\"SERVERNAME\")" ] }, { "cell_type": "code", "execution_count": 3, "id": "9ef312bf-3c18-4417-806b-3d07830d96d3", "metadata": {}, "outputs": [], "source": [ "# Hungary counties shapefile\n", "# url = \"https://maps.princeton.edu/download/file/stanford-dt251rh6351-shapefile.zip\"" ] }, { "cell_type": "code", "execution_count": 4, "id": "c6822dbd-d897-445f-9743-f7267d66537c", "metadata": { "tags": [] }, "outputs": [], "source": [ "#!cd data && wget https://maps.princeton.edu/download/file/stanford-dt251rh6351-shapefile.zip && unzip stanford-dt251rh6351-shapefile.zip" ] }, { "cell_type": "code", "execution_count": 5, "id": "57706225-be2f-4267-9333-60d3e736f854", "metadata": {}, "outputs": [], "source": [ "# read shp data into geopandas\n", "gg = gpd.read_file(\"data/dt251rh6351.shp\")\n", "ggjson = gg.to_json()\n", "# gg.head()\n", "\n", "# We will need gejson\n", "dggjson = json.loads(ggjson)\n", "\n", "# Turns out one of the county's name is misspelled so we rename it for now in the dataframe\n", "# [f['properties']['name_1'] for f in dggjson['features']]" ] }, { "cell_type": "markdown", "id": "bb6b0eda-51f1-4bf9-b161-487db05e4ebc", "metadata": {}, "source": [ "## Heti adatok" ] }, { "cell_type": "markdown", "id": "770e6ba1-e48a-4fde-aa77-5b898e9853e5", "metadata": {}, "source": [ "### Letoltes\n", "https://atlo.team/koronaterkep/#megyeibovebb" ] }, { "cell_type": "code", "execution_count": 6, "id": "7e5eeb9f-847c-4e73-8b73-9fc6a97ba56b", "metadata": {}, "outputs": [], "source": [ "# https://www.eea.europa.eu/data-and-maps/data/eea-reference-grids-2/gis-files/hungary-shapefile\n", "# Fertozottek szama kumulativ\n", "url = \"https://docs.google.com/spreadsheets/d/1djH-yUHLPwuEExCjiXS__6-8W2Yp_msFvShpL4bBcuM/export?format=xlsx&gid=1283792994\"\n", "# heti uj esetek szama\n", "url = \"https://docs.google.com/spreadsheets/d/1djH-yUHLPwuEExCjiXS__6-8W2Yp_msFvShpL4bBcuM/export?format=xlsx&gid=1332599659\"\n", "heti_df = pd.read_excel(url) \n", "\n", "heti_df['date'] = pd.to_datetime(heti_df['Dátum']) #, format='%y-%m-%d')\n", "#heti_df = heti_df.drop(columns=['Dátum', 'Összesen'])" ] }, { "cell_type": "code", "execution_count": 7, "id": "4290d58d-5dfc-46ee-afd7-c46148c62e7c", "metadata": {}, "outputs": [], "source": [ "#Rename Győr to Gyor\n", "heti_df = heti_df.rename(columns={'Győr-Moson-Sopron':'Gyor-Moson-Sopron'})" ] }, { "cell_type": "code", "execution_count": 8, "id": "e6d276b1-ccf5-4248-bd08-9c27c180fac7", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | 13 | \n", "14 | \n", "15 | \n", "16 | \n", "17 | \n", "18 | \n", "19 | \n", "20 | \n", "21 | \n", "22 | \n", "... | \n", "146 | \n", "147 | \n", "148 | \n", "149 | \n", "150 | \n", "151 | \n", "152 | \n", "153 | \n", "154 | \n", "155 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bács-Kiskun | \n", "19.0 | \n", "3.0 | \n", "1.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "1.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "577.0 | \n", "505.0 | \n", "0.0 | \n", "730.0 | \n", "217.0 | \n", "216.0 | \n", "184.0 | \n", "177.0 | \n", "184.0 | \n", "197.0 | \n", "
Baranya | \n", "23.0 | \n", "6.0 | \n", "4.0 | \n", "0.0 | \n", "3.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "1.0 | \n", "... | \n", "658.0 | \n", "537.0 | \n", "0.0 | \n", "661.0 | \n", "257.0 | \n", "204.0 | \n", "182.0 | \n", "193.0 | \n", "232.0 | \n", "354.0 | \n", "
Békés | \n", "8.0 | \n", "3.0 | \n", "2.0 | \n", "1.0 | \n", "2.0 | \n", "1.0 | \n", "-6.0 | \n", "0.0 | \n", "0.0 | \n", "0.0 | \n", "... | \n", "585.0 | \n", "359.0 | \n", "0.0 | \n", "507.0 | \n", "208.0 | \n", "199.0 | \n", "228.0 | \n", "204.0 | \n", "239.0 | \n", "226.0 | \n", "
Borsod-Abaúj-Zemplén | \n", "7.0 | \n", "38.0 | \n", "8.0 | \n", "9.0 | \n", "3.0 | \n", "-1.0 | \n", "0.0 | \n", "-3.0 | \n", "0.0 | \n", "1.0 | \n", "... | \n", "658.0 | \n", "495.0 | \n", "0.0 | \n", "575.0 | \n", "179.0 | \n", "174.0 | \n", "158.0 | \n", "174.0 | \n", "195.0 | \n", "205.0 | \n", "
Budapest | \n", "317.0 | \n", "386.0 | \n", "299.0 | \n", "284.0 | \n", "198.0 | \n", "103.0 | \n", "94.0 | \n", "103.0 | \n", "64.0 | \n", "58.0 | \n", "... | \n", "1819.0 | \n", "1437.0 | \n", "0.0 | \n", "1977.0 | \n", "835.0 | \n", "786.0 | \n", "795.0 | \n", "1011.0 | \n", "1171.0 | \n", "1042.0 | \n", "
5 rows × 143 columns
\n", "