Initial commit

This commit is contained in:
Diego Ripley
2025-05-24 13:37:31 -04:00
commit f93e4d0cec
108 changed files with 11689 additions and 0 deletions
+140
View File
@@ -0,0 +1,140 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 30,
"id": "3849cfa2-bb10-4323-95a3-51d205f497d5",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Buckaroo has been enabled as the default DataFrame viewer. To return to default dataframe visualization use `from buckaroo import disable; disable()`\n"
]
}
],
"source": [
"import os\n",
"\n",
"import buckaroo\n",
"import geopandas as gpd\n",
"from IPython.core.interactiveshell import InteractiveShell\n",
"from lonboard import viz\n",
"import pandas as pd\n",
"from sqlalchemy import create_engine\n",
"\n",
"# Enable multiple outputs per cell\n",
"InteractiveShell.ast_node_interactivity = \"all\"\n",
"# Show all columns\n",
"pd.set_option('display.max_columns', None)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "7e8b2e03-594c-4d8d-8914-ff4fe68117ac",
"metadata": {},
"outputs": [],
"source": [
"DATABASE = os.getenv('POSTGRES_DB')\n",
"USER = os.getenv('POSTGRES_USER')\n",
"PASSWORD = os.getenv('POSTGRES_PASSWORD')"
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "dca70ec0-35c5-4c51-9e6a-5131ed46522c",
"metadata": {},
"outputs": [],
"source": [
"engine = create_engine(f'postgresql://{USER}:{PASSWORD}@db:5432/{DATABASE}')"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "08935c71-ff7b-4a2a-aa9d-029b4231cc71",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "95c1fb1edb9e440d916fa8cd3496bb46",
"version_major": 2,
"version_minor": 1
},
"text/plain": [
"GeopandasBuckarooWidget(buckaroo_options={'sampled': ['random'], 'auto_clean': ['aggressive', 'conservative'],…"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"sql = \"\"\"\n",
"SELECT * FROM silver.pr_2016;\n",
"\"\"\"\n",
"df = gpd.read_postgis(sql, con=engine)\n",
"df"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "03ff2898-1318-4859-8249-d2c3a05117a7",
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "775652f4d632485abaf8babe7c671b25",
"version_major": 2,
"version_minor": 1
},
"text/plain": [
"Map(basemap_style=<CartoBasemap.DarkMatter: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json'…"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"viz(df)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bfcbf94c-0d65-422d-90b3-2a8d79ef1c32",
"metadata": {},
"outputs": [],
"source": []
}
],
"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": 5
}