{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import pandas as pd\n",
        "import plotly.figure_factory as ff\n",
        "\n",
        "df = pd.read_csv(\"https://corona-open-data.ckan.de/dataset/afc2e212-b32c-4340-92fe-a278b677abc2/resource/8661d664-56bf-40ca-845d-ebd280e3ce28/download/_airbyte_raw_data.csv\")\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "table = ff.create_table(df)\n",
        "table.show()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "def myprint(x):\n",
        "    global i\n",
        "    i=i+1\n",
        "    pprint.pprint((i,x))\n",
        "    return x"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import json\n",
        "import pprint\n",
        "import plotly.figure_factory as ff\n",
        "\n",
        "def extract_airbyte(a,key):\n",
        "    a = a.apply(json.loads).apply(lambda x: x['data'][key])\n",
        "    return a\n",
        "\n",
        "new_df = df.copy()\n",
        "new_df[[\"value\"]] = new_df[[\"_airbyte_data\"]].apply(extract_airbyte,key=\"value\")\n",
        "new_df[[\"timestamp\"]] = new_df[[\"_airbyte_data\"]].apply(extract_airbyte,key= \"timestamp\")\n",
        "new_df[[\"time\"]] = new_df[[\"_airbyte_data\"]].apply(extract_airbyte,key= \"time\")\n",
        "del new_df[\"_airbyte_data\"]\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "table = ff.create_table(new_df)\n",
        "table.show()"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3 (ipykernel)",
      "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.12.3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 4
}