{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# Official Data Observatory\n",
        "\n",
        "Load an official indicator exported by Ceteris Lab, plot the time series, calculate growth rates, and write a short limitation note."
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "import pandas as pd\n",
        "import matplotlib.pyplot as plt\n",
        "\n",
        "df = pd.read_csv(\"official-data.csv\")\n",
        "df.head()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "df[\"date\"] = pd.to_datetime(df[\"date\"], errors=\"coerce\")\n",
        "df = df.dropna(subset=[\"date\", \"value\"]).sort_values(\"date\")\n",
        "\n",
        "ax = df.plot(x=\"date\", y=\"value\", legend=False, figsize=(8, 4), title=df[\"indicator\"].iloc[0])\n",
        "ax.set_xlabel(\"Date\")\n",
        "ax.set_ylabel(df[\"unit\"].iloc[0])\n",
        "plt.tight_layout()\n",
        "plt.show()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {},
      "outputs": [],
      "source": [
        "df[\"growth_rate\"] = df[\"value\"].pct_change() * 100\n",
        "df[[\"date\", \"value\", \"growth_rate\"]].tail(10)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "## Trend and limitations\n",
        "\n",
        "- What long-run pattern do you see?\n",
        "- Are there breaks, recessions, or unusual years?\n",
        "- What would be risky to infer from this series alone?\n",
        "- Which econometrics lesson does this connect to: data structures, simple regression, multiple regression, inference, or asymptotics?"
      ]
    }
  ],
  "metadata": {
    "kernelspec": {
      "display_name": "Python 3",
      "language": "python",
      "name": "python3"
    },
    "language_info": {
      "name": "python",
      "pygments_lexer": "ipython3"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 5
}
