{ "cells": [ { "cell_type": "markdown", "id": "fa839470", "metadata": {}, "source": [ "# Global Aviation Infrastructure\n", "\n", "Starter notebook for the Kaggle dataset in this folder. It loads `airports.csv` with pandas and walks through quality checks and a first piece of analysis.\n", "\n", "**Files:** `airports.csv`, `data_dictionary.csv`." ] }, { "cell_type": "markdown", "id": "0000f7f2", "metadata": {}, "source": [ "## 1. Load the data" ] }, { "cell_type": "code", "id": "6dee3115", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "import pandas as pd\n", "\n", "df = pd.read_csv(\"airports.csv\", low_memory=False)\n", "print(df.shape)" ] }, { "cell_type": "markdown", "id": "325de123", "metadata": {}, "source": [ "## 2. Shape, types and missing values" ] }, { "cell_type": "code", "id": "6eb42bc8", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "print(f\"{df.shape[0]:,} rows x {df.shape[1]} columns\")\n", "\n", "missing = df.isna().mean().mul(100).sort_values(ascending=False)\n", "missing[missing > 0].round(1).to_frame(\"missing_%\").head(15)" ] }, { "cell_type": "markdown", "id": "f2d963fe", "metadata": {}, "source": [ "## 3. Numeric summary" ] }, { "cell_type": "code", "id": "aa2f8fd4", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df.describe(include='number').T.round(2).head(20)" ] }, { "cell_type": "markdown", "id": "64b58558", "metadata": {}, "source": [ "## 4. Airport types" ] }, { "cell_type": "code", "id": "36be633b", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"type\"].value_counts().to_frame(\"airports\")" ] }, { "cell_type": "markdown", "id": "7d2092af", "metadata": {}, "source": [ "## 5. Runway length distribution" ] }, { "cell_type": "code", "id": "836a8046", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"longest_runway_m\"].dropna().clip(upper=5000).hist(bins=50, figsize=(9, 4))" ] }, { "cell_type": "markdown", "id": "4da43476", "metadata": {}, "source": [ "## 6. Top countries by airport count" ] }, { "cell_type": "code", "id": "fce7b7b1", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"country_name\"].value_counts().head(15).to_frame(\"airports\")" ] }, { "cell_type": "markdown", "id": "85366872", "metadata": {}, "source": [ "## 7. Paved share by region" ] }, { "cell_type": "code", "id": "553dd570", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "(df.assign(paved=df[\"paved_runway_count\"] > 0)\n", " .groupby(\"country_region\")[\"paved\"].mean().mul(100).round(1).to_frame(\"paved_%\"))" ] }, { "cell_type": "markdown", "id": "3acf2169", "metadata": {}, "source": [ "## 8. Scheduled service by airport size" ] }, { "cell_type": "code", "id": "cab77bbe", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "pd.crosstab(df[\"type\"], df[\"has_scheduled_service\"], normalize=\"index\").round(3)" ] }, { "cell_type": "markdown", "id": "6e43770c", "metadata": {}, "source": [ "## Next steps\n", "\n", "See `KAGGLE.md` for analysis ideas, caveats and provenance." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.11", "mimetype": "text/x-python", "file_extension": ".py", "codemirror_mode": { "name": "ipython", "version": 3 }, "pygments_lexer": "ipython3", "nbconvert_exporter": "python" } }, "nbformat": 4, "nbformat_minor": 5 }