From 5a07ec545558490e370e707d6f7e1fea10ff817e Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Tue, 7 Dec 2021 01:07:05 +0000 Subject: [PATCH 01/24] start hqta revisions, siuba query error --- .../bus_corridors.ipynb | 299 +++++++-- .../combine_and_visualize.ipynb | 380 +++++------ .../point_exports_opr.ipynb | 606 ++++++++++++++++++ .../rail_ferry_brt.ipynb | 67 +- 4 files changed, 1101 insertions(+), 251 deletions(-) create mode 100644 high_quality_transit_areas/point_exports_opr.ipynb diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index c060d0d90..87bf082cb 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -17,72 +17,79 @@ "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.11.1)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.14.0)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.2.1)\n", + "Collecting pygeos\n", + " Using cached pygeos-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB)\n", + "Collecting ipyleaflet\n", + " Using cached ipyleaflet-0.15.0-py2.py3-none-any.whl (3.3 MB)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", + "Collecting xyzservices>=2021.8.1\n", + " Using cached xyzservices-2021.11.0-py3-none-any.whl (34 kB)\n", + "Collecting traittypes<3,>=0.2.1\n", + " Using cached traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB)\n", "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", + "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", + "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (58.3.0)\n", + "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", + "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.2)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.4.1)\n", "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", + "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.21)\n", - "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.2)\n", + "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.17.3)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", - "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", + "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", - "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.2.0)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.2)\n", + "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", + "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", + "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.14.6)\n", + "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.4)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.20)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", + "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", + "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", + "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" + "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n", + "Installing collected packages: xyzservices, traittypes, pygeos, ipyleaflet\n", + "Successfully installed ipyleaflet-0.15.0 pygeos-0.12.0 traittypes-0.2.1 xyzservices-2021.11.0\n" ] } ], @@ -92,10 +99,19 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -152,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -164,7 +180,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -176,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], @@ -201,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "e3d9fa0d-35b0-4a9c-8e45-c5114e5c09a1", "metadata": {}, "outputs": [], @@ -231,7 +247,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 12, "id": "65c74fbd-059f-4df8-a3a1-e6c1361489b7", "metadata": {}, "outputs": [], @@ -249,12 +265,13 @@ " >> filter(_.calitp_itp_id == int(itp_id)) >> collect())\n", " wednesday = wednesday >> arrange(-_.service_date)\n", " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.weekday() == 2)]\n", - " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.month < 12)]\n", - " wednesday = wednesday[wednesday['service_date'] == wednesday['service_date'].iloc[0]] ## pick most recent Wednesday from Nov or earlier\n", + " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.month == 12)] ## December\n", + " wednesday = wednesday[wednesday['service_date'] == wednesday['service_date'].iloc[0]] ## pick most recent Wednesday from Dec or earlier\n", " \n", " bus_routes = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " >> filter(_.route_type.isin(['3', '11'])) ## bus and trolleybus\n", + " # >> filter(_.route_type.isin(['3', '11'])) ## bus and trolleybus\n", + " >> filter(_.route_type == '3')\n", " >> select(_.route_id) >> collect())\n", " print('loaded bus routes')\n", " \n", @@ -292,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "id": "1049eee5-d4d9-43a1-9a84-c3bd3687f6d3", "metadata": {}, "outputs": [], @@ -313,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "id": "0d3207be-d38f-4f17-a97f-0f84cae25d77", "metadata": {}, "outputs": [], @@ -446,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "id": "9483141f-c197-4fc8-80f0-4efa8d2b44c4", "metadata": {}, "outputs": [], @@ -496,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 25, "id": "e9d94df4-21cd-46d6-a8ab-fe4d4c01d728", "metadata": {}, "outputs": [], @@ -506,24 +523,143 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 13, "id": "b1089592-7a20-4c3b-a27f-5eb6193213de", - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "loaded shapes\n", - "loaded bus routes\n", - "loaded trips\n", - "loaded stop times\n", - "loaded stops\n" + "loaded bus routes\n" + ] + }, + { + "ename": "AssertionError", + "evalue": "Unexpected param: (__[POSTCOMPILE_service_id_1])", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/tmp/ipykernel_44/1117417450.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlbt_views\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_operator_views\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m170\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/tmp/ipykernel_44/4270395868.py\u001b[0m in \u001b[0;36mget_operator_views\u001b[0;34m(itp_id)\u001b[0m\n\u001b[1;32m 29\u001b[0m >> collect())\n\u001b[1;32m 30\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 31\u001b[0;31m trips = (tbl.gtfs_schedule.trips()\n\u001b[0m\u001b[1;32m 32\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitp_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 33\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwednesday\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3505\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[0;32m-> 3507\u001b[0;31m [\n\u001b[0m\u001b[1;32m 3508\u001b[0m f._compiler_dispatch(\n\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[1;32m 3507\u001b[0m [\n\u001b[0;32m-> 3508\u001b[0;31m f._compiler_dispatch(\n\u001b[0m\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3510\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_subquery\u001b[0;34m(self, subquery, **kw)\u001b[0m\n\u001b[1;32m 2875\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_subquery\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2876\u001b[0m \u001b[0mkw\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"subquery\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvisit_alias\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2879\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_lateral\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_alias\u001b[0;34m(self, alias, asfrom, ashint, iscrud, fromhints, subquery, lateral, enclosing_alias, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 2834\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfroms\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0malias\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0malias_name\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2835\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2836\u001b[0;31m inner = alias.element._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2837\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlateral\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2838\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_service_id_1])" ] } ], "source": [ - "bbb_views = get_operator_views(300)" + "lbt_views = get_operator_views(170)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "908af6e2-bef2-4458-8125-67cd28454493", + "metadata": {}, + "outputs": [], + "source": [ + "bus_routes" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "a04ec0e7-df45-4d2f-b477-1f0cb2c6c6ca", + "metadata": {}, + "outputs": [], + "source": [ + "bus_routes = (tbl.gtfs_schedule.routes()\n", + " >> filter(_.calitp_itp_id == 170)\n", + " >> filter(_.route_type == '3', _.route_type == '11') ## bus and trolleybus\n", + " >> select(_.route_id) >> collect())" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "e7912a98-883b-4c6b-aedf-95533d9497c5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
route_id
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: [route_id]\n", + "Index: []" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bus_routes" ] }, { @@ -564,7 +700,7 @@ } ], "source": [ - "bbb_hqta = single_operator_hqta(300)" + "lbt_hqta = single_operator_hqta(300)" ] }, { @@ -628,7 +764,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 3, "id": "7968cab1-fb27-43b7-ad4c-4b84e03cee81", "metadata": {}, "outputs": [], @@ -1452,7 +1588,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 4, "id": "dd0aada1-9341-4837-978b-0e4c01bec26a", "metadata": {}, "outputs": [], @@ -1462,7 +1598,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "id": "007242a3-d4d2-4acd-8bff-169fc513ad2b", "metadata": {}, "outputs": [], @@ -1472,7 +1608,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 6, "id": "e85121b8-8052-4bd2-9270-fc7462700a58", "metadata": {}, "outputs": [], @@ -1482,7 +1618,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "id": "baaa3b22-d2dd-4afb-a081-e666a0037e8e", "metadata": {}, "outputs": [], @@ -1492,7 +1628,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 8, "id": "090dd0b2-4de3-47b0-abed-9d16356bbf2c", "metadata": {}, "outputs": [], @@ -1500,6 +1636,41 @@ "dissolved = dissolved[dissolved['geometry'].area > 50*3000] ##50m width * 3000m shape min" ] }, + { + "cell_type": "code", + "execution_count": 37, + "id": "ca18f616-9719-458d-beb6-e3aa7492fd32", + "metadata": {}, + "outputs": [], + "source": [ + "dissolved = gpd.read_parquet(f'{GCS_FILE_PATH}shape_hqta_dissolve.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "b340161b-cd68-4cef-90ba-7f9f83fe30b0", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "4affcd4b579e4b049b95f07f8e24a36f", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[33.596015707487744, -117.87571863402819], controls=(ZoomControl(options=['position', 'zoom_in_text…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "map_hqta(dissolved)" + ] + }, { "cell_type": "code", "execution_count": 14, diff --git a/high_quality_transit_areas/combine_and_visualize.ipynb b/high_quality_transit_areas/combine_and_visualize.ipynb index a8ac4cfd1..19ba79e8b 100644 --- a/high_quality_transit_areas/combine_and_visualize.ipynb +++ b/high_quality_transit_areas/combine_and_visualize.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 6, + "execution_count": 1, "id": "7f9e615b-d071-4728-b774-1d02f509c332", "metadata": { "collapsed": true, @@ -17,71 +17,72 @@ "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.11.1)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.14.0)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.2.1)\n", + "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", + "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", + "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", - "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (58.3.0)\n", + "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", + "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", + "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", + "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", + "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.2)\n", - "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", + "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.4.1)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.21)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", + "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.2)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.17.3)\n", - "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", - "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", + "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", + "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.2)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.2.0)\n", + "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", + "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.14.6)\n", + "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.4)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", + "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", + "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.20)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", + "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" ] } @@ -100,7 +101,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.0-CAPI-1.16.0). Conversions between both will be slow.\n", + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", " warnings.warn(\n" ] } @@ -124,7 +125,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 3, "id": "e31ad027-1acc-44f8-bdd6-31f1b9b36a77", "metadata": {}, "outputs": [], @@ -136,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 4, "id": "bcbea24e-ab7e-400a-8813-6a477471c1d6", "metadata": {}, "outputs": [], @@ -147,62 +148,53 @@ }, { "cell_type": "code", - "execution_count": 5, - "id": "0e807584-dfb2-4385-b274-7276b0bc38d0", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, - "tags": [] - }, + "execution_count": 7, + "id": "6aec4721-0827-40f3-be60-0790916b0385", + "metadata": {}, "outputs": [ { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] + "data": { + "text/plain": [ + "Index(['stop_id', 'calitp_itp_id', 'stop_lat', 'stop_lon', 'itp_id_stop_id',\n", + " 'itp_id_trip_id', 'route_id', 'itp_id_route_id', 'trip_id', 'geometry',\n", + " 'calitp_url_number', 'route_type', 'agency_id', 'route_short_name',\n", + " 'route_long_name', 'route_desc', 'route_url', 'route_color',\n", + " 'route_text_color', 'route_sort_order', 'continuous_pickup',\n", + " 'continuous_drop_off', 'calitp_extracted_at', 'hqta_type'],\n", + " dtype='object')" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "geoparquet_gcs_export(bus_hqtc, 'bus_hqtc')" + "rail_ferry_brt_stops.columns" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, + "id": "0e807584-dfb2-4385-b274-7276b0bc38d0", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# geoparquet_gcs_export(bus_hqtc, 'bus_hqtc')" + ] + }, + { + "cell_type": "code", + "execution_count": 11, "id": "3b9a9f5e-6371-4367-978c-c0be0e6d979f", "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, "tags": [] }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], + "outputs": [], "source": [ - "geoparquet_gcs_export(rail_ferry_brt_stops, 'rail_ferry_brt_stops')" + "# geoparquet_gcs_export(rail_ferry_brt_stops, 'rail_ferry_brt_stops')" ] }, { @@ -245,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "441de95c-34c4-46bd-a95c-bfa0fd0338ea", "metadata": {}, "outputs": [ @@ -273,61 +265,53 @@ " hq_transit_corr\n", " shape_id\n", " geometry\n", - " level_0\n", " calitp_itp_id\n", " hqta_segment_id\n", - " n_trips\n", " segment_sequence\n", " stop_id\n", - " am_peak\n", - " pm_peak\n", + " am_max_trips\n", + " pm_max_trips\n", " hqta_type\n", " \n", " \n", " \n", " \n", - " 2464\n", + " 2256\n", " True\n", - " 0500\n", - " MULTIPOLYGON (((193308.696 -465893.120, 193308...\n", - " 0\n", - " 142\n", - " 2197551287\n", - " 134.0\n", + " 01582b61-5a02-4e6c-bd37-bad46bb036a9\n", + " POLYGON ((-133311.510 166655.910, -133353.419 ...\n", + " 48\n", + " 1937384376\n", " 0\n", - " 3977\n", - " 9.0\n", + " 12f4ecb6-c161-480e-8ec2-d7e3b63c7e38\n", + " 7.0\n", " 8.0\n", " hq_transit_corr\n", " \n", " \n", - " 2466\n", + " 2257\n", " True\n", - " 10\n", - " MULTIPOLYGON (((170627.569 -429628.875, 170627...\n", + " 0500\n", + " POLYGON ((212373.929 -486798.063, 212402.264 -...\n", + " 142\n", + " 4126984225\n", " 1\n", - " 243\n", - " 2088216280\n", - " 64.0\n", - " 2\n", - " 604\n", - " 4.7\n", + " 4654\n", " 5.0\n", + " 7.0\n", " hq_transit_corr\n", " \n", " \n", - " 2467\n", + " 2258\n", " True\n", - " 100706_SEPT21\n", - " MULTIPOLYGON (((149722.349 -435846.031, 149624...\n", + " 0843\n", + " MULTIPOLYGON (((200815.723 -472198.343, 200811...\n", + " 142\n", + " 1555422069\n", " 0\n", - " 182\n", - " 2368710740\n", - " 120.0\n", - " 1\n", - " 16374\n", + " 6679\n", + " 5.0\n", " 6.0\n", - " 8.0\n", " hq_transit_corr\n", " \n", " \n", @@ -335,28 +319,28 @@ "" ], "text/plain": [ - " hq_transit_corr shape_id \\\n", - "2464 True 0500 \n", - "2466 True 10 \n", - "2467 True 100706_SEPT21 \n", + " hq_transit_corr shape_id \\\n", + "2256 True 01582b61-5a02-4e6c-bd37-bad46bb036a9 \n", + "2257 True 0500 \n", + "2258 True 0843 \n", "\n", - " geometry level_0 \\\n", - "2464 MULTIPOLYGON (((193308.696 -465893.120, 193308... 0 \n", - "2466 MULTIPOLYGON (((170627.569 -429628.875, 170627... 1 \n", - "2467 MULTIPOLYGON (((149722.349 -435846.031, 149624... 0 \n", + " geometry calitp_itp_id \\\n", + "2256 POLYGON ((-133311.510 166655.910, -133353.419 ... 48 \n", + "2257 POLYGON ((212373.929 -486798.063, 212402.264 -... 142 \n", + "2258 MULTIPOLYGON (((200815.723 -472198.343, 200811... 142 \n", "\n", - " calitp_itp_id hqta_segment_id n_trips segment_sequence stop_id \\\n", - "2464 142 2197551287 134.0 0 3977 \n", - "2466 243 2088216280 64.0 2 604 \n", - "2467 182 2368710740 120.0 1 16374 \n", + " hqta_segment_id segment_sequence stop_id \\\n", + "2256 1937384376 0 12f4ecb6-c161-480e-8ec2-d7e3b63c7e38 \n", + "2257 4126984225 1 4654 \n", + "2258 1555422069 0 6679 \n", "\n", - " am_peak pm_peak hqta_type \n", - "2464 9.0 8.0 hq_transit_corr \n", - "2466 4.7 5.0 hq_transit_corr \n", - "2467 6.0 8.0 hq_transit_corr " + " am_max_trips pm_max_trips hqta_type \n", + "2256 7.0 8.0 hq_transit_corr \n", + "2257 5.0 7.0 hq_transit_corr \n", + "2258 5.0 6.0 hq_transit_corr " ] }, - "execution_count": 9, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -367,7 +351,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "f104e680-a949-4e07-a4dd-19950207c66f", "metadata": {}, "outputs": [], @@ -389,7 +373,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "96caf70f-e497-4df4-9b1a-20b54f7b7f83", "metadata": {}, "outputs": [], @@ -399,7 +383,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "cdb9023e-8397-4eed-b829-0ab22ee26580", "metadata": {}, "outputs": [], @@ -409,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "id": "a54925c8-cb64-452f-b8ac-18407ed3f9d6", "metadata": {}, "outputs": [], @@ -419,7 +403,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 10, "id": "c3f748fa-861d-4d7c-b005-480d6ecc30a2", "metadata": {}, "outputs": [], @@ -429,7 +413,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 11, "id": "ca09eb4e-97b4-48b6-ba21-542ac35c8ceb", "metadata": {}, "outputs": [], @@ -448,7 +432,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 12, "id": "82e5d819-63dc-4ba3-a9f9-c314f5a4ca33", "metadata": {}, "outputs": [], @@ -458,7 +442,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 28, "id": "6273ed98-b5a2-4e83-bfac-9f487f8c6142", "metadata": {}, "outputs": [], @@ -479,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 29, "id": "c35ed21e-d6e0-42cf-8bd5-e4792d5d3c14", "metadata": {}, "outputs": [], @@ -489,7 +473,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 30, "id": "2df43e17-9ca0-4c46-b6a1-92d77ec98d3a", "metadata": { "tags": [] @@ -744,7 +728,7 @@ "[349 rows x 12 columns]" ] }, - "execution_count": 41, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -755,7 +739,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 31, "id": "6ab04e63-f673-48d4-bf1a-d01d203f5b33", "metadata": {}, "outputs": [], @@ -765,17 +749,17 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 32, "id": "92d2df98-49d9-4786-bd53-df2ddc107354", "metadata": {}, "outputs": [], "source": [ - "row_per_stop = row_per_stop[['calitp_itp_id', 'geometry']]" + "row_per_stop = row_per_stop[['calitp_itp_id', 'stop_id', 'geometry']]" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 33, "id": "faaa147d-ae1e-4b9b-a7a2-ff462a3c66fd", "metadata": {}, "outputs": [], @@ -785,7 +769,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 34, "id": "3e574e12-8017-4867-9230-8fa891e914bb", "metadata": {}, "outputs": [], @@ -795,7 +779,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 35, "id": "d01200cc-cda2-4635-af68-3b8448e70b5a", "metadata": {}, "outputs": [ @@ -821,6 +805,7 @@ " \n", " \n", " calitp_itp_id\n", + " stop_id\n", " geometry\n", " hqta_type\n", " \n", @@ -829,18 +814,21 @@ " \n", " 0\n", " 142\n", + " 3977\n", " POINT (199058.382 -471125.032)\n", " major_transit_stop\n", " \n", " \n", " 1\n", " 142\n", + " 3977\n", " POINT (198531.592 -471368.189)\n", " major_transit_stop\n", " \n", " \n", " 2\n", " 142\n", + " 3977\n", " POINT (193068.693 -465847.391)\n", " major_transit_stop\n", " \n", @@ -849,13 +837,13 @@ "" ], "text/plain": [ - " calitp_itp_id geometry hqta_type\n", - "0 142 POINT (199058.382 -471125.032) major_transit_stop\n", - "1 142 POINT (198531.592 -471368.189) major_transit_stop\n", - "2 142 POINT (193068.693 -465847.391) major_transit_stop" + " calitp_itp_id stop_id geometry hqta_type\n", + "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop\n", + "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop\n", + "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop" ] }, - "execution_count": 46, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -866,7 +854,31 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 36, + "id": "5bbfaa07-f16c-46a9-ae5e-338a5b7f5d8b", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], + "source": [ + "geoparquet_gcs_export(row_per_stop, 'major_bus_stops')" + ] + }, + { + "cell_type": "code", + "execution_count": 24, "id": "dcccae17-5f35-4fc4-a5dc-0e5cf45e2f25", "metadata": {}, "outputs": [], @@ -876,7 +888,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 25, "id": "19f9b7dd-1b2b-4c7a-9ba9-3e1e1e9b46be", "metadata": { "tags": [] @@ -895,7 +907,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 26, "id": "7d959fef-e315-4985-b3fd-72192096a691", "metadata": {}, "outputs": [], @@ -908,7 +920,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 27, "id": "909f1b0f-0d99-4713-90e5-cf86e7bcab1e", "metadata": {}, "outputs": [], @@ -942,7 +954,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 28, "id": "e13cb57b-0905-4b8c-9f8f-d6d87c09c533", "metadata": {}, "outputs": [], @@ -954,7 +966,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 29, "id": "da513fe3-7893-48a1-b33b-de36e5c97443", "metadata": {}, "outputs": [], @@ -968,7 +980,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 30, "id": "96ea1b81-97d2-4d9f-986b-cb82fcb1d481", "metadata": {}, "outputs": [], @@ -988,7 +1000,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 31, "id": "e25ad411-6ea1-4232-bb47-6df3bb1f4167", "metadata": {}, "outputs": [], @@ -1001,7 +1013,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 32, "id": "fe2aeb20-1714-4543-ba8b-8d655ea1efa4", "metadata": {}, "outputs": [], @@ -1011,19 +1023,41 @@ }, { "cell_type": "code", - "execution_count": 190, + "execution_count": 6, + "id": "92d5b4c7-6723-471f-bafa-dada933393f7", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "all_hqta = gpd.read_parquet(f'{GCS_FILE_PATH}ca_high_quality_transit.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "be750b0a-11e8-4905-bc62-6d2b7462a11a", + "metadata": {}, + "outputs": [], + "source": [ + "metro = bus_hqtc >> filter(_.calitp_itp_id == '182')" + ] + }, + { + "cell_type": "code", + "execution_count": 18, "id": "a3adc41e-90f1-4117-8e49-938c4c838a8d", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "4c92e1550b174cb0abb9a992ac7f0e41", + "model_id": "4399525e0c1b47be87a271b99c3093b7", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "Map(center=[33.741232185414454, -117.84488376191148], controls=(ZoomControl(options=['position', 'zoom_in_text…" + "Map(center=[34.078792878404975, -118.30956119336547], controls=(ZoomControl(options=['position', 'zoom_in_text…" ] }, "metadata": {}, @@ -1031,31 +1065,15 @@ } ], "source": [ - "map_hqta(all_hqta, 'hqta_type')" + "map_hqta(metro, 'pm_max_trips')" ] }, { "cell_type": "code", - "execution_count": 191, + "execution_count": null, "id": "f614dc84-c6c1-482e-a6eb-d621ccb3af67", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/tmp/ipykernel_46/4200137629.py:1: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " all_hqta.to_parquet('./data/combined/ca_high_quality_transit.parquet')\n", - "/tmp/ipykernel_46/4200137629.py:3: UserWarning: Column names longer than 10 characters will be truncated when saved to ESRI Shapefile.\n", - " all_hqta.to_file('./data/combined/ca_high_quality_transit/ca_high_quality_transit.shp')\n" - ] - } - ], + "outputs": [], "source": [ "geoparquet_gcs_export(all_hqta, 'ca_high_quality_transit')\n", "# all_hqta.to_file('./ca_high_quality_transit.geojson', driver='GeoJSON')\n", diff --git a/high_quality_transit_areas/point_exports_opr.ipynb b/high_quality_transit_areas/point_exports_opr.ipynb new file mode 100644 index 000000000..6a08e38d9 --- /dev/null +++ b/high_quality_transit_areas/point_exports_opr.ipynb @@ -0,0 +1,606 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "4a93602d-4289-4d8f-b037-28f244972772", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], + "source": [ + "import calitp\n", + "from calitp.tables import tbl\n", + "from siuba import *\n", + "\n", + "import pandas as pd\n", + "import numpy as np\n", + "import geopandas as gpd\n", + "import fiona\n", + "import shapely\n", + "\n", + "from ipyleaflet import Map, GeoJSON, projections, basemaps, GeoData, LayersControl, WidgetControl, GeoJSON\n", + "from ipywidgets import Text, HTML\n", + "\n", + "from utilities import *" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "e497dcce-0705-4b97-9968-47119cdf386e", + "metadata": {}, + "outputs": [], + "source": [ + "major_bus = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops.parquet')\n", + "major_bus['mode'] = 'bus'" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "12d40de1-7beb-4126-b9ee-14ba288d347f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idgeometryhqta_typemode
01423977POINT (199058.382 -471125.032)major_transit_stopbus
11423977POINT (198531.592 -471368.189)major_transit_stopbus
21423977POINT (193068.693 -465847.391)major_transit_stopbus
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id geometry hqta_type \\\n", + "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop \n", + "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop \n", + "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop \n", + "\n", + " mode \n", + "0 bus \n", + "1 bus \n", + "2 bus " + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "major_bus.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d3bda835-a20f-4ad7-9279-0b9f10f36a93", + "metadata": {}, + "outputs": [], + "source": [ + "## rail/ferry/brt explicitly by mode" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "774a2131-9fdc-4386-a003-6310d9ef8c9b", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_stops = gpd.read_parquet(f'{GCS_FILE_PATH}rail_brt_ferry.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "29a747be-1fe6-4d83-b65d-da06a1378cf0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['stop_id', 'calitp_itp_id', 'stop_lat', 'stop_lon', 'itp_id_stop_id',\n", + " 'itp_id_trip_id', 'route_id', 'itp_id_route_id', 'trip_id', 'geometry',\n", + " 'calitp_url_number', 'route_type', 'agency_id', 'route_short_name',\n", + " 'route_long_name', 'route_desc', 'route_url', 'route_color',\n", + " 'route_text_color', 'route_sort_order', 'continuous_pickup',\n", + " 'continuous_drop_off', 'calitp_extracted_at'],\n", + " dtype='object')" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "956999cb-3445-48d1-9aa3-5c0e3ae32dbc", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_stops['route_type'] = rail_ferry_brt_stops['route_type'].fillna('99')" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "id": "f43e3337-4026-406d-85cc-fcd11d8e1661", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idroute_typen
02414
14367
2109910
31399523
41545
54145
6569918
712744
8182355
91829995
10200419
1120099546
122269931
13232329
142469960
1527399104
1627843
1727899121
182799950
19280424
202819910
2128299265
2229499120
233159912
243239962
2533843
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id route_type n\n", + "0 2 4 14\n", + "1 4 3 67\n", + "2 10 99 10\n", + "3 13 99 523\n", + "4 15 4 5\n", + "5 41 4 5\n", + "6 56 99 18\n", + "7 127 4 4\n", + "8 182 3 55\n", + "9 182 99 95\n", + "10 200 4 19\n", + "11 200 99 546\n", + "12 226 99 31\n", + "13 232 3 29\n", + "14 246 99 60\n", + "15 273 99 104\n", + "16 278 4 3\n", + "17 278 99 121\n", + "18 279 99 50\n", + "19 280 4 24\n", + "20 281 99 10\n", + "21 282 99 265\n", + "22 294 99 120\n", + "23 315 99 12\n", + "24 323 99 62\n", + "25 338 4 3" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops >> count(_.calitp_itp_id, _.route_type)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "71a2646b-0a53-48e4-ac35-586b2dda3dd3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idcalitp_itp_idroute_type
0CRN13None
1MKA13None
2OKJ13None
3PLO13None
4QCY13None
............
742483569414
77GF:430002004
78GF:430032004
79GF:430042004
80GF:430072004
\n", + "

2255 rows × 3 columns

\n", + "
" + ], + "text/plain": [ + " stop_id calitp_itp_id route_type\n", + "0 CRN 13 None\n", + "1 MKA 13 None\n", + "2 OKJ 13 None\n", + "3 PLO 13 None\n", + "4 QCY 13 None\n", + ".. ... ... ...\n", + "74 2483569 41 4\n", + "77 GF:43000 200 4\n", + "78 GF:43003 200 4\n", + "79 GF:43004 200 4\n", + "80 GF:43007 200 4\n", + "\n", + "[2255 rows x 3 columns]" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops[['stop_id', 'calitp_itp_id', 'route_type']]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b2511687-caf3-4984-91a4-6c0cdeceedd0", + "metadata": {}, + "outputs": [], + "source": [ + "## other stops within hq bus corridor (mode=bus)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "34662e06-2545-48bd-a75d-4f63e2639cb7", + "metadata": {}, + "outputs": [], + "source": [ + "bus_hqtc = gpd.read_parquet(f'{GCS_FILE_PATH}shape_hqta_dissolve.parquet')\n", + "bus_hqtc = bus_hqtc[bus_hqtc['hq_transit_corr']]\n", + "bus_hqtc['hqta_type'] = 'hq_transit_corr'" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "1b71b26f-71ef-449a-a520-7b2a1c8929e3", + "metadata": {}, + "outputs": [], + "source": [ + "all_stops = tbl.gtfs_schedule.stops() >> collect()\n", + "all_stops = gpd.GeoDataFrame(all_stops,\n", + " geometry = gpd.points_from_xy(all_stops.stop_lon, all_stops.stop_lat),\n", + " crs = 'EPSG:4326')" + ] + } + ], + "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.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 2ce4cf7e8..67dcf8776 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,10 +2,19 @@ "cells": [ { "cell_type": "code", - "execution_count": 26, + "execution_count": 1, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -54,14 +63,60 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", - "metadata": {}, - "outputs": [], + "metadata": { + "collapsed": true, + "jupyter": { + "outputs_hidden": true + }, + "tags": [] + }, + "outputs": [ + { + "ename": "AssertionError", + "evalue": "Unexpected param: (__[POSTCOMPILE_route_type_1])", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/tmp/ipykernel_281/2695592209.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m rail_routes = (tbl.gtfs_schedule.routes()\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'0'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m >> collect())\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_route_type_1])" + ] + } + ], "source": [ "rail_routes = (tbl.gtfs_schedule.routes()\n", " >> filter(_.route_type.isin(['0', '1', '2']))\n", - " >> select(_.calitp_itp_id, _.route_id)\n", + " >> select(_.calitp_itp_id, _.route_id, _.route_type)\n", " >> collect())" ] }, From ded426dcb5334c03839871f06bed375800bca170 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 8 Dec 2021 19:10:29 +0000 Subject: [PATCH 02/24] fix+refactor rail_ferry_brt --- .../rail_ferry_brt.ipynb | 836 ++++++++---------- 1 file changed, 382 insertions(+), 454 deletions(-) diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 67dcf8776..55fc7534c 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -3,6 +3,93 @@ { "cell_type": "code", "execution_count": 1, + "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", + "metadata": { + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", + "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", + "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", + "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", + "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", + "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", + "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", + "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", + "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", + "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", + "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", + "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", + "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", + "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", + "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", + "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", + "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", + "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", + "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", + "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", + "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", + "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", + "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", + "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", + "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", + "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", + "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", + "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", + "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", + "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", + "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", + "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", + "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", + "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", + "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", + "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", + "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", + "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", + "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", + "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", + "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", + "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", + "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" + ] + } + ], + "source": [ + "!pip install -r requirements.txt" + ] + }, + { + "cell_type": "code", + "execution_count": 2, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, "outputs": [ @@ -58,121 +145,137 @@ "id": "6ddca2c1-c222-4a1c-9eeb-5fcbfd4c903f", "metadata": {}, "source": [ - "### Rail Service" + "### Rail Service\n", + "\n", + "* temporary workaround with dim tables, should use tbl.gtfs schedule but LA Metro rail not in" ] }, { "cell_type": "code", - "execution_count": 2, - "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, - "tags": [] - }, - "outputs": [ - { - "ename": "AssertionError", - "evalue": "Unexpected param: (__[POSTCOMPILE_route_type_1])", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_281/2695592209.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m rail_routes = (tbl.gtfs_schedule.routes()\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'0'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m >> collect())\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_route_type_1])" - ] - } - ], + "execution_count": 3, + "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", + "metadata": {}, + "outputs": [], "source": [ - "rail_routes = (tbl.gtfs_schedule.routes()\n", - " >> filter(_.route_type.isin(['0', '1', '2']))\n", - " >> select(_.calitp_itp_id, _.route_id, _.route_type)\n", - " >> collect())" + "rail_routes = (tbl.views.gtfs_schedule_dim_routes()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " >> filter(_.calitp_itp_id != 200) # avoid MTC feed in favor of individual operator feeds\n", + " >> filter((_.route_type == '0') |\n", + " (_.route_type == '1') |\n", + " (_.route_type == '2'))\n", + " # >> filter(_.calitp_itp_id == 182)\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type)\n", + " )" ] }, { "cell_type": "code", "execution_count": 4, - "id": "dbcf2c67-44e3-446a-94f3-9a1bb9b04fc6", + "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], "source": [ - "def routes_to_stops(df_routes):\n", - " df_routes['itp_id_route_id'] = df_routes.calitp_itp_id.astype(str) + df_routes.route_id\n", - " \n", - " df_trips = (tbl.gtfs_schedule.trips()\n", - " >> filter(_.calitp_itp_id.isin(df_routes.calitp_itp_id))\n", - " >> collect()\n", - " >> select(_.calitp_itp_id, _.route_id, _.trip_id)\n", - " >> filter(_.route_id.isin(df_routes.route_id)))\n", + "def routes_to_stops(routes_tbl):\n", " \n", - " df_trips['itp_id_route_id'] = df_trips.calitp_itp_id.astype(str) + df_trips.route_id\n", - " df_trips.drop(columns=['calitp_itp_id', 'route_id'], inplace=True)\n", - " \n", - " df_trips = df_routes >> inner_join(_, df_trips, on='itp_id_route_id')\n", - " df_trips['itp_id_trip_id'] = df_trips.calitp_itp_id.astype(str) + df_trips.trip_id\n", - " df_operators = [int(str(x)) for x in list(df_trips.calitp_itp_id.unique())]\n", - " \n", - " df_stop_times = (tbl.gtfs_schedule.stop_times()\n", - " >> filter(_.calitp_itp_id.isin(df_operators))\n", - " >> select(_.calitp_itp_id, _.stop_id, _.trip_id)\n", + " tbl_trips = (tbl.views.gtfs_schedule_dim_trips()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.trip_id)\n", + " # >> filter(_.calitp_itp_id == 182) ## LA Metro\n", + " # >> filter(_.route_id == '801') ## Metro A Line (Blue) LRT\n", + " >> inner_join(_, routes_tbl, on=['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type, _.trip_id)\n", + " # >> collect()\n", + " )\n", + "\n", + " tbl_st_times = (tbl.views.gtfs_schedule_dim_stop_times()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " # >> filter(_.calitp_itp_id.isin(df_operators))\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.trip_id)\n", + " >> inner_join(_, tbl_trips, on=['calitp_itp_id', 'calitp_url_number', 'trip_id'])\n", + " >> distinct(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.route_type)\n", + " )\n", + "\n", + " stops = (tbl.views.gtfs_schedule_dim_stops()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " >> select(_.calitp_itp_id, _.calitp_url_number,\n", + " _.stop_id, _.stop_lat, _.stop_lon)\n", + " >> inner_join(_, tbl_st_times,\n", + " on = ['calitp_itp_id', 'calitp_url_number', 'stop_id'])\n", " >> collect()\n", - " )\n", - " df_stop_times['itp_id_trip_id'] = df_stop_times.calitp_itp_id.astype(str) + df_stop_times.trip_id\n", - " df_stop_times.drop(columns=['calitp_itp_id', 'trip_id'], inplace=True)\n", - " df_stop_times = df_stop_times >> inner_join(_, df_trips, on='itp_id_trip_id')\n", - " df_stop_times = df_stop_times.drop_duplicates(subset=['stop_id', 'calitp_itp_id'])\n", - " df_stop_times['itp_id_stop_id'] = df_stop_times.calitp_itp_id.astype(str) + df_stop_times.stop_id\n", - " \n", - " df_stops = (tbl.gtfs_schedule.stops()\n", - " >> select(_.stop_id, _.calitp_itp_id, _.stop_lat, _.stop_lon)\n", - " >> filter(_.calitp_itp_id.isin(df_stop_times.calitp_itp_id))\n", - " >> collect()\n", - " )\n", - " \n", - " df_stops['itp_id_stop_id'] = df_stops.calitp_itp_id.astype(str) + df_stops.stop_id\n", - " df_stop_times.drop(columns=['calitp_itp_id', 'stop_id'], inplace=True)\n", - " df_stops = df_stops >> inner_join(_, df_stop_times, on='itp_id_stop_id')\n", - " df_stops = gpd.GeoDataFrame(df_stops,\n", - " geometry = gpd.points_from_xy(df_stops.stop_lon, df_stops.stop_lat),\n", - " crs = 'EPSG:4326')\n", - " return df_stops.to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)" + " )\n", + " stops = gpd.GeoDataFrame(stops,\n", + " geometry = gpd.points_from_xy(stops.stop_lon, stops.stop_lat),\n", + " crs = 'EPSG:4326').to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)\n", + " return stops" ] }, { "cell_type": "code", "execution_count": 5, - "id": "32b0a3a0-cb47-4b38-a5ef-ec4da9b94d3d", + "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# rail_routes = (tbl.gtfs_schedule.routes()\n", + "# >> filter((_.route_type == '0') |\n", + "# (_.route_type == '1') |\n", + "# (_.route_type == '2'))\n", + "# >> filter(_.calitp_itp_id == 182)\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type)\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", + "metadata": {}, + "outputs": [], + "source": [ + "# tbl_trips = (tbl.gtfs_schedule.trips() \n", + "# >> inner_join(_, rail_routes, on=['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type, _.trip_id)\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", + "metadata": {}, + "outputs": [], + "source": [ + "# tbl_st_times = (tbl.gtfs_schedule.stop_times()\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.trip_id)\n", + "# >> inner_join(_, tbl_trips, on=['calitp_itp_id', 'calitp_url_number', 'trip_id'])\n", + "# >> distinct(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.route_type)\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", + "metadata": {}, + "outputs": [], + "source": [ + "# rail_stops = (tbl.gtfs_schedule.stops()\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.stop_lat, _.stop_lon)\n", + "# >> inner_join(_, tbl_st_times, on = ['calitp_itp_id', 'calitp_url_number', 'stop_id'])\n", + "# >> collect()\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], "source": [ @@ -181,12 +284,27 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 10, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6dd08c23eb034e769c8317c27148dccf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[37.79790800531397, -121.26366399999999], controls=(ZoomControl(options=['position', 'zoom_in_text'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "# map_hqta(rail_stops)" + "map_hqta(rail_stops, 'route_type')" ] }, { @@ -203,20 +321,21 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], "source": [ "metro_brt = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == 182)\n", - " >> filter(_.route_id.isin(['901-13149', '910-13149']))\n", - " >> collect())" + " >> filter((_.route_id == '901-13149') |\n", + " (_.route_id =='910-13149'))\n", + " )" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 12, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -226,7 +345,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 13, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -243,7 +362,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 14, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -253,7 +372,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 15, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -263,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 16, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -271,12 +390,12 @@ "act_brt = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == 4)\n", " >> filter(_.route_id == '1T')\n", - " >> collect())" + " )" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 17, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -286,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 18, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -296,7 +415,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 19, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -304,12 +423,12 @@ "omni_brt = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == 232)\n", " >> filter(_.route_id == '9648')\n", - " >> collect())" + " )" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 20, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -319,7 +438,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 21, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -337,7 +456,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 22, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -345,12 +464,12 @@ "ferry = (tbl.gtfs_schedule.routes()\n", " >> filter(_.route_type == '4')\n", " # >> filter(_.route_id == '9648')\n", - " >> collect())" + " )" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 23, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -362,7 +481,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 24, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -380,7 +499,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 25, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -394,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 26, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, "outputs": [ @@ -419,149 +538,65 @@ " \n", " \n", " \n", - " stop_id\n", " calitp_itp_id\n", + " calitp_url_number\n", + " stop_id\n", " stop_lat\n", " stop_lon\n", - " itp_id_stop_id\n", - " itp_id_trip_id\n", - " route_id\n", - " itp_id_route_id\n", - " trip_id\n", + " route_type\n", " geometry\n", - " ...\n", - " route_short_name\n", - " route_long_name\n", - " route_desc\n", - " route_url\n", - " route_color\n", - " route_text_color\n", - " route_sort_order\n", - " continuous_pickup\n", - " continuous_drop_off\n", - " calitp_extracted_at\n", " \n", " \n", " \n", " \n", " 0\n", - " CRN\n", - " 13\n", - " 41.056920\n", - " -94.361617\n", - " 13CRN\n", - " 1352818299\n", - " 96\n", - " 1396\n", - " 52818299\n", - " POINT (2130400.260 627641.309)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400002\n", + " 37.797908\n", + " -121.263664\n", + " 2\n", + " POINT (-111116.950 -23544.700)\n", " \n", " \n", " 1\n", - " MKA\n", - " 13\n", - " 42.940583\n", - " -87.924359\n", - " 13MKA\n", - " 133412815756\n", - " 54\n", - " 1354\n", - " 3412815756\n", - " POINT (2577583.013 986856.496)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400001\n", + " 37.957058\n", + " -121.278948\n", + " 2\n", + " POINT (-112222.169 -5836.078)\n", " \n", " \n", " 2\n", - " OKJ\n", - " 13\n", - " 37.793866\n", - " -122.271667\n", - " 13OKJ\n", - " 135452816206\n", - " 84\n", - " 1384\n", - " 5452816206\n", - " POINT (-199750.592 -22341.380)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400003\n", + " 37.696468\n", + " -121.433869\n", + " 2\n", + " POINT (-126252.943 -34607.238)\n", " \n", " \n", " 3\n", - " PLO\n", - " 13\n", - " 41.662384\n", - " -88.538272\n", - " 13PLO\n", - " 133832815187\n", - " 93\n", - " 1393\n", - " 3832815187\n", - " POINT (2576234.283 836414.716)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400004.3\n", + " 37.657549\n", + " -121.882962\n", + " 2\n", + " POINT (-165877.168 -38241.179)\n", " \n", " \n", " 4\n", - " QCY\n", - " 13\n", - " 39.957063\n", - " -91.368525\n", - " 13QCY\n", - " 133832815187\n", - " 93\n", - " 1393\n", - " 3832815187\n", - " POINT (2408238.879 582112.897)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400004.1\n", + " 37.697081\n", + " -121.717648\n", + " 2\n", + " POINT (-151236.096 -34123.815)\n", " \n", " \n", " ...\n", @@ -572,242 +607,93 @@ " ...\n", " ...\n", " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", " \n", " \n", - " 74\n", - " 2483569\n", + " 28\n", " 41\n", - " 37.856636\n", - " -122.478275\n", - " 412483569\n", - " 41t_373938_b_28421_tn_0\n", - " 11643\n", - " 4111643\n", - " t_373938_b_28421_tn_0\n", - " POINT (-217731.552 -14910.728)\n", - " ...\n", - " None\n", - " Pier 41 - Sausalito - Tiburon - Angel Island\n", - " None\n", - " None\n", - " f5cb04\n", - " 000000\n", - " 3\n", - " 1\n", - " 1\n", - " 2021-05-03\n", + " 0\n", + " 2483549\n", + " 37.872939\n", + " -122.455446\n", + " 4\n", + " POINT (-215679.403 -13151.168)\n", " \n", " \n", - " 77\n", - " GF:43000\n", - " 200\n", - " 37.795869\n", - " -122.392450\n", - " 200GF:43000\n", - " 200GF:7296302\n", - " GF:SF\n", - " 200GF:SF\n", - " GF:7296302\n", - " POINT (-210363.380 -21857.544)\n", - " ...\n", - " SF\n", - " Sausalito - San Francisco Ferry\n", - " None\n", - " http://goldengateferry.org/schedules/Sausalito...\n", - " 0000FF\n", - " FFFFFF\n", + " 29\n", + " 41\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 2483569\n", + " 37.856636\n", + " -122.478275\n", + " 4\n", + " POINT (-217731.552 -14910.728)\n", " \n", " \n", - " 78\n", - " GF:43003\n", - " 200\n", - " 37.856401\n", - " -122.478251\n", - " 200GF:43003\n", - " 200GF:7296302\n", - " GF:SF\n", - " 200GF:SF\n", - " GF:7296302\n", - " POINT (-217730.126 -14936.899)\n", - " ...\n", - " SF\n", - " Sausalito - San Francisco Ferry\n", - " None\n", - " http://goldengateferry.org/schedules/Sausalito...\n", - " 0000FF\n", - " FFFFFF\n", + " 31\n", + " 338\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 818729\n", + " 37.770840\n", + " -122.385791\n", + " 4\n", + " POINT (-209847.993 -24653.833)\n", " \n", " \n", - " 79\n", - " GF:43004\n", - " 200\n", - " 37.945316\n", - " -122.508735\n", - " 200GF:43004\n", - " 200GF:7296280\n", - " GF:LF\n", - " 200GF:LF\n", - " GF:7296280\n", - " POINT (-220146.197 -4985.515)\n", - " ...\n", - " LF\n", - " Larkspur - San Francisco Ferry\n", - " None\n", - " http://goldengateferry.org/schedules/Larkspur.php\n", - " 0000FF\n", - " FFFFFF\n", + " 32\n", + " 338\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 818733\n", + " 37.864540\n", + " -122.313932\n", + " 4\n", + " POINT (-203274.531 -14397.269)\n", " \n", " \n", - " 80\n", - " GF:43007\n", - " 200\n", - " 37.872770\n", - " -122.455928\n", - " 200GF:43007\n", - " 200GF:7309934\n", - " GF:TF\n", - " 200GF:TF\n", - " GF:7309934\n", - " POINT (-215722.217 -13168.852)\n", - " ...\n", - " TF\n", - " Tiburon - San Francisco Ferry\n", - " None\n", - " None\n", - " 0000FF\n", - " FFFFFF\n", + " 33\n", + " 338\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 818727\n", + " 37.797482\n", + " -122.395025\n", + " 4\n", + " POINT (-210585.228 -21672.628)\n", " \n", " \n", "\n", - "

2255 rows × 23 columns

\n", + "

1324 rows × 7 columns

\n", "" ], "text/plain": [ - " stop_id calitp_itp_id stop_lat stop_lon itp_id_stop_id \\\n", - "0 CRN 13 41.056920 -94.361617 13CRN \n", - "1 MKA 13 42.940583 -87.924359 13MKA \n", - "2 OKJ 13 37.793866 -122.271667 13OKJ \n", - "3 PLO 13 41.662384 -88.538272 13PLO \n", - "4 QCY 13 39.957063 -91.368525 13QCY \n", - ".. ... ... ... ... ... \n", - "74 2483569 41 37.856636 -122.478275 412483569 \n", - "77 GF:43000 200 37.795869 -122.392450 200GF:43000 \n", - "78 GF:43003 200 37.856401 -122.478251 200GF:43003 \n", - "79 GF:43004 200 37.945316 -122.508735 200GF:43004 \n", - "80 GF:43007 200 37.872770 -122.455928 200GF:43007 \n", - "\n", - " itp_id_trip_id route_id itp_id_route_id trip_id \\\n", - "0 1352818299 96 1396 52818299 \n", - "1 133412815756 54 1354 3412815756 \n", - "2 135452816206 84 1384 5452816206 \n", - "3 133832815187 93 1393 3832815187 \n", - "4 133832815187 93 1393 3832815187 \n", - ".. ... ... ... ... \n", - "74 41t_373938_b_28421_tn_0 11643 4111643 t_373938_b_28421_tn_0 \n", - "77 200GF:7296302 GF:SF 200GF:SF GF:7296302 \n", - "78 200GF:7296302 GF:SF 200GF:SF GF:7296302 \n", - "79 200GF:7296280 GF:LF 200GF:LF GF:7296280 \n", - "80 200GF:7309934 GF:TF 200GF:TF GF:7309934 \n", + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "0 10 0 3400002 37.797908 -121.263664 \n", + "1 10 0 3400001 37.957058 -121.278948 \n", + "2 10 0 3400003 37.696468 -121.433869 \n", + "3 10 0 3400004.3 37.657549 -121.882962 \n", + "4 10 0 3400004.1 37.697081 -121.717648 \n", + ".. ... ... ... ... ... \n", + "28 41 0 2483549 37.872939 -122.455446 \n", + "29 41 0 2483569 37.856636 -122.478275 \n", + "31 338 0 818729 37.770840 -122.385791 \n", + "32 338 0 818733 37.864540 -122.313932 \n", + "33 338 0 818727 37.797482 -122.395025 \n", "\n", - " geometry ... route_short_name \\\n", - "0 POINT (2130400.260 627641.309) ... NaN \n", - "1 POINT (2577583.013 986856.496) ... NaN \n", - "2 POINT (-199750.592 -22341.380) ... NaN \n", - "3 POINT (2576234.283 836414.716) ... NaN \n", - "4 POINT (2408238.879 582112.897) ... NaN \n", - ".. ... ... ... \n", - "74 POINT (-217731.552 -14910.728) ... None \n", - "77 POINT (-210363.380 -21857.544) ... SF \n", - "78 POINT (-217730.126 -14936.899) ... SF \n", - "79 POINT (-220146.197 -4985.515) ... LF \n", - "80 POINT (-215722.217 -13168.852) ... TF \n", + " route_type geometry \n", + "0 2 POINT (-111116.950 -23544.700) \n", + "1 2 POINT (-112222.169 -5836.078) \n", + "2 2 POINT (-126252.943 -34607.238) \n", + "3 2 POINT (-165877.168 -38241.179) \n", + "4 2 POINT (-151236.096 -34123.815) \n", + ".. ... ... \n", + "28 4 POINT (-215679.403 -13151.168) \n", + "29 4 POINT (-217731.552 -14910.728) \n", + "31 4 POINT (-209847.993 -24653.833) \n", + "32 4 POINT (-203274.531 -14397.269) \n", + "33 4 POINT (-210585.228 -21672.628) \n", "\n", - " route_long_name route_desc \\\n", - "0 NaN NaN \n", - "1 NaN NaN \n", - "2 NaN NaN \n", - "3 NaN NaN \n", - "4 NaN NaN \n", - ".. ... ... \n", - "74 Pier 41 - Sausalito - Tiburon - Angel Island None \n", - "77 Sausalito - San Francisco Ferry None \n", - "78 Sausalito - San Francisco Ferry None \n", - "79 Larkspur - San Francisco Ferry None \n", - "80 Tiburon - San Francisco Ferry None \n", - "\n", - " route_url route_color \\\n", - "0 NaN NaN \n", - "1 NaN NaN \n", - "2 NaN NaN \n", - "3 NaN NaN \n", - "4 NaN NaN \n", - ".. ... ... \n", - "74 None f5cb04 \n", - "77 http://goldengateferry.org/schedules/Sausalito... 0000FF \n", - "78 http://goldengateferry.org/schedules/Sausalito... 0000FF \n", - "79 http://goldengateferry.org/schedules/Larkspur.php 0000FF \n", - "80 None 0000FF \n", - "\n", - " route_text_color route_sort_order continuous_pickup continuous_drop_off \\\n", - "0 NaN NaN NaN NaN \n", - "1 NaN NaN NaN NaN \n", - "2 NaN NaN NaN NaN \n", - "3 NaN NaN NaN NaN \n", - "4 NaN NaN NaN NaN \n", - ".. ... ... ... ... \n", - "74 000000 3 1 1 \n", - "77 FFFFFF 0 None None \n", - "78 FFFFFF 0 None None \n", - "79 FFFFFF 0 None None \n", - "80 FFFFFF 0 None None \n", - "\n", - " calitp_extracted_at \n", - "0 NaN \n", - "1 NaN \n", - "2 NaN \n", - "3 NaN \n", - "4 NaN \n", - ".. ... \n", - "74 2021-05-03 \n", - "77 2021-11-07 \n", - "78 2021-11-07 \n", - "79 2021-11-07 \n", - "80 2021-11-07 \n", - "\n", - "[2255 rows x 23 columns]" + "[1324 rows x 7 columns]" ] }, - "execution_count": 22, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -818,7 +704,49 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, + "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", + "metadata": {}, + "outputs": [], + "source": [ + "## clip to CA since we now have Amtrak national..." + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "b4d279ae-5283-47e6-b503-f01738f7672a", + "metadata": {}, + "outputs": [], + "source": [ + "import intake\n", + "catalog = intake.open_catalog('./catalog.yml')" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "c76728cc-b293-4f57-8002-3efa845a1dad", + "metadata": {}, + "outputs": [], + "source": [ + "ca_shape = catalog.stanford_shorelines.read().to_crs('EPSG:6414') >> filter(_.STFIPS == '06')\n", + "# ca_shape['geometry'].iloc[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "8b7beb5f-2128-4482-9648-abdfcc8e0001", + "metadata": {}, + "outputs": [], + "source": [ + "rail_brt_ferry = rail_brt_ferry.clip(ca_shape)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, "id": "fa029d00-acac-4242-9048-d8024e70f914", "metadata": {}, "outputs": [], @@ -828,7 +756,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 32, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, "outputs": [ From a326ab0ac9e0af3fb29e01a93aa9062d3343dd27 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 8 Dec 2021 21:04:17 +0000 Subject: [PATCH 03/24] illustrate nb save issue --- .../bus_corridors.ipynb | 8 +- high_quality_transit_areas/catalog.yml | 10 + .../rail_ferry_brt.ipynb | 400 +++--------------- 3 files changed, 74 insertions(+), 344 deletions(-) create mode 100644 high_quality_transit_areas/catalog.yml diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 87bf082cb..5c7f4f82b 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -99,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, "outputs": [ @@ -168,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -180,7 +180,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -192,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], diff --git a/high_quality_transit_areas/catalog.yml b/high_quality_transit_areas/catalog.yml new file mode 100644 index 000000000..58e7a59a4 --- /dev/null +++ b/high_quality_transit_areas/catalog.yml @@ -0,0 +1,10 @@ +metadata: + version: 1 +sources: + stanford_shorelines: + driver: shapefile + description: Stanford shoreline data + url: https://earthworks.stanford.edu/catalog/stanford-vt021tk4894 + args: + urlpath: gs://calitp-analytics-data/data-analyses/msd_dashboard_metric/stanford_shorelines.zip + use_fsspec: true \ No newline at end of file diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 55fc7534c..512cd65f8 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,106 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", - "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", - "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", - "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", - "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", - "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", - "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", - "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", - "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", - "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", - "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", - "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", - "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", - "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", - "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", - "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", - "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", - "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", - "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", - "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", - "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", - "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", - "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" - ] - } - ], - "source": [ - "!pip install -r requirements.txt" - ] - }, - { - "cell_type": "code", - "execution_count": 2, + "outputs": [], + "source": [ + "# !pip install -r requirements.txt" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -152,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", "metadata": {}, "outputs": [], @@ -171,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], @@ -215,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", "metadata": { "tags": [] @@ -233,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", "metadata": {}, "outputs": [], @@ -246,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", "metadata": {}, "outputs": [], @@ -260,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", "metadata": {}, "outputs": [], @@ -274,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], @@ -284,27 +200,12 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "6dd08c23eb034e769c8317c27148dccf", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[37.79790800531397, -121.26366399999999], controls=(ZoomControl(options=['position', 'zoom_in_text'…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "map_hqta(rail_stops, 'route_type')" + "# map_hqta(rail_stops, 'route_type')" ] }, { @@ -321,7 +222,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], @@ -335,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -345,7 +246,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -362,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -372,7 +273,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -382,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -395,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -405,7 +306,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -415,7 +316,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -428,7 +329,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -438,7 +339,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -456,7 +357,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -469,7 +370,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -481,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -499,7 +400,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -513,198 +414,17 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometry
0100340000237.797908-121.2636642POINT (-111116.950 -23544.700)
1100340000137.957058-121.2789482POINT (-112222.169 -5836.078)
2100340000337.696468-121.4338692POINT (-126252.943 -34607.238)
31003400004.337.657549-121.8829622POINT (-165877.168 -38241.179)
41003400004.137.697081-121.7176482POINT (-151236.096 -34123.815)
........................
28410248354937.872939-122.4554464POINT (-215679.403 -13151.168)
29410248356937.856636-122.4782754POINT (-217731.552 -14910.728)
31338081872937.770840-122.3857914POINT (-209847.993 -24653.833)
32338081873337.864540-122.3139324POINT (-203274.531 -14397.269)
33338081872737.797482-122.3950254POINT (-210585.228 -21672.628)
\n", - "

1324 rows × 7 columns

\n", - "
" - ], - "text/plain": [ - " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", - "0 10 0 3400002 37.797908 -121.263664 \n", - "1 10 0 3400001 37.957058 -121.278948 \n", - "2 10 0 3400003 37.696468 -121.433869 \n", - "3 10 0 3400004.3 37.657549 -121.882962 \n", - "4 10 0 3400004.1 37.697081 -121.717648 \n", - ".. ... ... ... ... ... \n", - "28 41 0 2483549 37.872939 -122.455446 \n", - "29 41 0 2483569 37.856636 -122.478275 \n", - "31 338 0 818729 37.770840 -122.385791 \n", - "32 338 0 818733 37.864540 -122.313932 \n", - "33 338 0 818727 37.797482 -122.395025 \n", - "\n", - " route_type geometry \n", - "0 2 POINT (-111116.950 -23544.700) \n", - "1 2 POINT (-112222.169 -5836.078) \n", - "2 2 POINT (-126252.943 -34607.238) \n", - "3 2 POINT (-165877.168 -38241.179) \n", - "4 2 POINT (-151236.096 -34123.815) \n", - ".. ... ... \n", - "28 4 POINT (-215679.403 -13151.168) \n", - "29 4 POINT (-217731.552 -14910.728) \n", - "31 4 POINT (-209847.993 -24653.833) \n", - "32 4 POINT (-203274.531 -14397.269) \n", - "33 4 POINT (-210585.228 -21672.628) \n", - "\n", - "[1324 rows x 7 columns]" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "rail_brt_ferry" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", "metadata": {}, "outputs": [], @@ -714,7 +434,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "b4d279ae-5283-47e6-b503-f01738f7672a", "metadata": {}, "outputs": [], @@ -725,18 +445,32 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "c76728cc-b293-4f57-8002-3efa845a1dad", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "ca_shape = catalog.stanford_shorelines.read().to_crs('EPSG:6414') >> filter(_.STFIPS == '06')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0174ddab-347c-47d2-b824-98e360719b94", "metadata": {}, "outputs": [], "source": [ - "ca_shape = catalog.stanford_shorelines.read().to_crs('EPSG:6414') >> filter(_.STFIPS == '06')\n", - "# ca_shape['geometry'].iloc[0]" + "## after this cell displays output the notebook refuses to save...\n", + "## File Save Error for rail_ferry_brt.ipynb\n", + "## Invalid response: 413 Request Entity Too Large\n", + "ca_shape['geometry'].iloc[0]" ] }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "8b7beb5f-2128-4482-9648-abdfcc8e0001", "metadata": {}, "outputs": [], @@ -746,7 +480,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "fa029d00-acac-4242-9048-d8024e70f914", "metadata": {}, "outputs": [], @@ -756,24 +490,10 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], + "outputs": [], "source": [ "geoparquet_gcs_export(rail_brt_ferry, 'rail_brt_ferry')" ] From 2a1dadf396989cc63beb1d555dfe5b3949740e1b Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Thu, 9 Dec 2021 00:09:13 +0000 Subject: [PATCH 04/24] view lbt PCH corridor pending debug --- .../bus_corridors.ipynb | 1175 ++++++++++++++--- .../rail_ferry_brt.ipynb | 278 +++- 2 files changed, 1260 insertions(+), 193 deletions(-) diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 5c7f4f82b..21a0736e3 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 18, "id": "d7bcdd2a-75f6-429b-8c2e-10263abf7ace", "metadata": { "collapsed": true, @@ -17,79 +17,73 @@ "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Collecting pygeos\n", - " Using cached pygeos-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB)\n", - "Collecting ipyleaflet\n", - " Using cached ipyleaflet-0.15.0-py2.py3-none-any.whl (3.3 MB)\n", + "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", + "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Collecting xyzservices>=2021.8.1\n", - " Using cached xyzservices-2021.11.0-py3-none-any.whl (34 kB)\n", - "Collecting traittypes<3,>=0.2.1\n", - " Using cached traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB)\n", + "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", + "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", - "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", + "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", + "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", + "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", + "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", + "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", + "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", - "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", + "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", - "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", + "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", + "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", + "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n", - "Installing collected packages: xyzservices, traittypes, pygeos, ipyleaflet\n", - "Successfully installed ipyleaflet-0.15.0 pygeos-0.12.0 traittypes-0.2.1 xyzservices-2021.11.0\n" + "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" ] } ], @@ -99,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, "outputs": [ @@ -168,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -180,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -192,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], @@ -247,7 +241,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "id": "65c74fbd-059f-4df8-a3a1-e6c1361489b7", "metadata": {}, "outputs": [], @@ -267,32 +261,38 @@ " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.weekday() == 2)]\n", " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.month == 12)] ## December\n", " wednesday = wednesday[wednesday['service_date'] == wednesday['service_date'].iloc[0]] ## pick most recent Wednesday from Dec or earlier\n", + " wednesday = wednesday >> select(_.calitp_itp_id, _.calitp_url_number, _.service_id)\n", " \n", " bus_routes = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " # >> filter(_.route_type.isin(['3', '11'])) ## bus and trolleybus\n", - " >> filter(_.route_type == '3')\n", - " >> select(_.route_id) >> collect())\n", + " >> filter((_.route_type == '3') | (_.route_type == '11'))\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id) \n", + " # >> collect()\n", + " )\n", " print('loaded bus routes')\n", " \n", " if itp_id == 273:\n", " trips = (tbl.gtfs_schedule.trips()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " >> filter(_.service_id.isin(['1'])) ## temporary hardcode for SacRT\n", - " >> filter(_.route_id.isin(bus_routes.route_id))\n", + " >> filter(_.service_id == '1') ## temporary hardcode for SacRT\n", + " >> inner_join(_, bus_routes, on = ['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", " >> collect())\n", " else:\n", " trips = (tbl.gtfs_schedule.trips()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " >> filter(_.service_id.isin(wednesday.service_id))\n", - " >> filter(_.route_id.isin(bus_routes.route_id))\n", - " >> collect())\n", + " >> inner_join(_, bus_routes, on = ['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", + " >> collect()\n", + " >> inner_join(_, wednesday, on = ['calitp_itp_id', 'calitp_url_number', 'service_id'])\n", + " )\n", " print('loaded trips')\n", " stop_times = (tbl.gtfs_schedule.stop_times()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", " >> collect())\n", - " stop_times = (stop_times >> filter(_.trip_id.isin(trips.trip_id))\n", - " >> select(-_.calitp_itp_id, -_.calitp_extracted_at))\n", + " stop_times = (stop_times >> inner_join(_, trips, on = ['calitp_itp_id', 'calitp_url_number', 'trip_id'])\n", + " >> select(-_.stop_headsign, -_.pickup_type, -_.drop_off_type,\n", + " -_.continuous_pickup, -_.continuous_drop_off, -_.shape_dist_travelled,\n", + " -_.timepoint)\n", + " )\n", " print('loaded stop times')\n", "\n", " stops = (tbl.gtfs_schedule.stops() \n", @@ -309,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 13, "id": "1049eee5-d4d9-43a1-9a84-c3bd3687f6d3", "metadata": {}, "outputs": [], @@ -330,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 14, "id": "0d3207be-d38f-4f17-a97f-0f84cae25d77", "metadata": {}, "outputs": [], @@ -463,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 31, "id": "9483141f-c197-4fc8-80f0-4efa8d2b44c4", "metadata": {}, "outputs": [], @@ -507,24 +507,24 @@ " hqta = hqta.set_crs('EPSG:6414')\n", " except:\n", " continue\n", - " \n", - " return hqta.drop(columns=['n', 'departure_hour']).reset_index(drop=True)" + " return hqta\n", + " # return hqta.drop(columns=['n', 'departure_hour']).reset_index(drop=True)" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 27, "id": "e9d94df4-21cd-46d6-a8ab-fe4d4c01d728", "metadata": {}, "outputs": [], "source": [ - "debug_ids = ['25349']" + "debug_ids = ['940143']" ] }, { "cell_type": "code", - "execution_count": 13, - "id": "b1089592-7a20-4c3b-a27f-5eb6193213de", + "execution_count": 21, + "id": "54227d0f-b539-4852-96e2-50472f40fb08", "metadata": { "tags": [] }, @@ -534,54 +534,10 @@ "output_type": "stream", "text": [ "loaded shapes\n", - "loaded bus routes\n" - ] - }, - { - "ename": "AssertionError", - "evalue": "Unexpected param: (__[POSTCOMPILE_service_id_1])", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_44/1117417450.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlbt_views\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_operator_views\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m170\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/tmp/ipykernel_44/4270395868.py\u001b[0m in \u001b[0;36mget_operator_views\u001b[0;34m(itp_id)\u001b[0m\n\u001b[1;32m 29\u001b[0m >> collect())\n\u001b[1;32m 30\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 31\u001b[0;31m trips = (tbl.gtfs_schedule.trips()\n\u001b[0m\u001b[1;32m 32\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitp_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 33\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwednesday\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3505\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[0;32m-> 3507\u001b[0;31m [\n\u001b[0m\u001b[1;32m 3508\u001b[0m f._compiler_dispatch(\n\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[1;32m 3507\u001b[0m [\n\u001b[0;32m-> 3508\u001b[0;31m f._compiler_dispatch(\n\u001b[0m\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3510\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_subquery\u001b[0;34m(self, subquery, **kw)\u001b[0m\n\u001b[1;32m 2875\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_subquery\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2876\u001b[0m \u001b[0mkw\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"subquery\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvisit_alias\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2879\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_lateral\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_alias\u001b[0;34m(self, alias, asfrom, ashint, iscrud, fromhints, subquery, lateral, enclosing_alias, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 2834\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfroms\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0malias\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0malias_name\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2835\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2836\u001b[0;31m inner = alias.element._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2837\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlateral\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2838\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_service_id_1])" + "loaded bus routes\n", + "loaded trips\n", + "loaded stop times\n", + "loaded stops\n" ] } ], @@ -591,31 +547,412 @@ }, { "cell_type": "code", - "execution_count": null, - "id": "908af6e2-bef2-4458-8125-67cd28454493", - "metadata": {}, - "outputs": [], + "execution_count": 32, + "id": "f6c92a46-4a65-4a0f-9bbc-a9d9050417d0", + "metadata": { + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "there are 100 shapes total\n", + "calculating for shape_id 510066\n", + "progress: 0/100 shapes (0.0%)\n", + "calculating for shape_id 610106\n", + "calculating for shape_id 610105\n", + "calculating for shape_id 510067\n", + "calculating for shape_id 1210143\n", + "calculating for shape_id 460064\n", + "calculating for shape_id 1210138\n", + "calculating for shape_id 460067\n", + "no line for shape 460067\n", + "calculating for shape_id 1920161\n", + "calculating for shape_id 1920167\n", + "calculating for shape_id 1730123\n", + "calculating for shape_id 1910292\n", + "calculating for shape_id 1910295\n", + "calculating for shape_id 1730122\n", + "calculating for shape_id 220068\n", + "calculating for shape_id 220074\n", + "calculating for shape_id 1710168\n", + "calculating for shape_id 1710162\n", + "calculating for shape_id 1720090\n", + "calculating for shape_id 1720091\n", + "no line for shape 1720091\n", + "calculating for shape_id 10070\n", + "calculating for shape_id 20008\n", + "calculating for shape_id 40001\n", + "calculating for shape_id 40002\n", + "no line for shape 40002\n", + "calculating for shape_id 410006\n", + "calculating for shape_id 80002\n", + "progress: 25/100 shapes (25.0%)\n", + "calculating for shape_id 10069\n", + "no line for shape 10069\n", + "calculating for shape_id 80003\n", + "no line for shape 80003\n", + "calculating for shape_id 1510067\n", + "calculating for shape_id 20010\n", + "calculating for shape_id 450111\n", + "no line for shape 450111\n", + "calculating for shape_id 710048\n", + "calculating for shape_id 1750012\n", + "no line for shape 1750012\n", + "calculating for shape_id 1510064\n", + "calculating for shape_id 450110\n", + "calculating for shape_id 410007\n", + "no line for shape 410007\n", + "calculating for shape_id 710046\n", + "calculating for shape_id 1040017\n", + "calculating for shape_id 1310131\n", + "calculating for shape_id 1310132\n", + "no stops for shape 1310132\n", + "calculating for shape_id 1040018\n", + "calculating for shape_id 1750010\n", + "no stops for shape 1750010\n", + "calculating for shape_id 910129\n", + "calculating for shape_id 1010081\n", + "calculating for shape_id 1030063\n", + "calculating for shape_id 910132\n", + "calculating for shape_id 1010082\n", + "no line for shape 1010082\n", + "calculating for shape_id 1810080\n", + "calculating for shape_id 1030064\n", + "calculating for shape_id 230018\n", + "calculating for shape_id 230015\n", + "progress: 50/100 shapes (50.0%)\n", + "calculating for shape_id 1120045\n", + "calculating for shape_id 1110083\n", + "calculating for shape_id 210080\n", + "calculating for shape_id 210079\n", + "no line for shape 210079\n", + "calculating for shape_id 1820070\n", + "calculating for shape_id 1810081\n", + "calculating for shape_id 1110082\n", + "no stops for shape 1110082\n", + "calculating for shape_id 920113\n", + "calculating for shape_id 1120046\n", + "no line for shape 1120046\n", + "calculating for shape_id 1820071\n", + "no stops for shape 1820071\n", + "calculating for shape_id 930151\n", + "calculating for shape_id 920111\n", + "no stops for shape 920111\n", + "calculating for shape_id 930148\n", + "no stops for shape 930148\n", + "calculating for shape_id 930150\n", + "no line for shape 930150\n", + "calculating for shape_id 930147\n", + "no stops for shape 930147\n", + "calculating for shape_id 920115\n", + "no stops for shape 920115\n", + "calculating for shape_id 920112\n", + "no line for shape 920112\n", + "calculating for shape_id 460065\n", + "no line for shape 460065\n", + "calculating for shape_id 910131\n", + "no line for shape 910131\n", + "calculating for shape_id 910130\n", + "no stops for shape 910130\n", + "calculating for shape_id 460063\n", + "no stops for shape 460063\n", + "calculating for shape_id 460069\n", + "no line for shape 460069\n", + "calculating for shape_id 1720093\n", + "no line for shape 1720093\n", + "calculating for shape_id 1740030\n", + "no stops for shape 1740030\n", + "calculating for shape_id 1720092\n", + "progress: 75/100 shapes (75.0%)\n", + "no stops for shape 1720092\n", + "calculating for shape_id 1510066\n", + "no stops for shape 1510066\n", + "calculating for shape_id 410005\n", + "no line for shape 410005\n", + "calculating for shape_id 4050003\n", + "calculating for shape_id 910140\n", + "no line for shape 910140\n", + "calculating for shape_id 4050001\n", + "calculating for shape_id 1210141\n", + "no line for shape 1210141\n", + "calculating for shape_id 940134\n", + "no line for shape 940134\n", + "calculating for shape_id 940133\n", + "no line for shape 940133\n", + "calculating for shape_id 210078\n", + "no line for shape 210078\n", + "calculating for shape_id 460075\n", + "no line for shape 460075\n", + "calculating for shape_id 460071\n", + "no line for shape 460071\n", + "calculating for shape_id 450109\n", + "no line for shape 450109\n", + "calculating for shape_id 220073\n", + "no line for shape 220073\n", + "calculating for shape_id 210083\n", + "no line for shape 210083\n", + "calculating for shape_id 1920165\n", + "no line for shape 1920165\n", + "calculating for shape_id 1910305\n", + "no stops for shape 1910305\n", + "calculating for shape_id 1910304\n", + "no line for shape 1910304\n", + "calculating for shape_id 1910302\n", + "no stops for shape 1910302\n", + "calculating for shape_id 1910297\n", + "no stops for shape 1910297\n", + "calculating for shape_id 1910287\n", + "no line for shape 1910287\n", + "calculating for shape_id 1720096\n", + "no line for shape 1720096\n", + "calculating for shape_id 1720095\n", + "no stops for shape 1720095\n", + "calculating for shape_id 1210144\n", + "no line for shape 1210144\n", + "calculating for shape_id 940143\n", + "***debug shape*** 940143\n", + "no line for shape 940143\n" + ] + } + ], "source": [ - "bus_routes" + "lbt_hqta = single_operator_hqta(lbt_views)" ] }, { "cell_type": "code", - "execution_count": 43, - "id": "a04ec0e7-df45-4d2f-b477-1f0cb2c6c6ca", + "execution_count": 33, + "id": "2ab838e9-ba14-4057-a0ab-9e6401e83f16", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idgeometryhqta_segment_idsegment_sequenceshape_idstop_idam_max_tripspm_max_tripshq_transit_corr
0170POLYGON ((167654.764 -470242.512, 167655.638 -...1081235767051006640101616True
1170POLYGON ((167694.221 -469153.485, 167693.191 -...9304416331510066000477True
2170POLYGON ((167669.771 -467897.042, 167669.770 -...29273764112510066169877True
3170POLYGON ((167646.521 -466641.120, 167646.502 -...36487189893510066055044False
4170POLYGON ((167605.970 -464592.739, 167604.537 -...11932541904510066055544False
..............................
8170POLYGON ((167565.314 -466042.457, 167566.287 -...2433783489424050003525111False
9170POLYGON ((167563.316 -466013.754, 167563.368 -...3860309591434050003525111False
10170POLYGON ((167564.027 -466023.335, 167507.511 -...259261282454050003061054False
11170POLYGON ((167584.688 -466111.742, 167498.932 -...2524795608464050003525111False
0170POLYGON ((165145.529 -464024.944, 165145.017 -...123563336844050001013422False
\n", + "

383 rows × 9 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id geometry \\\n", + "0 170 POLYGON ((167654.764 -470242.512, 167655.638 -... \n", + "1 170 POLYGON ((167694.221 -469153.485, 167693.191 -... \n", + "2 170 POLYGON ((167669.771 -467897.042, 167669.770 -... \n", + "3 170 POLYGON ((167646.521 -466641.120, 167646.502 -... \n", + "4 170 POLYGON ((167605.970 -464592.739, 167604.537 -... \n", + ".. ... ... \n", + "8 170 POLYGON ((167565.314 -466042.457, 167566.287 -... \n", + "9 170 POLYGON ((167563.316 -466013.754, 167563.368 -... \n", + "10 170 POLYGON ((167564.027 -466023.335, 167507.511 -... \n", + "11 170 POLYGON ((167584.688 -466111.742, 167498.932 -... \n", + "0 170 POLYGON ((165145.529 -464024.944, 165145.017 -... \n", + "\n", + " hqta_segment_id segment_sequence shape_id stop_id am_max_trips \\\n", + "0 1081235767 0 510066 4010 16 \n", + "1 930441633 1 510066 0004 7 \n", + "2 2927376411 2 510066 1698 7 \n", + "3 3648718989 3 510066 0550 4 \n", + "4 1193254190 4 510066 0555 4 \n", + ".. ... ... ... ... ... \n", + "8 2433783489 42 4050003 5251 1 \n", + "9 3860309591 43 4050003 5251 1 \n", + "10 259261282 45 4050003 0610 5 \n", + "11 2524795608 46 4050003 5251 1 \n", + "0 1235633368 4 4050001 0134 2 \n", + "\n", + " pm_max_trips hq_transit_corr \n", + "0 16 True \n", + "1 7 True \n", + "2 7 True \n", + "3 4 False \n", + "4 4 False \n", + ".. ... ... \n", + "8 1 False \n", + "9 1 False \n", + "10 4 False \n", + "11 1 False \n", + "0 2 False \n", + "\n", + "[383 rows x 9 columns]" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "bus_routes = (tbl.gtfs_schedule.routes()\n", - " >> filter(_.calitp_itp_id == 170)\n", - " >> filter(_.route_type == '3', _.route_type == '11') ## bus and trolleybus\n", - " >> select(_.route_id) >> collect())" + "lbt_hqta" ] }, { "cell_type": "code", - "execution_count": 42, - "id": "e7912a98-883b-4c6b-aedf-95533d9497c5", + "execution_count": 36, + "id": "c5fcee96-a46e-4d56-afe3-717d7841945d", "metadata": {}, "outputs": [ { @@ -639,68 +976,594 @@ " \n", " \n", " \n", - " route_id\n", + " calitp_itp_id\n", + " geometry\n", + " hqta_segment_id\n", + " segment_sequence\n", + " shape_id\n", + " stop_id\n", + " am_max_trips\n", + " pm_max_trips\n", + " hq_transit_corr\n", " \n", " \n", " \n", + " \n", + " 3\n", + " 170\n", + " POLYGON ((170683.457 -468570.782, 170703.916 -...\n", + " 3462120608\n", + " 4\n", + " 460064\n", + " 0477\n", + " 6\n", + " 6\n", + " True\n", + " \n", " \n", "\n", "" ], "text/plain": [ - "Empty DataFrame\n", - "Columns: [route_id]\n", - "Index: []" + " calitp_itp_id geometry \\\n", + "3 170 POLYGON ((170683.457 -468570.782, 170703.916 -... \n", + "\n", + " hqta_segment_id segment_sequence shape_id stop_id am_max_trips \\\n", + "3 3462120608 4 460064 0477 6 \n", + "\n", + " pm_max_trips hq_transit_corr \n", + "3 6 True " ] }, - "execution_count": 42, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bus_routes" + "lbt_hqta >> filter(_.stop_id == '0477')" ] }, { "cell_type": "code", - "execution_count": 30, - "id": "f6c92a46-4a65-4a0f-9bbc-a9d9050417d0", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, - "tags": [] - }, + "execution_count": 41, + "id": "1d258bdf-1164-4036-a16f-c7f942711c3f", + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "there are 0 shapes total\n" + "\n", + "Int64Index: 383 entries, 0 to 0\n", + "Data columns (total 9 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 calitp_itp_id 383 non-null object \n", + " 1 geometry 383 non-null geometry\n", + " 2 hqta_segment_id 383 non-null int64 \n", + " 3 segment_sequence 383 non-null object \n", + " 4 shape_id 383 non-null object \n", + " 5 stop_id 383 non-null object \n", + " 6 am_max_trips 383 non-null int64 \n", + " 7 pm_max_trips 383 non-null int64 \n", + " 8 hq_transit_corr 383 non-null bool \n", + "dtypes: bool(1), geometry(1), int64(3), object(4)\n", + "memory usage: 27.3+ KB\n" ] - }, + } + ], + "source": [ + "lbt_hqta.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "8c170b28-4de1-4ac1-b265-920ec3a976b4", + "metadata": {}, + "outputs": [ { - "ename": "KeyError", - "evalue": "\"['n' 'departure_hour'] not found in axis\"", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_46/1844755579.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mbart_hqta\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msingle_operator_hqta\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbart_views\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/tmp/ipykernel_46/483469756.py\u001b[0m in \u001b[0;36msingle_operator_hqta\u001b[0;34m(views)\u001b[0m\n\u001b[1;32m 39\u001b[0m \u001b[0;32mcontinue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 41\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mhqta\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'n'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'departure_hour'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreset_index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/util/_decorators.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 309\u001b[0m \u001b[0mstacklevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstacklevel\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 310\u001b[0m )\n\u001b[0;32m--> 311\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 312\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 313\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[1;32m 4904\u001b[0m \u001b[0mweight\u001b[0m \u001b[0;36m1.0\u001b[0m \u001b[0;36m0.8\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4905\u001b[0m \"\"\"\n\u001b[0;32m-> 4906\u001b[0;31m return super().drop(\n\u001b[0m\u001b[1;32m 4907\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4908\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[1;32m 4148\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m \u001b[0;32min\u001b[0m \u001b[0maxes\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4149\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlabels\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 4150\u001b[0;31m \u001b[0mobj\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_drop_axis\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4151\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4152\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0minplace\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m_drop_axis\u001b[0;34m(self, labels, axis, level, errors)\u001b[0m\n\u001b[1;32m 4183\u001b[0m \u001b[0mnew_axis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4184\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 4185\u001b[0;31m \u001b[0mnew_axis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4186\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0maxis_name\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mnew_axis\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4187\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, errors)\u001b[0m\n\u001b[1;32m 6015\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmask\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0many\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6016\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0merrors\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;34m\"ignore\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 6017\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"{labels[mask]} not found in axis\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6018\u001b[0m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m~\u001b[0m\u001b[0mmask\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6019\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdelete\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyError\u001b[0m: \"['n' 'departure_hour'] not found in axis\"" - ] + "data": { + "text/plain": [ + "array(['510066', '610106', '610105', '510067', '1210143', '460064',\n", + " '1210138', '1920161', '1920167', '1730123', '1910292', '1910295',\n", + " '1730122', '220068', '220074', '1710168', '1710162', '1720090',\n", + " '10070', '20008', '40001', '410006', '80002', '1510067', '20010',\n", + " '710048', '1510064', '450110', '710046', '1040017', '1310131',\n", + " '1040018', '910129', '1010081', '1030063', '910132', '1810080',\n", + " '1030064', '230018', '230015', '1120045', '1110083', '210080',\n", + " '1820070', '1810081', '920113', '930151', '4050003', '4050001'],\n", + " dtype=object)" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "lbt_hqta.shape_id.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "f03f090c-2508-46a4-b705-18df2c015186", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "5cc25219c19c41b6b83610ca0d0397f2", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[33.77270983724983, -118.1893899136652], controls=(ZoomControl(options=['position', 'zoom_in_text',…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "map_hqta(lbt_hqta, 'hqta_segment_id')" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "c19aba0b-b265-4cfe-8e76-0fca0447acda", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e9ed295d930b409c8063ff3abea43ad6", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[33.91231602534506, -118.10067122142928], controls=(ZoomControl(options=['position', 'zoom_in_text'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "map_hqta(lbt_hqta >> filter(_.shape_id == '1730123'))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4e62a18b-a65f-4027-87f2-7da1227a4d3b", + "metadata": {}, + "outputs": [], + "source": [ + "## investigate PCH not being an hqta..." + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "970b2cb6-7511-44be-bfb1-4d1c1d1bfe2b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idgeometryhqta_segment_idsegment_sequenceshape_idstop_idam_max_tripspm_max_tripshq_transit_corr
0170POLYGON ((175350.451 -454051.814, 175349.213 -...263163155101730123411355True
1170POLYGON ((175836.936 -454587.721, 175836.959 -...395710928911730123411632False
2170POLYGON ((175798.075 -455972.107, 175798.083 -...192662005121730123411932False
3170POLYGON ((175827.602 -457076.012, 175827.610 -...9770266131730123303332False
4170POLYGON ((175854.103 -458921.667, 175854.135 -...261241411841730123412432False
5170POLYGON ((176737.013 -460049.998, 176737.342 -...397105310451730123190933False
6170POLYGON ((177991.832 -460007.766, 178010.111 -...197500301861730123190222False
7170POLYGON ((178396.327 -461576.519, 178395.927 -...4607772471730123156933False
8170POLYGON ((178429.971 -462989.509, 178430.591 -...244947623781730123180255False
9170POLYGON ((178152.046 -463095.761, 178090.699 -...384245609191730123127243False
10170POLYGON ((175975.412 -463280.594, 175977.308 -...3062012927101730123197243False
11170POLYGON ((175919.561 -463405.079, 175916.534 -...3246762857111730123179522False
12170POLYGON ((176053.775 -464584.739, 176053.777 -...1485634259121730123179222False
13170POLYGON ((176068.527 -465823.921, 176068.537 -...797690437131730123178822False
14170POLYGON ((175997.767 -467784.889, 175997.533 -...2985254886141730123052922False
15170POLYGON ((175564.080 -467890.219, 175563.606 -...3337121648151730123052722False
16170POLYGON ((173784.416 -467841.455, 173785.048 -...1608597194161730123177922False
17170POLYGON ((171789.381 -467743.362, 171793.498 -...686165596171730123134677False
18170POLYGON ((171187.739 -467856.064, 171187.546 -...3092845517181730123167277False
19170POLYGON ((169935.539 -467879.393, 169923.522 -...3479053147191730123166777False
20170POLYGON ((168696.051 -467903.956, 168680.399 -...2645542972201730123166377True
21170POLYGON ((168037.524 -467916.250, 168037.372 -...3936942250211730123166277False
22170POLYGON ((167357.829 -467928.625, 167358.227 -...1939974416221730123005478False
23170POLYGON ((167281.629 -469235.162, 167281.182 -...7802714223173012303601010False
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id geometry \\\n", + "0 170 POLYGON ((175350.451 -454051.814, 175349.213 -... \n", + "1 170 POLYGON ((175836.936 -454587.721, 175836.959 -... \n", + "2 170 POLYGON ((175798.075 -455972.107, 175798.083 -... \n", + "3 170 POLYGON ((175827.602 -457076.012, 175827.610 -... \n", + "4 170 POLYGON ((175854.103 -458921.667, 175854.135 -... \n", + "5 170 POLYGON ((176737.013 -460049.998, 176737.342 -... \n", + "6 170 POLYGON ((177991.832 -460007.766, 178010.111 -... \n", + "7 170 POLYGON ((178396.327 -461576.519, 178395.927 -... \n", + "8 170 POLYGON ((178429.971 -462989.509, 178430.591 -... \n", + "9 170 POLYGON ((178152.046 -463095.761, 178090.699 -... \n", + "10 170 POLYGON ((175975.412 -463280.594, 175977.308 -... \n", + "11 170 POLYGON ((175919.561 -463405.079, 175916.534 -... \n", + "12 170 POLYGON ((176053.775 -464584.739, 176053.777 -... \n", + "13 170 POLYGON ((176068.527 -465823.921, 176068.537 -... \n", + "14 170 POLYGON ((175997.767 -467784.889, 175997.533 -... \n", + "15 170 POLYGON ((175564.080 -467890.219, 175563.606 -... \n", + "16 170 POLYGON ((173784.416 -467841.455, 173785.048 -... \n", + "17 170 POLYGON ((171789.381 -467743.362, 171793.498 -... \n", + "18 170 POLYGON ((171187.739 -467856.064, 171187.546 -... \n", + "19 170 POLYGON ((169935.539 -467879.393, 169923.522 -... \n", + "20 170 POLYGON ((168696.051 -467903.956, 168680.399 -... \n", + "21 170 POLYGON ((168037.524 -467916.250, 168037.372 -... \n", + "22 170 POLYGON ((167357.829 -467928.625, 167358.227 -... \n", + "23 170 POLYGON ((167281.629 -469235.162, 167281.182 -... \n", + "\n", + " hqta_segment_id segment_sequence shape_id stop_id am_max_trips \\\n", + "0 2631631551 0 1730123 4113 5 \n", + "1 3957109289 1 1730123 4116 3 \n", + "2 1926620051 2 1730123 4119 3 \n", + "3 97702661 3 1730123 3033 3 \n", + "4 2612414118 4 1730123 4124 3 \n", + "5 3971053104 5 1730123 1909 3 \n", + "6 1975003018 6 1730123 1902 2 \n", + "7 46077724 7 1730123 1569 3 \n", + "8 2449476237 8 1730123 1802 5 \n", + "9 3842456091 9 1730123 1272 4 \n", + "10 3062012927 10 1730123 1972 4 \n", + "11 3246762857 11 1730123 1795 2 \n", + "12 1485634259 12 1730123 1792 2 \n", + "13 797690437 13 1730123 1788 2 \n", + "14 2985254886 14 1730123 0529 2 \n", + "15 3337121648 15 1730123 0527 2 \n", + "16 1608597194 16 1730123 1779 2 \n", + "17 686165596 17 1730123 1346 7 \n", + "18 3092845517 18 1730123 1672 7 \n", + "19 3479053147 19 1730123 1667 7 \n", + "20 2645542972 20 1730123 1663 7 \n", + "21 3936942250 21 1730123 1662 7 \n", + "22 1939974416 22 1730123 0054 7 \n", + "23 78027142 23 1730123 0360 10 \n", + "\n", + " pm_max_trips hq_transit_corr \n", + "0 5 True \n", + "1 2 False \n", + "2 2 False \n", + "3 2 False \n", + "4 2 False \n", + "5 3 False \n", + "6 2 False \n", + "7 3 False \n", + "8 5 False \n", + "9 3 False \n", + "10 3 False \n", + "11 2 False \n", + "12 2 False \n", + "13 2 False \n", + "14 2 False \n", + "15 2 False \n", + "16 2 False \n", + "17 7 False \n", + "18 7 False \n", + "19 7 False \n", + "20 7 True \n", + "21 7 False \n", + "22 8 False \n", + "23 10 False " + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "lbt_hqta = single_operator_hqta(300)" + "lbt_hqta >> filter(_.shape_id == '1730123')" ] }, { diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 512cd65f8..706376a07 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", "metadata": { "tags": [] @@ -14,10 +14,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -68,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", "metadata": {}, "outputs": [], @@ -87,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], @@ -131,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", "metadata": { "tags": [] @@ -149,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", "metadata": {}, "outputs": [], @@ -162,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", "metadata": {}, "outputs": [], @@ -176,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", "metadata": {}, "outputs": [], @@ -190,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], @@ -200,7 +209,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, "outputs": [], @@ -222,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], @@ -236,7 +245,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -246,7 +255,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -263,7 +272,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -273,7 +282,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -283,7 +292,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -296,7 +305,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -306,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -316,7 +325,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -329,7 +338,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -339,7 +348,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -357,7 +366,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -370,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -382,7 +391,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -400,7 +409,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -414,17 +423,198 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometry
0100340000237.797908-121.2636642POINT (-111116.950 -23544.700)
1100340000137.957058-121.2789482POINT (-112222.169 -5836.078)
2100340000337.696468-121.4338692POINT (-126252.943 -34607.238)
31003400004.337.657549-121.8829622POINT (-165877.168 -38241.179)
41003400004.137.697081-121.7176482POINT (-151236.096 -34123.815)
........................
28410248354937.872939-122.4554464POINT (-215679.403 -13151.168)
29410248356937.856636-122.4782754POINT (-217731.552 -14910.728)
31338081872937.770840-122.3857914POINT (-209847.993 -24653.833)
32338081873337.864540-122.3139324POINT (-203274.531 -14397.269)
33338081872737.797482-122.3950254POINT (-210585.228 -21672.628)
\n", + "

1324 rows × 7 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "0 10 0 3400002 37.797908 -121.263664 \n", + "1 10 0 3400001 37.957058 -121.278948 \n", + "2 10 0 3400003 37.696468 -121.433869 \n", + "3 10 0 3400004.3 37.657549 -121.882962 \n", + "4 10 0 3400004.1 37.697081 -121.717648 \n", + ".. ... ... ... ... ... \n", + "28 41 0 2483549 37.872939 -122.455446 \n", + "29 41 0 2483569 37.856636 -122.478275 \n", + "31 338 0 818729 37.770840 -122.385791 \n", + "32 338 0 818733 37.864540 -122.313932 \n", + "33 338 0 818727 37.797482 -122.395025 \n", + "\n", + " route_type geometry \n", + "0 2 POINT (-111116.950 -23544.700) \n", + "1 2 POINT (-112222.169 -5836.078) \n", + "2 2 POINT (-126252.943 -34607.238) \n", + "3 2 POINT (-165877.168 -38241.179) \n", + "4 2 POINT (-151236.096 -34123.815) \n", + ".. ... ... \n", + "28 4 POINT (-215679.403 -13151.168) \n", + "29 4 POINT (-217731.552 -14910.728) \n", + "31 4 POINT (-209847.993 -24653.833) \n", + "32 4 POINT (-203274.531 -14397.269) \n", + "33 4 POINT (-210585.228 -21672.628) \n", + "\n", + "[1324 rows x 7 columns]" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "rail_brt_ferry" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", "metadata": {}, "outputs": [], @@ -434,7 +624,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "b4d279ae-5283-47e6-b503-f01738f7672a", "metadata": {}, "outputs": [], @@ -445,7 +635,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "id": "c76728cc-b293-4f57-8002-3efa845a1dad", "metadata": { "tags": [] @@ -457,7 +647,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "id": "0174ddab-347c-47d2-b824-98e360719b94", "metadata": {}, "outputs": [], @@ -465,12 +655,12 @@ "## after this cell displays output the notebook refuses to save...\n", "## File Save Error for rail_ferry_brt.ipynb\n", "## Invalid response: 413 Request Entity Too Large\n", - "ca_shape['geometry'].iloc[0]" + "# ca_shape['geometry'].iloc[0]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "id": "8b7beb5f-2128-4482-9648-abdfcc8e0001", "metadata": {}, "outputs": [], @@ -480,7 +670,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "id": "fa029d00-acac-4242-9048-d8024e70f914", "metadata": {}, "outputs": [], @@ -490,10 +680,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], "source": [ "geoparquet_gcs_export(rail_brt_ferry, 'rail_brt_ferry')" ] From 57f0b663b76a94c0961f85a57a9e9a3035f728ca Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Thu, 9 Dec 2021 00:50:07 +0000 Subject: [PATCH 05/24] more lbt investigation --- .../bus_corridors.ipynb | 1216 ++++++++++++++++- 1 file changed, 1181 insertions(+), 35 deletions(-) diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 21a0736e3..cf7bf6411 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -330,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 61, "id": "0d3207be-d38f-4f17-a97f-0f84cae25d77", "metadata": {}, "outputs": [], @@ -447,6 +447,7 @@ " segment_peak_service['next_seg_hqta'] = segment_peak_service['hq_transit_corr'].shift(-1)\n", " \n", " ## consider segment not HQTA if both the prior and next segements are not HQTAs\n", + " debug_dict[f'{shape_id}_sps'] = segments_with_max_stop >> inner_join(_, segment_peak_service, on = 'hqta_segment_id')\n", " segment_peak_service['hq_transit_corr'] = segment_peak_service.apply(\n", " lambda x: False if x.hq_transit_corr == False else x.last_seg_hqta or x.next_seg_hqta, axis = 1)\n", " segment_peak_service['hq_transit_corr'] = segment_peak_service['hq_transit_corr'].fillna(True)\n", @@ -513,12 +514,12 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 47, "id": "e9d94df4-21cd-46d6-a8ab-fe4d4c01d728", "metadata": {}, "outputs": [], "source": [ - "debug_ids = ['940143']" + "debug_ids = ['940143', '1730123']" ] }, { @@ -547,9 +548,13 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 62, "id": "f6c92a46-4a65-4a0f-9bbc-a9d9050417d0", "metadata": { + "collapsed": true, + "jupyter": { + "outputs_hidden": true + }, "tags": [] }, "outputs": [ @@ -571,6 +576,7 @@ "calculating for shape_id 1920161\n", "calculating for shape_id 1920167\n", "calculating for shape_id 1730123\n", + "***debug shape*** 1730123\n", "calculating for shape_id 1910292\n", "calculating for shape_id 1910295\n", "calculating for shape_id 1730122\n", @@ -723,7 +729,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 63, "id": "2ab838e9-ba14-4057-a0ab-9e6401e83f16", "metadata": {}, "outputs": [ @@ -940,7 +946,7 @@ "[383 rows x 9 columns]" ] }, - "execution_count": 33, + "execution_count": 63, "metadata": {}, "output_type": "execute_result" } @@ -951,7 +957,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 64, "id": "c5fcee96-a46e-4d56-afe3-717d7841945d", "metadata": {}, "outputs": [ @@ -1015,7 +1021,7 @@ "3 6 True " ] }, - "execution_count": 36, + "execution_count": 64, "metadata": {}, "output_type": "execute_result" } @@ -1026,7 +1032,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 65, "id": "1d258bdf-1164-4036-a16f-c7f942711c3f", "metadata": {}, "outputs": [ @@ -1059,7 +1065,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 66, "id": "8c170b28-4de1-4ac1-b265-920ec3a976b4", "metadata": {}, "outputs": [ @@ -1077,7 +1083,7 @@ " dtype=object)" ] }, - "execution_count": 43, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } @@ -1088,39 +1094,24 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 67, "id": "f03f090c-2508-46a4-b705-18df2c015186", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "5cc25219c19c41b6b83610ca0d0397f2", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[33.77270983724983, -118.1893899136652], controls=(ZoomControl(options=['position', 'zoom_in_text',…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "map_hqta(lbt_hqta, 'hqta_segment_id')" + "# map_hqta(lbt_hqta, 'hqta_segment_id')" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 68, "id": "c19aba0b-b265-4cfe-8e76-0fca0447acda", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "e9ed295d930b409c8063ff3abea43ad6", + "model_id": "9d4124fffa3849d38d4e43275c918518", "version_major": 2, "version_minor": 0 }, @@ -1133,12 +1124,12 @@ } ], "source": [ - "map_hqta(lbt_hqta >> filter(_.shape_id == '1730123'))" + "map_hqta(lbt_hqta >> filter(_.shape_id == '1730123'), 'stop_id')" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 69, "id": "4e62a18b-a65f-4027-87f2-7da1227a4d3b", "metadata": {}, "outputs": [], @@ -1148,7 +1139,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 70, "id": "970b2cb6-7511-44be-bfb1-4d1c1d1bfe2b", "metadata": {}, "outputs": [ @@ -1557,7 +1548,7 @@ "23 10 False " ] }, - "execution_count": 45, + "execution_count": 70, "metadata": {}, "output_type": "execute_result" } @@ -1566,6 +1557,1161 @@ "lbt_hqta >> filter(_.shape_id == '1730123')" ] }, + { + "cell_type": "code", + "execution_count": 72, + "id": "144e0093-693f-4fa3-b1f4-849f763a9f28", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexcalitp_itp_idshape_idcalitp_extracted_atgeometrysegment_sequencehqta_segment_idstop_idn_tripsam_max_tripspm_max_tripshq_transit_corrlast_seg_hqtanext_seg_hqta
0017017301232021-10-06POLYGON ((175350.451 -454051.814, 175349.213 -...0263163155141136955TrueFalseTrue
1017017301232021-10-06POLYGON ((175836.936 -454587.721, 175836.959 -...1395710928941163532FalseTrueFalse
2017017301232021-10-06POLYGON ((175798.075 -455972.107, 175798.083 -...2192662005141193532FalseFalseTrue
3017017301232021-10-06POLYGON ((175827.602 -457076.012, 175827.610 -...39770266130333532FalseTrueTrue
4017017301232021-10-06POLYGON ((175854.103 -458921.667, 175854.135 -...4261241411841243532FalseTrueTrue
5017017301232021-10-06POLYGON ((176737.013 -460049.998, 176737.342 -...5397105310419093433FalseFalseNaN
6017017301232021-10-06POLYGON ((177991.832 -460007.766, 178010.111 -...6197500301819023122FalseTrueTrue
7017017301232021-10-06POLYGON ((178396.327 -461576.519, 178395.927 -...74607772415693233FalseNaNTrue
8017017301232021-10-06POLYGON ((178429.971 -462989.509, 178430.591 -...8244947623718027255TrueFalseFalse
9017017301232021-10-06POLYGON ((178152.046 -463095.761, 178090.699 -...9384245609112724943FalseTrueTrue
10017017301232021-10-06POLYGON ((175975.412 -463280.594, 175977.308 -...10306201292719724943FalseFalseTrue
11017017301232021-10-06POLYGON ((175919.561 -463405.079, 175916.534 -...11324676285717953122FalseTrueFalse
12017017301232021-10-06POLYGON ((176053.775 -464584.739, 176053.777 -...12148563425917923122FalseFalseFalse
13017017301232021-10-06POLYGON ((176068.527 -465823.921, 176068.537 -...1379769043717883122FalseTrueFalse
14017017301232021-10-06POLYGON ((175997.767 -467784.889, 175997.533 -...14298525488605293122FalseTrueFalse
15017017301232021-10-06POLYGON ((175564.080 -467890.219, 175563.606 -...15333712164805273122FalseFalseTrue
16017017301232021-10-06POLYGON ((173784.416 -467841.455, 173785.048 -...16160859719417793122FalseFalseFalse
17017017301232021-10-06POLYGON ((171789.381 -467743.362, 171793.498 -...17686165596134611077TrueFalseFalse
18017017301232021-10-06POLYGON ((171187.739 -467856.064, 171187.546 -...183092845517167211077TrueFalseFalse
19017017301232021-10-06POLYGON ((169935.539 -467879.393, 169923.522 -...193479053147166711077TrueFalseFalse
20017017301232021-10-06POLYGON ((168696.051 -467903.956, 168680.399 -...202645542972166311077TrueTrueFalse
21017017301232021-10-06POLYGON ((168037.524 -467916.250, 168037.372 -...213936942250166211077TrueFalseFalse
22017017301232021-10-06POLYGON ((167357.829 -467928.625, 167358.227 -...221939974416005411078TrueFalseFalse
23017017301232021-10-06POLYGON ((167281.629 -469235.162, 167281.182 -...237802714203601521010TrueFalseFalse
\n", + "
" + ], + "text/plain": [ + " index calitp_itp_id shape_id calitp_extracted_at \\\n", + "0 0 170 1730123 2021-10-06 \n", + "1 0 170 1730123 2021-10-06 \n", + "2 0 170 1730123 2021-10-06 \n", + "3 0 170 1730123 2021-10-06 \n", + "4 0 170 1730123 2021-10-06 \n", + "5 0 170 1730123 2021-10-06 \n", + "6 0 170 1730123 2021-10-06 \n", + "7 0 170 1730123 2021-10-06 \n", + "8 0 170 1730123 2021-10-06 \n", + "9 0 170 1730123 2021-10-06 \n", + "10 0 170 1730123 2021-10-06 \n", + "11 0 170 1730123 2021-10-06 \n", + "12 0 170 1730123 2021-10-06 \n", + "13 0 170 1730123 2021-10-06 \n", + "14 0 170 1730123 2021-10-06 \n", + "15 0 170 1730123 2021-10-06 \n", + "16 0 170 1730123 2021-10-06 \n", + "17 0 170 1730123 2021-10-06 \n", + "18 0 170 1730123 2021-10-06 \n", + "19 0 170 1730123 2021-10-06 \n", + "20 0 170 1730123 2021-10-06 \n", + "21 0 170 1730123 2021-10-06 \n", + "22 0 170 1730123 2021-10-06 \n", + "23 0 170 1730123 2021-10-06 \n", + "\n", + " geometry segment_sequence \\\n", + "0 POLYGON ((175350.451 -454051.814, 175349.213 -... 0 \n", + "1 POLYGON ((175836.936 -454587.721, 175836.959 -... 1 \n", + "2 POLYGON ((175798.075 -455972.107, 175798.083 -... 2 \n", + "3 POLYGON ((175827.602 -457076.012, 175827.610 -... 3 \n", + "4 POLYGON ((175854.103 -458921.667, 175854.135 -... 4 \n", + "5 POLYGON ((176737.013 -460049.998, 176737.342 -... 5 \n", + "6 POLYGON ((177991.832 -460007.766, 178010.111 -... 6 \n", + "7 POLYGON ((178396.327 -461576.519, 178395.927 -... 7 \n", + "8 POLYGON ((178429.971 -462989.509, 178430.591 -... 8 \n", + "9 POLYGON ((178152.046 -463095.761, 178090.699 -... 9 \n", + "10 POLYGON ((175975.412 -463280.594, 175977.308 -... 10 \n", + "11 POLYGON ((175919.561 -463405.079, 175916.534 -... 11 \n", + "12 POLYGON ((176053.775 -464584.739, 176053.777 -... 12 \n", + "13 POLYGON ((176068.527 -465823.921, 176068.537 -... 13 \n", + "14 POLYGON ((175997.767 -467784.889, 175997.533 -... 14 \n", + "15 POLYGON ((175564.080 -467890.219, 175563.606 -... 15 \n", + "16 POLYGON ((173784.416 -467841.455, 173785.048 -... 16 \n", + "17 POLYGON ((171789.381 -467743.362, 171793.498 -... 17 \n", + "18 POLYGON ((171187.739 -467856.064, 171187.546 -... 18 \n", + "19 POLYGON ((169935.539 -467879.393, 169923.522 -... 19 \n", + "20 POLYGON ((168696.051 -467903.956, 168680.399 -... 20 \n", + "21 POLYGON ((168037.524 -467916.250, 168037.372 -... 21 \n", + "22 POLYGON ((167357.829 -467928.625, 167358.227 -... 22 \n", + "23 POLYGON ((167281.629 -469235.162, 167281.182 -... 23 \n", + "\n", + " hqta_segment_id stop_id n_trips am_max_trips pm_max_trips \\\n", + "0 2631631551 4113 69 5 5 \n", + "1 3957109289 4116 35 3 2 \n", + "2 1926620051 4119 35 3 2 \n", + "3 97702661 3033 35 3 2 \n", + "4 2612414118 4124 35 3 2 \n", + "5 3971053104 1909 34 3 3 \n", + "6 1975003018 1902 31 2 2 \n", + "7 46077724 1569 32 3 3 \n", + "8 2449476237 1802 72 5 5 \n", + "9 3842456091 1272 49 4 3 \n", + "10 3062012927 1972 49 4 3 \n", + "11 3246762857 1795 31 2 2 \n", + "12 1485634259 1792 31 2 2 \n", + "13 797690437 1788 31 2 2 \n", + "14 2985254886 0529 31 2 2 \n", + "15 3337121648 0527 31 2 2 \n", + "16 1608597194 1779 31 2 2 \n", + "17 686165596 1346 110 7 7 \n", + "18 3092845517 1672 110 7 7 \n", + "19 3479053147 1667 110 7 7 \n", + "20 2645542972 1663 110 7 7 \n", + "21 3936942250 1662 110 7 7 \n", + "22 1939974416 0054 110 7 8 \n", + "23 78027142 0360 152 10 10 \n", + "\n", + " hq_transit_corr last_seg_hqta next_seg_hqta \n", + "0 True False True \n", + "1 False True False \n", + "2 False False True \n", + "3 False True True \n", + "4 False True True \n", + "5 False False NaN \n", + "6 False True True \n", + "7 False NaN True \n", + "8 True False False \n", + "9 False True True \n", + "10 False False True \n", + "11 False True False \n", + "12 False False False \n", + "13 False True False \n", + "14 False True False \n", + "15 False False True \n", + "16 False False False \n", + "17 True False False \n", + "18 True False False \n", + "19 True False False \n", + "20 True True False \n", + "21 True False False \n", + "22 True False False \n", + "23 True False False " + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sps = debug_dict['1730123_sps']\n", + "sps" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "id": "aa772241-9e43-47eb-b2a2-5e9c727cc46c", + "metadata": {}, + "outputs": [], + "source": [ + "sps['hq_transit_corr'] = sps.apply(\n", + " lambda x: False if x.hq_transit_corr == False else x.last_seg_hqta or x.next_seg_hqta, axis = 1)\n", + "sps['hq_transit_corr'] = sps['hq_transit_corr'].fillna(True)" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "id": "efbd4c3b-77f8-4385-b00d-993beb00057f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexcalitp_itp_idshape_idcalitp_extracted_atgeometrysegment_sequencehqta_segment_idstop_idn_tripsam_max_tripspm_max_tripshq_transit_corrlast_seg_hqtanext_seg_hqta
0017017301232021-10-06POLYGON ((175350.451 -454051.814, 175349.213 -...0263163155141136955TrueFalseTrue
1017017301232021-10-06POLYGON ((175836.936 -454587.721, 175836.959 -...1395710928941163532FalseTrueFalse
2017017301232021-10-06POLYGON ((175798.075 -455972.107, 175798.083 -...2192662005141193532FalseFalseTrue
3017017301232021-10-06POLYGON ((175827.602 -457076.012, 175827.610 -...39770266130333532FalseTrueTrue
4017017301232021-10-06POLYGON ((175854.103 -458921.667, 175854.135 -...4261241411841243532FalseTrueTrue
5017017301232021-10-06POLYGON ((176737.013 -460049.998, 176737.342 -...5397105310419093433FalseFalseNaN
6017017301232021-10-06POLYGON ((177991.832 -460007.766, 178010.111 -...6197500301819023122FalseTrueTrue
7017017301232021-10-06POLYGON ((178396.327 -461576.519, 178395.927 -...74607772415693233FalseNaNTrue
8017017301232021-10-06POLYGON ((178429.971 -462989.509, 178430.591 -...8244947623718027255FalseFalseFalse
9017017301232021-10-06POLYGON ((178152.046 -463095.761, 178090.699 -...9384245609112724943FalseTrueTrue
10017017301232021-10-06POLYGON ((175975.412 -463280.594, 175977.308 -...10306201292719724943FalseFalseTrue
11017017301232021-10-06POLYGON ((175919.561 -463405.079, 175916.534 -...11324676285717953122FalseTrueFalse
12017017301232021-10-06POLYGON ((176053.775 -464584.739, 176053.777 -...12148563425917923122FalseFalseFalse
13017017301232021-10-06POLYGON ((176068.527 -465823.921, 176068.537 -...1379769043717883122FalseTrueFalse
14017017301232021-10-06POLYGON ((175997.767 -467784.889, 175997.533 -...14298525488605293122FalseTrueFalse
15017017301232021-10-06POLYGON ((175564.080 -467890.219, 175563.606 -...15333712164805273122FalseFalseTrue
16017017301232021-10-06POLYGON ((173784.416 -467841.455, 173785.048 -...16160859719417793122FalseFalseFalse
17017017301232021-10-06POLYGON ((171789.381 -467743.362, 171793.498 -...17686165596134611077FalseFalseFalse
18017017301232021-10-06POLYGON ((171187.739 -467856.064, 171187.546 -...183092845517167211077FalseFalseFalse
19017017301232021-10-06POLYGON ((169935.539 -467879.393, 169923.522 -...193479053147166711077FalseFalseFalse
20017017301232021-10-06POLYGON ((168696.051 -467903.956, 168680.399 -...202645542972166311077TrueTrueFalse
21017017301232021-10-06POLYGON ((168037.524 -467916.250, 168037.372 -...213936942250166211077FalseFalseFalse
22017017301232021-10-06POLYGON ((167357.829 -467928.625, 167358.227 -...221939974416005411078FalseFalseFalse
23017017301232021-10-06POLYGON ((167281.629 -469235.162, 167281.182 -...237802714203601521010FalseFalseFalse
\n", + "
" + ], + "text/plain": [ + " index calitp_itp_id shape_id calitp_extracted_at \\\n", + "0 0 170 1730123 2021-10-06 \n", + "1 0 170 1730123 2021-10-06 \n", + "2 0 170 1730123 2021-10-06 \n", + "3 0 170 1730123 2021-10-06 \n", + "4 0 170 1730123 2021-10-06 \n", + "5 0 170 1730123 2021-10-06 \n", + "6 0 170 1730123 2021-10-06 \n", + "7 0 170 1730123 2021-10-06 \n", + "8 0 170 1730123 2021-10-06 \n", + "9 0 170 1730123 2021-10-06 \n", + "10 0 170 1730123 2021-10-06 \n", + "11 0 170 1730123 2021-10-06 \n", + "12 0 170 1730123 2021-10-06 \n", + "13 0 170 1730123 2021-10-06 \n", + "14 0 170 1730123 2021-10-06 \n", + "15 0 170 1730123 2021-10-06 \n", + "16 0 170 1730123 2021-10-06 \n", + "17 0 170 1730123 2021-10-06 \n", + "18 0 170 1730123 2021-10-06 \n", + "19 0 170 1730123 2021-10-06 \n", + "20 0 170 1730123 2021-10-06 \n", + "21 0 170 1730123 2021-10-06 \n", + "22 0 170 1730123 2021-10-06 \n", + "23 0 170 1730123 2021-10-06 \n", + "\n", + " geometry segment_sequence \\\n", + "0 POLYGON ((175350.451 -454051.814, 175349.213 -... 0 \n", + "1 POLYGON ((175836.936 -454587.721, 175836.959 -... 1 \n", + "2 POLYGON ((175798.075 -455972.107, 175798.083 -... 2 \n", + "3 POLYGON ((175827.602 -457076.012, 175827.610 -... 3 \n", + "4 POLYGON ((175854.103 -458921.667, 175854.135 -... 4 \n", + "5 POLYGON ((176737.013 -460049.998, 176737.342 -... 5 \n", + "6 POLYGON ((177991.832 -460007.766, 178010.111 -... 6 \n", + "7 POLYGON ((178396.327 -461576.519, 178395.927 -... 7 \n", + "8 POLYGON ((178429.971 -462989.509, 178430.591 -... 8 \n", + "9 POLYGON ((178152.046 -463095.761, 178090.699 -... 9 \n", + "10 POLYGON ((175975.412 -463280.594, 175977.308 -... 10 \n", + "11 POLYGON ((175919.561 -463405.079, 175916.534 -... 11 \n", + "12 POLYGON ((176053.775 -464584.739, 176053.777 -... 12 \n", + "13 POLYGON ((176068.527 -465823.921, 176068.537 -... 13 \n", + "14 POLYGON ((175997.767 -467784.889, 175997.533 -... 14 \n", + "15 POLYGON ((175564.080 -467890.219, 175563.606 -... 15 \n", + "16 POLYGON ((173784.416 -467841.455, 173785.048 -... 16 \n", + "17 POLYGON ((171789.381 -467743.362, 171793.498 -... 17 \n", + "18 POLYGON ((171187.739 -467856.064, 171187.546 -... 18 \n", + "19 POLYGON ((169935.539 -467879.393, 169923.522 -... 19 \n", + "20 POLYGON ((168696.051 -467903.956, 168680.399 -... 20 \n", + "21 POLYGON ((168037.524 -467916.250, 168037.372 -... 21 \n", + "22 POLYGON ((167357.829 -467928.625, 167358.227 -... 22 \n", + "23 POLYGON ((167281.629 -469235.162, 167281.182 -... 23 \n", + "\n", + " hqta_segment_id stop_id n_trips am_max_trips pm_max_trips \\\n", + "0 2631631551 4113 69 5 5 \n", + "1 3957109289 4116 35 3 2 \n", + "2 1926620051 4119 35 3 2 \n", + "3 97702661 3033 35 3 2 \n", + "4 2612414118 4124 35 3 2 \n", + "5 3971053104 1909 34 3 3 \n", + "6 1975003018 1902 31 2 2 \n", + "7 46077724 1569 32 3 3 \n", + "8 2449476237 1802 72 5 5 \n", + "9 3842456091 1272 49 4 3 \n", + "10 3062012927 1972 49 4 3 \n", + "11 3246762857 1795 31 2 2 \n", + "12 1485634259 1792 31 2 2 \n", + "13 797690437 1788 31 2 2 \n", + "14 2985254886 0529 31 2 2 \n", + "15 3337121648 0527 31 2 2 \n", + "16 1608597194 1779 31 2 2 \n", + "17 686165596 1346 110 7 7 \n", + "18 3092845517 1672 110 7 7 \n", + "19 3479053147 1667 110 7 7 \n", + "20 2645542972 1663 110 7 7 \n", + "21 3936942250 1662 110 7 7 \n", + "22 1939974416 0054 110 7 8 \n", + "23 78027142 0360 152 10 10 \n", + "\n", + " hq_transit_corr last_seg_hqta next_seg_hqta \n", + "0 True False True \n", + "1 False True False \n", + "2 False False True \n", + "3 False True True \n", + "4 False True True \n", + "5 False False NaN \n", + "6 False True True \n", + "7 False NaN True \n", + "8 False False False \n", + "9 False True True \n", + "10 False False True \n", + "11 False True False \n", + "12 False False False \n", + "13 False True False \n", + "14 False True False \n", + "15 False False True \n", + "16 False False False \n", + "17 False False False \n", + "18 False False False \n", + "19 False False False \n", + "20 True True False \n", + "21 False False False \n", + "22 False False False \n", + "23 False False False " + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sps" + ] + }, { "cell_type": "markdown", "id": "b37c7411-8ea1-48c2-b42a-b437cdef7eaa", From 2c126f89b6111e695e740e6e3ff83d059d7267e1 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Fri, 10 Dec 2021 00:16:17 +0000 Subject: [PATCH 06/24] interim export for opr --- .../combine_and_visualize.ipynb | 2125 +++++++++++++---- 1 file changed, 1671 insertions(+), 454 deletions(-) diff --git a/high_quality_transit_areas/combine_and_visualize.ipynb b/high_quality_transit_areas/combine_and_visualize.ipynb index 19ba79e8b..28abca3d7 100644 --- a/high_quality_transit_areas/combine_and_visualize.ipynb +++ b/high_quality_transit_areas/combine_and_visualize.ipynb @@ -2,110 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "7f9e615b-d071-4728-b774-1d02f509c332", "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", - "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", - "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", - "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", - "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", - "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", - "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", - "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", - "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", - "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", - "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", - "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", - "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", - "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", - "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", - "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", - "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", - "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", - "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", - "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", - "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", - "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" - ] - } - ], + "outputs": [], "source": [ - "!pip install -r requirements.txt" + "# !pip install -r requirements.txt" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 162, "id": "4d53c57e-0777-4c0d-9dc6-4954c95ed307", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -125,19 +37,20 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 163, "id": "e31ad027-1acc-44f8-bdd6-31f1b9b36a77", "metadata": {}, "outputs": [], "source": [ "bus_hqtc = gpd.read_parquet(f'{GCS_FILE_PATH}shape_hqta_dissolve.parquet')\n", "bus_hqtc = bus_hqtc[bus_hqtc['hq_transit_corr']]\n", - "bus_hqtc['hqta_type'] = 'hq_transit_corr'" + "bus_hqtc['hqta_type'] = 'hq_transit_corr'\n", + "bus_hqtc['route_type'] = '3'" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 164, "id": "bcbea24e-ab7e-400a-8813-6a477471c1d6", "metadata": {}, "outputs": [], @@ -148,23 +61,19 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 165, "id": "6aec4721-0827-40f3-be60-0790916b0385", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Index(['stop_id', 'calitp_itp_id', 'stop_lat', 'stop_lon', 'itp_id_stop_id',\n", - " 'itp_id_trip_id', 'route_id', 'itp_id_route_id', 'trip_id', 'geometry',\n", - " 'calitp_url_number', 'route_type', 'agency_id', 'route_short_name',\n", - " 'route_long_name', 'route_desc', 'route_url', 'route_color',\n", - " 'route_text_color', 'route_sort_order', 'continuous_pickup',\n", - " 'continuous_drop_off', 'calitp_extracted_at', 'hqta_type'],\n", + "Index(['calitp_itp_id', 'calitp_url_number', 'stop_id', 'stop_lat', 'stop_lon',\n", + " 'route_type', 'geometry', 'hqta_type'],\n", " dtype='object')" ] }, - "execution_count": 7, + "execution_count": 165, "metadata": {}, "output_type": "execute_result" } @@ -175,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 166, "id": "0e807584-dfb2-4385-b274-7276b0bc38d0", "metadata": { "tags": [] @@ -187,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 167, "id": "3b9a9f5e-6371-4367-978c-c0be0e6d979f", "metadata": { "tags": [] @@ -237,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 168, "id": "441de95c-34c4-46bd-a95c-bfa0fd0338ea", "metadata": {}, "outputs": [ @@ -272,6 +181,7 @@ " am_max_trips\n", " pm_max_trips\n", " hqta_type\n", + " route_type\n", " \n", " \n", " \n", @@ -287,6 +197,7 @@ " 7.0\n", " 8.0\n", " hq_transit_corr\n", + " 3\n", " \n", " \n", " 2257\n", @@ -300,6 +211,7 @@ " 5.0\n", " 7.0\n", " hq_transit_corr\n", + " 3\n", " \n", " \n", " 2258\n", @@ -313,6 +225,7 @@ " 5.0\n", " 6.0\n", " hq_transit_corr\n", + " 3\n", " \n", " \n", "\n", @@ -334,13 +247,13 @@ "2257 4126984225 1 4654 \n", "2258 1555422069 0 6679 \n", "\n", - " am_max_trips pm_max_trips hqta_type \n", - "2256 7.0 8.0 hq_transit_corr \n", - "2257 5.0 7.0 hq_transit_corr \n", - "2258 5.0 6.0 hq_transit_corr " + " am_max_trips pm_max_trips hqta_type route_type \n", + "2256 7.0 8.0 hq_transit_corr 3 \n", + "2257 5.0 7.0 hq_transit_corr 3 \n", + "2258 5.0 6.0 hq_transit_corr 3 " ] }, - "execution_count": 8, + "execution_count": 168, "metadata": {}, "output_type": "execute_result" } @@ -351,7 +264,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 169, "id": "f104e680-a949-4e07-a4dd-19950207c66f", "metadata": {}, "outputs": [], @@ -373,7 +286,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 170, "id": "96caf70f-e497-4df4-9b1a-20b54f7b7f83", "metadata": {}, "outputs": [], @@ -383,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 171, "id": "cdb9023e-8397-4eed-b829-0ab22ee26580", "metadata": {}, "outputs": [], @@ -393,7 +306,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 172, "id": "a54925c8-cb64-452f-b8ac-18407ed3f9d6", "metadata": {}, "outputs": [], @@ -403,17 +316,17 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 173, "id": "c3f748fa-861d-4d7c-b005-480d6ecc30a2", "metadata": {}, "outputs": [], "source": [ - "major_bus = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops_working.parquet')" + "# major_bus = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops_working.parquet')" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 174, "id": "ca09eb4e-97b4-48b6-ba21-542ac35c8ceb", "metadata": {}, "outputs": [], @@ -432,17 +345,17 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 175, "id": "82e5d819-63dc-4ba3-a9f9-c314f5a4ca33", "metadata": {}, "outputs": [], "source": [ - "major_bus['geometry'] = major_bus.geometry.apply(drop_big_areas)" + "# major_bus['geometry'] = major_bus.geometry.apply(drop_big_areas)" ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 176, "id": "6273ed98-b5a2-4e83-bfac-9f487f8c6142", "metadata": {}, "outputs": [], @@ -463,21 +376,59 @@ }, { "cell_type": "code", - "execution_count": 29, - "id": "c35ed21e-d6e0-42cf-8bd5-e4792d5d3c14", + "execution_count": 177, + "id": "280f79d2-ed38-419d-be89-653167b1efec", "metadata": {}, "outputs": [], "source": [ - "major_bus = major_bus.dropna(subset=['geometry'])" + "# major_bus = major_bus.dropna(subset=['geometry'])\n", + "\n", + "# major_bus.apply(explode_geoms, axis=1)\n", + "\n", + "# row_per_stop = row_per_stop.reset_index(drop=True)\n", + "\n", + "# row_per_stop = row_per_stop[['calitp_itp_id', 'stop_id', 'geometry']]\n", + "\n", + "# row_per_stop['hqta_type'] = 'major_transit_stop'\n", + "\n", + "# row_per_stop = row_per_stop.set_crs('EPSG:6414')" ] }, { "cell_type": "code", - "execution_count": 30, - "id": "2df43e17-9ca0-4c46-b6a1-92d77ec98d3a", - "metadata": { - "tags": [] - }, + "execution_count": 178, + "id": "d01200cc-cda2-4635-af68-3b8448e70b5a", + "metadata": {}, + "outputs": [], + "source": [ + "# row_per_stop.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 179, + "id": "5bbfaa07-f16c-46a9-ae5e-338a5b7f5d8b", + "metadata": {}, + "outputs": [], + "source": [ + "# geoparquet_gcs_export(row_per_stop, 'major_bus_stops')" + ] + }, + { + "cell_type": "code", + "execution_count": 180, + "id": "87dbcdc7-79f0-48e4-91d4-647cdb087cf5", + "metadata": {}, + "outputs": [], + "source": [ + "major_bus_stops = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 181, + "id": "e3e8c306-a89f-438f-8f0e-5e165e257cb6", + "metadata": {}, "outputs": [ { "data": { @@ -500,287 +451,88 @@ " \n", " \n", " \n", - " hq_transit_corr\n", - " shape_id\n", - " geometry\n", - " level_0\n", " calitp_itp_id\n", - " hqta_segment_id\n", - " n_trips\n", - " segment_sequence\n", " stop_id\n", - " am_peak\n", - " pm_peak\n", + " geometry\n", " hqta_type\n", " \n", " \n", " \n", " \n", - " 2464\n", - " True\n", - " 0500\n", - " POINT (193061.249 -465491.440)\n", - " 0\n", + " 0\n", " 142\n", - " 2197551287\n", - " 134.0\n", - " 0\n", " 3977\n", - " 9.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2467\n", - " True\n", - " 100706_SEPT21\n", - " POINT (149243.534 -435856.085)\n", - " 0\n", - " 182\n", - " 2368710740\n", - " 120.0\n", - " 1\n", - " 16374\n", - " 6.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2468\n", - " True\n", - " 100708_SEPT21\n", - " POINT (159441.767 -444289.585)\n", - " 3\n", - " 182\n", - " 2883785450\n", - " 72.0\n", - " 3\n", - " 9785\n", - " 4.7\n", - " 4.7\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2471\n", - " True\n", - " 1020067_SEPT21\n", - " POINT (150511.825 -447354.169)\n", - " 3\n", - " 182\n", - " 2238923216\n", - " 115.0\n", - " 4\n", - " 11283\n", - " 8.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2475\n", - " True\n", - " 103717\n", - " POINT (-178950.630 -71003.248)\n", - " 1\n", - " 294\n", - " 2280977661\n", - " 136.0\n", - " 3\n", - " 480\n", - " 7.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " \n", - " \n", - " 3231\n", - " True\n", - " shp-73-01\n", - " POINT (-194726.607 -31504.765)\n", - " 0\n", - " 4\n", - " 1652690359\n", - " 220.0\n", - " 0\n", - " 3708\n", - " 9.3\n", - " 11.7\n", - " hq_transit_corr\n", - " \n", - " \n", - " 3232\n", - " True\n", - " shp-73-51\n", - " POINT (-194726.607 -31504.765)\n", - " 0\n", - " 4\n", - " 1682558812\n", - " 238.0\n", - " 0\n", - " 2712\n", - " 13.3\n", - " 10.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 3236\n", - " True\n", - " shp-88-07\n", - " POINT (-200443.266 -13810.682)\n", - " 1\n", - " 4\n", - " 3310950755\n", - " 83.0\n", - " 1\n", - " 2026\n", - " 4.7\n", - " 5.0\n", - " hq_transit_corr\n", + " POINT (199058.382 -471125.032)\n", + " major_transit_stop\n", " \n", " \n", - " 3238\n", - " True\n", - " shp-97-57\n", - " POINT (-187275.985 -33268.849)\n", - " 0\n", - " 4\n", - " 4254707562\n", - " 80.0\n", - " 0\n", - " 4320\n", - " 4.3\n", - " 4.7\n", - " hq_transit_corr\n", + " 1\n", + " 142\n", + " 3977\n", + " POINT (198531.592 -471368.189)\n", + " major_transit_stop\n", " \n", " \n", - " 3239\n", - " True\n", - " shp-99-08\n", - " POINT (-178261.436 -45851.507)\n", - " 0\n", - " 4\n", - " 3287994159\n", - " 142.0\n", - " 0\n", - " 6243\n", - " 7.7\n", - " 8.0\n", - " hq_transit_corr\n", + " 2\n", + " 142\n", + " 3977\n", + " POINT (193068.693 -465847.391)\n", + " major_transit_stop\n", " \n", " \n", "\n", - "

349 rows × 12 columns

\n", "" ], "text/plain": [ - " hq_transit_corr shape_id geometry \\\n", - "2464 True 0500 POINT (193061.249 -465491.440) \n", - "2467 True 100706_SEPT21 POINT (149243.534 -435856.085) \n", - "2468 True 100708_SEPT21 POINT (159441.767 -444289.585) \n", - "2471 True 1020067_SEPT21 POINT (150511.825 -447354.169) \n", - "2475 True 103717 POINT (-178950.630 -71003.248) \n", - "... ... ... ... \n", - "3231 True shp-73-01 POINT (-194726.607 -31504.765) \n", - "3232 True shp-73-51 POINT (-194726.607 -31504.765) \n", - "3236 True shp-88-07 POINT (-200443.266 -13810.682) \n", - "3238 True shp-97-57 POINT (-187275.985 -33268.849) \n", - "3239 True shp-99-08 POINT (-178261.436 -45851.507) \n", - "\n", - " level_0 calitp_itp_id hqta_segment_id n_trips segment_sequence \\\n", - "2464 0 142 2197551287 134.0 0 \n", - "2467 0 182 2368710740 120.0 1 \n", - "2468 3 182 2883785450 72.0 3 \n", - "2471 3 182 2238923216 115.0 4 \n", - "2475 1 294 2280977661 136.0 3 \n", - "... ... ... ... ... ... \n", - "3231 0 4 1652690359 220.0 0 \n", - "3232 0 4 1682558812 238.0 0 \n", - "3236 1 4 3310950755 83.0 1 \n", - "3238 0 4 4254707562 80.0 0 \n", - "3239 0 4 3287994159 142.0 0 \n", - "\n", - " stop_id am_peak pm_peak hqta_type \n", - "2464 3977 9.0 8.0 hq_transit_corr \n", - "2467 16374 6.0 8.0 hq_transit_corr \n", - "2468 9785 4.7 4.7 hq_transit_corr \n", - "2471 11283 8.0 8.0 hq_transit_corr \n", - "2475 480 7.0 8.0 hq_transit_corr \n", - "... ... ... ... ... \n", - "3231 3708 9.3 11.7 hq_transit_corr \n", - "3232 2712 13.3 10.0 hq_transit_corr \n", - "3236 2026 4.7 5.0 hq_transit_corr \n", - "3238 4320 4.3 4.7 hq_transit_corr \n", - "3239 6243 7.7 8.0 hq_transit_corr \n", - "\n", - "[349 rows x 12 columns]" + " calitp_itp_id stop_id geometry hqta_type\n", + "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop\n", + "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop\n", + "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop" ] }, - "execution_count": 30, + "execution_count": 181, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "major_bus.apply(explode_geoms, axis=1)" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "id": "6ab04e63-f673-48d4-bf1a-d01d203f5b33", - "metadata": {}, - "outputs": [], - "source": [ - "row_per_stop = row_per_stop.reset_index(drop=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "id": "92d2df98-49d9-4786-bd53-df2ddc107354", - "metadata": {}, - "outputs": [], - "source": [ - "row_per_stop = row_per_stop[['calitp_itp_id', 'stop_id', 'geometry']]" + "major_bus_stops.head(3)" ] }, { "cell_type": "code", - "execution_count": 33, - "id": "faaa147d-ae1e-4b9b-a7a2-ff462a3c66fd", + "execution_count": 182, + "id": "24daf28c-943a-4a9f-871c-e11b5d761595", "metadata": {}, "outputs": [], "source": [ - "row_per_stop['hqta_type'] = 'major_transit_stop'" + "tbl_stops = (tbl.views.gtfs_schedule_fact_daily_feed_stops()\n", + " >> filter(_.date == '2021-12-01')\n", + " >> filter(_.calitp_extracted_at < '2021-12-01')\n", + " >> filter(_.calitp_deleted_at > '2021-12-01')\n", + " >> select(_.stop_key)\n", + " >> inner_join(_, tbl.views.gtfs_schedule_dim_stops(), on = 'stop_key')\n", + " >> select(_.stop_id, _.stop_lat, _.stop_lon, _.calitp_itp_id)\n", + " >> collect()\n", + ")" ] }, { "cell_type": "code", - "execution_count": 34, - "id": "3e574e12-8017-4867-9230-8fa891e914bb", + "execution_count": 183, + "id": "cddf70f5-cca1-4896-9f52-1ea5004278e5", "metadata": {}, "outputs": [], "source": [ - "row_per_stop = row_per_stop.set_crs('EPSG:6414')" + "tbl_stops = gpd.GeoDataFrame(tbl_stops,\n", + " geometry = gpd.points_from_xy(tbl_stops.stop_lon, tbl_stops.stop_lat),\n", + " crs = 'EPSG:4326').to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)" ] }, { "cell_type": "code", - "execution_count": 35, - "id": "d01200cc-cda2-4635-af68-3b8448e70b5a", + "execution_count": 184, + "id": "27ec75fc-e017-4f98-96f8-94d8d6ca479e", "metadata": {}, "outputs": [ { @@ -804,141 +556,1606 @@ " \n", " \n", " \n", - " calitp_itp_id\n", " stop_id\n", + " stop_lat\n", + " stop_lon\n", + " calitp_itp_id\n", " geometry\n", - " hqta_type\n", " \n", " \n", " \n", " \n", " 0\n", - " 142\n", - " 3977\n", - " POINT (199058.382 -471125.032)\n", - " major_transit_stop\n", + " 5090\n", + " 36.080261\n", + " -119.021684\n", + " 256\n", + " POINT (87996.619 -214744.271)\n", " \n", " \n", " 1\n", - " 142\n", - " 3977\n", - " POINT (198531.592 -471368.189)\n", - " major_transit_stop\n", + " 8050\n", + " 36.061094\n", + " -118.994880\n", + " 256\n", + " POINT (90430.048 -216848.624)\n", " \n", " \n", " 2\n", - " 142\n", - " 3977\n", - " POINT (193068.693 -465847.391)\n", - " major_transit_stop\n", + " 1100\n", + " 36.073048\n", + " -119.020918\n", + " 256\n", + " POINT (88073.792 -215544.973)\n", " \n", " \n", "\n", "" ], "text/plain": [ - " calitp_itp_id stop_id geometry hqta_type\n", - "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop\n", - "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop\n", - "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop" + " stop_id stop_lat stop_lon calitp_itp_id geometry\n", + "0 5090 36.080261 -119.021684 256 POINT (87996.619 -214744.271)\n", + "1 8050 36.061094 -118.994880 256 POINT (90430.048 -216848.624)\n", + "2 1100 36.073048 -119.020918 256 POINT (88073.792 -215544.973)" ] }, - "execution_count": 35, + "execution_count": 184, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "row_per_stop.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "id": "5bbfaa07-f16c-46a9-ae5e-338a5b7f5d8b", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], - "source": [ - "geoparquet_gcs_export(row_per_stop, 'major_bus_stops')" + "tbl_stops.head(3)" ] }, { "cell_type": "code", - "execution_count": 24, - "id": "dcccae17-5f35-4fc4-a5dc-0e5cf45e2f25", + "execution_count": 185, + "id": "d5a65203-2245-4ea4-94d3-71685a00c929", "metadata": {}, "outputs": [], "source": [ - "# major_bus_operators = [int(x) for x in list(major_bus.calitp_itp_id.astype(int).unique())]" + "to_join = major_bus_stops[['calitp_itp_id']].astype({'calitp_itp_id': 'int64'})" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 186, "id": "19f9b7dd-1b2b-4c7a-9ba9-3e1e1e9b46be", "metadata": { "tags": [] }, "outputs": [], "source": [ - "# tbl_stops = (tbl.gtfs_schedule.stops() \n", - "# >> filter(_.calitp_itp_id.isin(major_bus_operators))\n", - "# >> select(_.stop_id, _.stop_lat, _.stop_lon, _.calitp_itp_id)\n", - "# >> collect()\n", - "# )\n", - "# tbl_stops = gpd.GeoDataFrame(tbl_stops,\n", - "# geometry = gpd.points_from_xy(tbl_stops.stop_lon, tbl_stops.stop_lat),\n", - "# crs = 'EPSG:4326').to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "7d959fef-e315-4985-b3fd-72192096a691", - "metadata": {}, - "outputs": [], - "source": [ - "# def join_stops(df):\n", - "# stops_filtered = tbl_stops >> filter(_.calitp_itp_id == int(df.calitp_itp_id.iloc[0]))\n", - "# df = row_per_stop.sjoin(stops_filtered, how='inner', predicate='contains')\n", - "# return df" + "tbl_stops_major = (tbl_stops\n", + " >> inner_join(_, to_join, on=['calitp_itp_id'])\n", + " >> distinct(_.calitp_itp_id, _.stop_id, _keep_all=True)\n", + " )\n" ] }, { "cell_type": "code", - "execution_count": 27, - "id": "909f1b0f-0d99-4713-90e5-cf86e7bcab1e", - "metadata": {}, - "outputs": [], - "source": [ - "# join_to_stop = row_per_stop.groupby('calitp_itp_id').apply(join_stops)" - ] - }, - { - "cell_type": "markdown", - "id": "f1ac0f78-6b99-4079-8c26-ca875367f6a8", + "execution_count": 187, + "id": "5410b54c-930f-4d88-982a-4275a90334d4", "metadata": {}, - "source": [ - "#### Definitions and Output:\n", - "\n", - "* hqta_type: major_transit_stop\n", - "* stop_id: one stop id... (not ideal, but oh well)\n", - "* geometry: .buffer(700)?\n", - "* _can alway pull more info spatially_" + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
0397137.976371-122.3196634POINT (-203473.763 -1956.750)
1205037.789595-122.2458004POINT (-197487.747 -22870.228)
2344537.767420-122.1963754POINT (-193199.376 -25436.510)
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id \\\n", + "0 3971 37.976371 -122.319663 4 \n", + "1 2050 37.789595 -122.245800 4 \n", + "2 3445 37.767420 -122.196375 4 \n", + "\n", + " geometry \n", + "0 POINT (-203473.763 -1956.750) \n", + "1 POINT (-197487.747 -22870.228) \n", + "2 POINT (-193199.376 -25436.510) " + ] + }, + "execution_count": 187, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tbl_stops_major.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 188, + "id": "9a9987a0-74c2-4018-99d6-bc68ecbb292a", + "metadata": {}, + "outputs": [], + "source": [ + "tbl_stops_major.geometry = tbl_stops_major.buffer(100)" + ] + }, + { + "cell_type": "code", + "execution_count": 189, + "id": "ee7ff27d-6ffc-4458-bd95-5aa5c8a9a57e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
0397137.976371-122.3196634POLYGON ((-203373.763 -1956.750, -203374.244 -...
1205037.789595-122.2458004POLYGON ((-197387.747 -22870.228, -197388.229 ...
2344537.767420-122.1963754POLYGON ((-193099.376 -25436.510, -193099.857 ...
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id \\\n", + "0 3971 37.976371 -122.319663 4 \n", + "1 2050 37.789595 -122.245800 4 \n", + "2 3445 37.767420 -122.196375 4 \n", + "\n", + " geometry \n", + "0 POLYGON ((-203373.763 -1956.750, -203374.244 -... \n", + "1 POLYGON ((-197387.747 -22870.228, -197388.229 ... \n", + "2 POLYGON ((-193099.376 -25436.510, -193099.857 ... " + ] + }, + "execution_count": 189, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tbl_stops_major.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 190, + "id": "1ac15d0a-1aeb-48c4-9acf-92b7642b6fcd", + "metadata": {}, + "outputs": [], + "source": [ + "drop_id = major_bus_stops.drop(columns=['stop_id'])" + ] + }, + { + "cell_type": "code", + "execution_count": 191, + "id": "e1d0d729-4931-4020-bfd6-4c15818caff0", + "metadata": {}, + "outputs": [], + "source": [ + "spatial_stops_major = tbl_stops_major.sjoin(drop_id, how='inner', predicate='contains')" + ] + }, + { + "cell_type": "code", + "execution_count": 192, + "id": "b593d95a-308f-4635-9ce5-f24bbdd164e6", + "metadata": {}, + "outputs": [], + "source": [ + "new_major_stops = spatial_stops_major.drop_duplicates(subset=['stop_id', 'calitp_itp_id_left', 'calitp_itp_id_right'])" + ] + }, + { + "cell_type": "code", + "execution_count": 193, + "id": "46241013-0529-40c7-a8d9-3002637a4240", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/geodataframe.py:1351: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " super().__setitem__(key, value)\n" + ] + } + ], + "source": [ + "new_major_stops.geometry = new_major_stops.centroid" + ] + }, + { + "cell_type": "code", + "execution_count": 194, + "id": "ed5c5734-7ede-4211-a61b-f22eec81686a", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(new_major_stops)" + ] + }, + { + "cell_type": "markdown", + "id": "99a33ab8-c664-4671-89ef-54cdff7462f2", + "metadata": {}, + "source": [ + "### Bus Corridors to Stops Along Corridor" + ] + }, + { + "cell_type": "code", + "execution_count": 195, + "id": "6943606a-d815-49c6-aa43-a7ab27285939", + "metadata": {}, + "outputs": [], + "source": [ + "tbl_stops_corridors = tbl_stops" + ] + }, + { + "cell_type": "code", + "execution_count": 196, + "id": "bf2f1177-b087-416c-8ae4-3f3f3569da55", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
0509036.080261-119.021684256POINT (87996.619 -214744.271)
1805036.061094-118.994880256POINT (90430.048 -216848.624)
2110036.073048-119.020918256POINT (88073.792 -215544.973)
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id geometry\n", + "0 5090 36.080261 -119.021684 256 POINT (87996.619 -214744.271)\n", + "1 8050 36.061094 -118.994880 256 POINT (90430.048 -216848.624)\n", + "2 1100 36.073048 -119.020918 256 POINT (88073.792 -215544.973)" + ] + }, + "execution_count": 196, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tbl_stops_corridors.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 197, + "id": "eda55a78-d4c5-47cc-8012-ac2d1fa4a92f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idhqta_typegeometry
22564812f4ecb6-c161-480e-8ec2-d7e3b63c7e38hq_corridor_busPOLYGON ((-133311.510 166655.910, -133353.419 ...
22571424654hq_corridor_busPOLYGON ((212373.929 -486798.063, 212402.264 -...
22581426679hq_corridor_busMULTIPOLYGON (((200815.723 -472198.343, 200811...
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id hqta_type \\\n", + "2256 48 12f4ecb6-c161-480e-8ec2-d7e3b63c7e38 hq_corridor_bus \n", + "2257 142 4654 hq_corridor_bus \n", + "2258 142 6679 hq_corridor_bus \n", + "\n", + " geometry \n", + "2256 POLYGON ((-133311.510 166655.910, -133353.419 ... \n", + "2257 POLYGON ((212373.929 -486798.063, 212402.264 -... \n", + "2258 MULTIPOLYGON (((200815.723 -472198.343, 200811... " + ] + }, + "execution_count": 197, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bus_hqtc_extract.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 198, + "id": "c161a6c5-bd29-4f0e-aaa2-f83731af42d4", + "metadata": {}, + "outputs": [], + "source": [ + "stops_in_corridor = tbl_stops_corridors.clip(bus_hqtc_extract)" + ] + }, + { + "cell_type": "code", + "execution_count": 199, + "id": "83da99fb-4d2c-438b-bf24-65ce726fba0a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 32894 entries, 26531 to 121250\n", + "Data columns (total 5 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 stop_id 32894 non-null object \n", + " 1 stop_lat 32894 non-null float64 \n", + " 2 stop_lon 32894 non-null float64 \n", + " 3 calitp_itp_id 32894 non-null int64 \n", + " 4 geometry 32894 non-null geometry\n", + "dtypes: float64(2), geometry(1), int64(1), object(1)\n", + "memory usage: 1.5+ MB\n" + ] + } + ], + "source": [ + "stops_in_corridor.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 200, + "id": "82657639-7ad8-43e2-9050-7b49b0da0799", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 32009 entries, 26531 to 121250\n", + "Data columns (total 5 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 stop_id 32009 non-null object \n", + " 1 stop_lat 32009 non-null float64 \n", + " 2 stop_lon 32009 non-null float64 \n", + " 3 calitp_itp_id 32009 non-null int64 \n", + " 4 geometry 32009 non-null geometry\n", + "dtypes: float64(2), geometry(1), int64(1), object(1)\n", + "memory usage: 1.5+ MB\n" + ] + } + ], + "source": [ + "stops_in_corridor.drop_duplicates(subset = ['stop_id', 'calitp_itp_id']).info()" + ] + }, + { + "cell_type": "code", + "execution_count": 201, + "id": "7fbca026-79dc-4249-a6fb-9ee436a422cc", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(bus_hqtc_extract)" + ] + }, + { + "cell_type": "code", + "execution_count": 202, + "id": "d10d08e6-2166-4d74-9b21-40181da5f19e", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(stops_in_corridor)" + ] + }, + { + "cell_type": "markdown", + "id": "f1ac0f78-6b99-4079-8c26-ca875367f6a8", + "metadata": {}, + "source": [ + "#### Definitions and Output:\n", + "\n", + "* hqta_type: major_transit_stop\n", + "* stop_id: one stop id... (not ideal, but oh well)\n", + "* geometry: .buffer(700)?\n", + "* _can alway pull more info spatially_" + ] + }, + { + "cell_type": "markdown", + "id": "03d81f0e-da43-4116-ae9b-b094b1466f2b", + "metadata": {}, + "source": [ + "## Unbuffered Export" + ] + }, + { + "cell_type": "markdown", + "id": "403c2790-2f47-4b3f-9740-443020721a0b", + "metadata": {}, + "source": [ + "Thank you for this data. It would be useful for us to get the HQTC stops as a point data file, not a polygon. Also, if you could differentiate between train, bus, BRT, and ferry stop that would be immensely helpful.\n", + "\n", + "Let me know if it is possible to get the data in this format. " + ] + }, + { + "cell_type": "markdown", + "id": "baa2a7f4-5212-4911-9e6e-1e9bfc2f1d59", + "metadata": {}, + "source": [ + "#### Major Transit Stops (bus intersections)" + ] + }, + { + "cell_type": "code", + "execution_count": 203, + "id": "a4188f4e-5b5f-44d6-b3be-e8ed70fd8e64", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_id_leftgeometryindex_rightcalitp_itp_id_righthqta_type
1205037.789595-122.2458004POINT (-197487.747 -22870.228)18734major_transit_stop
661616037.789312-122.2457844POINT (-197487.086 -22901.713)18734major_transit_stop
868604437.789646-122.2461174POINT (-197515.484 -22863.900)18734major_transit_stop
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id_left \\\n", + "1 2050 37.789595 -122.245800 4 \n", + "661 6160 37.789312 -122.245784 4 \n", + "868 6044 37.789646 -122.246117 4 \n", + "\n", + " geometry index_right calitp_itp_id_right \\\n", + "1 POINT (-197487.747 -22870.228) 1873 4 \n", + "661 POINT (-197487.086 -22901.713) 1873 4 \n", + "868 POINT (-197515.484 -22863.900) 1873 4 \n", + "\n", + " hqta_type \n", + "1 major_transit_stop \n", + "661 major_transit_stop \n", + "868 major_transit_stop " + ] + }, + "execution_count": 203, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_major_stops.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 204, + "id": "c5a8d5cb-fd72-4dbf-85bb-a76996d567eb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idcalitp_itp_id_2hqta_typegeometry
1420504major_stop_busPOINT (-197487.747 -22870.228)
661461604major_stop_busPOINT (-197487.086 -22901.713)
868460444major_stop_busPOINT (-197515.484 -22863.900)
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id calitp_itp_id_2 hqta_type \\\n", + "1 4 2050 4 major_stop_bus \n", + "661 4 6160 4 major_stop_bus \n", + "868 4 6044 4 major_stop_bus \n", + "\n", + " geometry \n", + "1 POINT (-197487.747 -22870.228) \n", + "661 POINT (-197487.086 -22901.713) \n", + "868 POINT (-197515.484 -22863.900) " + ] + }, + "execution_count": 204, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_major_bus_extract = new_major_stops >> select(_.calitp_itp_id == _.calitp_itp_id_left, _.stop_id,\n", + " _.calitp_itp_id_2 == _.calitp_itp_id_right, _.hqta_type, _.geometry\n", + " )\n", + "new_major_bus_extract['hqta_type'] = 'major_stop_bus'\n", + "new_major_bus_extract.head(3)" + ] + }, + { + "cell_type": "markdown", + "id": "e9a0e81f-b16b-4fab-82e6-f7eb84999ee9", + "metadata": {}, + "source": [ + "#### Stops Along HQ Transit Corridors (bus)" + ] + }, + { + "cell_type": "code", + "execution_count": 205, + "id": "644055ed-ab86-4e07-80fb-0c17a457b8f4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
2653126234.420949-119.703600293POINT (27236.798 -399421.201)
66308S8034.421013-119.703516169POINT (27244.495 -399414.075)
2677611334.420955-119.670648293POINT (30264.810 -399410.543)
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id \\\n", + "26531 262 34.420949 -119.703600 293 \n", + "66308 S80 34.421013 -119.703516 169 \n", + "26776 113 34.420955 -119.670648 293 \n", + "\n", + " geometry \n", + "26531 POINT (27236.798 -399421.201) \n", + "66308 POINT (27244.495 -399414.075) \n", + "26776 POINT (30264.810 -399410.543) " + ] + }, + "execution_count": 205, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "stops_in_corridor.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 206, + "id": "e3fe89fe-f38c-4209-80da-b1a7ec950933", + "metadata": {}, + "outputs": [], + "source": [ + "stops_extract = stops_in_corridor >> select(_.calitp_itp_id, _.stop_id, _.geometry)" + ] + }, + { + "cell_type": "code", + "execution_count": 207, + "id": "62591143-ce91-408a-86a7-67d993a64205", + "metadata": {}, + "outputs": [], + "source": [ + "stops_extract['hqta_type'] = 'hq_corridor_bus'" + ] + }, + { + "cell_type": "code", + "execution_count": 208, + "id": "283ddc23-5a5f-4606-ab30-72341ee890cb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idgeometryhqta_type
26531293262POINT (27236.798 -399421.201)hq_corridor_bus
66308169S80POINT (27244.495 -399414.075)hq_corridor_bus
26776293113POINT (30264.810 -399410.543)hq_corridor_bus
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id geometry hqta_type\n", + "26531 293 262 POINT (27236.798 -399421.201) hq_corridor_bus\n", + "66308 169 S80 POINT (27244.495 -399414.075) hq_corridor_bus\n", + "26776 293 113 POINT (30264.810 -399410.543) hq_corridor_bus" + ] + }, + "execution_count": 208, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "stops_extract.head(3)" + ] + }, + { + "cell_type": "markdown", + "id": "3d90eef5-3b4d-4c6a-96c9-e40a2855a260", + "metadata": {}, + "source": [ + "#### Major Transit Stops (rail/ferry/brt)" + ] + }, + { + "cell_type": "code", + "execution_count": 209, + "id": "5138b1e6-4c99-4ff1-b672-89d5f5a484e2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometryhqta_type
106618218010133.768071-118.1929210POINT (167426.752 -470294.073)major_transit_stop
107818218015333.768740-118.1893620POINT (167755.039 -470213.608)major_transit_stop
107618218010233.772258-118.1937000POINT (167345.741 -469831.223)major_transit_stop
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "1066 182 1 80101 33.768071 -118.192921 \n", + "1078 182 1 80153 33.768740 -118.189362 \n", + "1076 182 1 80102 33.772258 -118.193700 \n", + "\n", + " route_type geometry hqta_type \n", + "1066 0 POINT (167426.752 -470294.073) major_transit_stop \n", + "1078 0 POINT (167755.039 -470213.608) major_transit_stop \n", + "1076 0 POINT (167345.741 -469831.223) major_transit_stop " + ] + }, + "execution_count": 209, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 210, + "id": "8a269cf5-fb38-467f-b31d-8c98c2aed684", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_extract = rail_ferry_brt_stops >> select(_.calitp_itp_id == _.calitp_itp_id, _.stop_id,\n", + " _.hqta_type, _.route_type, _.geometry\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": 211, + "id": "154b935a-5c1b-48d9-a44b-d276ade8b4ae", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_extract = (rail_ferry_brt_extract\n", + " >> mutate(\n", + " hqta_type = case_when({\n", + " _.route_type.isin(['0', '1', '2']): 'major_stop_rail',\n", + " _.route_type == '3': 'major_stop_brt',\n", + " _.route_type == '4': 'major_stop_ferry'\n", + " })\n", + " )\n", + " >> select(-_.route_type)\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 212, + "id": "795f12d4-f881-4d72-adf2-69a4276084e9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idhqta_typegeometry
106618280101major_stop_railPOINT (167426.752 -470294.073)
107818280153major_stop_railPOINT (167755.039 -470213.608)
107618280102major_stop_railPOINT (167345.741 -469831.223)
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id hqta_type geometry\n", + "1066 182 80101 major_stop_rail POINT (167426.752 -470294.073)\n", + "1078 182 80153 major_stop_rail POINT (167755.039 -470213.608)\n", + "1076 182 80102 major_stop_rail POINT (167345.741 -469831.223)" + ] + }, + "execution_count": 212, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_extract.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 213, + "id": "45f7684d-af37-4e66-bfec-e5e5d4b1d2c4", + "metadata": {}, + "outputs": [], + "source": [ + "points_combined = new_major_bus_extract.append(stops_extract).append(rail_ferry_brt_extract)" + ] + }, + { + "cell_type": "code", + "execution_count": 214, + "id": "f74db8b5-c1c2-4f68-88d8-89964d2a7179", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "calitp_itp_id int64\n", + "stop_id object\n", + "calitp_itp_id_2 object\n", + "hqta_type object\n", + "geometry geometry\n", + "dtype: object" + ] + }, + "execution_count": 214, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "points_combined.dtypes" + ] + }, + { + "cell_type": "code", + "execution_count": 215, + "id": "c767a0e4-e8c5-4967-b223-c982717de70c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idcalitp_itp_id_2hqta_typegeometry
1420504major_stop_busPOINT (-197487.747 -22870.228)
661461604major_stop_busPOINT (-197487.086 -22901.713)
868460444major_stop_busPOINT (-197515.484 -22863.900)
4378461614major_stop_busPOINT (-197544.479 -22958.955)
6453074major_stop_busPOINT (-189006.213 -28181.062)
..................
42328295NaNmajor_stop_brtPOINT (246407.338 -422724.364)
172328288NaNmajor_stop_brtPOINT (243453.358 -421760.464)
996323165NaNmajor_stop_railPOINT (172732.681 -389214.320)
34213VRVNaNmajor_stop_railPOINT (248354.060 -383016.649)
994323163NaNmajor_stop_railPOINT (172437.092 -378906.434)
\n", + "

37473 rows × 5 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id calitp_itp_id_2 hqta_type \\\n", + "1 4 2050 4 major_stop_bus \n", + "661 4 6160 4 major_stop_bus \n", + "868 4 6044 4 major_stop_bus \n", + "4378 4 6161 4 major_stop_bus \n", + "6 4 5307 4 major_stop_bus \n", + "... ... ... ... ... \n", + "4 232 8295 NaN major_stop_brt \n", + "17 232 8288 NaN major_stop_brt \n", + "996 323 165 NaN major_stop_rail \n", + "342 13 VRV NaN major_stop_rail \n", + "994 323 163 NaN major_stop_rail \n", + "\n", + " geometry \n", + "1 POINT (-197487.747 -22870.228) \n", + "661 POINT (-197487.086 -22901.713) \n", + "868 POINT (-197515.484 -22863.900) \n", + "4378 POINT (-197544.479 -22958.955) \n", + "6 POINT (-189006.213 -28181.062) \n", + "... ... \n", + "4 POINT (246407.338 -422724.364) \n", + "17 POINT (243453.358 -421760.464) \n", + "996 POINT (172732.681 -389214.320) \n", + "342 POINT (248354.060 -383016.649) \n", + "994 POINT (172437.092 -378906.434) \n", + "\n", + "[37473 rows x 5 columns]" + ] + }, + "execution_count": 215, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "points_combined" + ] + }, + { + "cell_type": "code", + "execution_count": 161, + "id": "1eaa13fb-88d9-4f5f-ac07-5a5711f974db", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(points_combined)" + ] + }, + { + "cell_type": "code", + "execution_count": 224, + "id": "f7d2d824-f02a-450c-a18f-baa4f4b4c8b3", + "metadata": {}, + "outputs": [], + "source": [ + "names = tbl.views.gtfs_agency_names() >> select(_.calitp_itp_id, _.agency_name) >> collect()\n", + "with_names = points_combined >> inner_join(_, names, on = 'calitp_itp_id')" + ] + }, + { + "cell_type": "code", + "execution_count": 231, + "id": "f5597551-8553-446b-9f1d-4c9996be932c", + "metadata": {}, + "outputs": [], + "source": [ + "with_names = with_names.drop_duplicates(subset=['calitp_itp_id', 'hqta_type', 'stop_id'])\n", + "with_names = with_names.drop(columns=['calitp_itp_id_2'])" + ] + }, + { + "cell_type": "code", + "execution_count": 233, + "id": "8babf759-70b5-43ca-913b-f3a4f594c30f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idhqta_typegeometryagency_name
042050major_stop_busPOINT (-197487.747 -22870.228)AC Transit
146160major_stop_busPOINT (-197487.086 -22901.713)AC Transit
246044major_stop_busPOINT (-197515.484 -22863.900)AC Transit
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id hqta_type geometry \\\n", + "0 4 2050 major_stop_bus POINT (-197487.747 -22870.228) \n", + "1 4 6160 major_stop_bus POINT (-197487.086 -22901.713) \n", + "2 4 6044 major_stop_bus POINT (-197515.484 -22863.900) \n", + "\n", + " agency_name \n", + "0 AC Transit \n", + "1 AC Transit \n", + "2 AC Transit " + ] + }, + "execution_count": 233, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "with_names.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 234, + "id": "136b178e-edc6-4492-a8d9-1a97080f48f2", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], + "source": [ + "geoparquet_gcs_export(with_names, 'ca_high_quality_transit_points')" + ] + }, + { + "cell_type": "code", + "execution_count": 235, + "id": "b7cc3286-aa84-4b66-acba-4935481e1650", + "metadata": {}, + "outputs": [], + "source": [ + "with_names.to_file('./ca_high_quality_transit_point.geojson', driver='GeoJSON')" + ] + }, + { + "cell_type": "code", + "execution_count": 236, + "id": "abd4b07a-6804-4f80-9377-ca34208b5e78", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/tmp/ipykernel_44/2615873071.py:1: UserWarning: Column names longer than 10 characters will be truncated when saved to ESRI Shapefile.\n", + " with_names.to_file('./ca_high_quality_transit/ca_high_quality_transit_point.shp')\n" + ] + } + ], + "source": [ + "with_names.to_file('./ca_high_quality_transit/ca_high_quality_transit_point.shp')" + ] + }, + { + "cell_type": "code", + "execution_count": 237, + "id": "62bf6074-7796-4fee-9ea7-9a4d67f438a1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['major_stop_bus', 'hq_corridor_bus', 'major_stop_brt',\n", + " 'major_stop_rail', 'major_stop_ferry'], dtype=object)" + ] + }, + "execution_count": 237, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "with_names['hqta_type'].unique()" ] }, { From 3042f093bba2f0f8417dd432a1be09fb6620f5c2 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Sat, 11 Dec 2021 01:24:32 +0000 Subject: [PATCH 07/24] refactor and split nb for clarity --- .../service_increase_estimator.ipynb | 2235 ++++++++++++++++- .../tract_categorization.ipynb | 966 +++---- 2 files changed, 2448 insertions(+), 753 deletions(-) diff --git a/bus_service_increase/service_increase_estimator.ipynb b/bus_service_increase/service_increase_estimator.ipynb index d977d71fb..ac1363f29 100644 --- a/bus_service_increase/service_increase_estimator.ipynb +++ b/bus_service_increase/service_increase_estimator.ipynb @@ -5,35 +5,63 @@ "execution_count": 1, "id": "bd023d1c-c77f-47e6-b58d-92666ff7335e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", "from siuba import *\n", "\n", "import pandas as pd\n", + "ix = pd.IndexSlice\n", "import numpy as np\n", "import geopandas as gpd\n", "\n", "from calenviroscreen_utils import *\n", "from utils import *\n", - "import prep_data" + "import prep_data\n", + "import shared_utils\n", + "\n", + "import shapely\n", + "from shapely.geometry import LineString\n", + "\n", + "import os\n", + "from calitp.storage import get_fs\n", + "fs = get_fs()" ] }, { "cell_type": "code", "execution_count": 2, - "id": "9ba1d111-1dc2-4797-96a3-1c3e60b3ba32", + "id": "4e5e3e74-a240-4446-a67c-5c19c1985dc9", "metadata": {}, "outputs": [], "source": [ - "frequency_funds_tracts = pd.read_parquet(f'{GCS_FILE_PATH}pd_frequency_funds_tracts.parquet')" + "service_funding_joined = pd.read_parquet(f\"{GCS_FILE_PATH}shape_frequency_funding.parquet\")" ] }, { "cell_type": "code", "execution_count": 3, - "id": "c8f7947c-7eef-435d-976b-dd7fad325e33", + "id": "c0aa6a3e-3c01-4b16-bf26-0fef6b4598d2", + "metadata": {}, + "outputs": [], + "source": [ + "service = service_funding_joined >> select(_.calitp_itp_id, _.shape_id, _.day_name, _.departure_hour, _.trips_per_hour, _.mean_runtime_min)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "1ffa3b28-f51f-4bea-ab14-59b27eb481c9", "metadata": {}, "outputs": [ { @@ -59,19 +87,8 @@ " \n", " calitp_itp_id\n", " shape_id\n", - " pct_urban\n", - " pct_suburban\n", - " pct_rural\n", - " pct_max\n", - " tract_type\n", - " ntd_id\n", - " transit_provider\n", - " _5307_funds\n", - " _5311_funds\n", - " operating_expenses_total_2019\n", " day_name\n", " departure_hour\n", - " route_id\n", " trips_per_hour\n", " mean_runtime_min\n", " \n", @@ -79,61 +96,28 @@ " \n", " \n", " 0\n", - " 4\n", - " shp-10-09\n", - " 0.992617\n", - " NaN\n", - " NaN\n", - " 0.992617\n", - " urban\n", - " 90014\n", - " AC Transit\n", - " 43522188.0\n", - " 0.0\n", - " 475468237.0\n", + " 257\n", + " 13737\n", " Thursday\n", " 0\n", - " 10\n", - " 2\n", - " 28.0\n", + " 0\n", + " NaN\n", " \n", " \n", " 1\n", - " 4\n", - " shp-10-09\n", - " 0.992617\n", - " NaN\n", - " NaN\n", - " 0.992617\n", - " urban\n", - " 90014\n", - " AC Transit\n", - " 43522188.0\n", - " 0.0\n", - " 475468237.0\n", + " 257\n", + " 13737\n", " Thursday\n", " 1\n", - " 10\n", " 0\n", " NaN\n", " \n", " \n", " 2\n", - " 4\n", - " shp-10-09\n", - " 0.992617\n", - " NaN\n", - " NaN\n", - " 0.992617\n", - " urban\n", - " 90014\n", - " AC Transit\n", - " 43522188.0\n", - " 0.0\n", - " 475468237.0\n", + " 257\n", + " 13737\n", " Thursday\n", " 2\n", - " 10\n", " 0\n", " NaN\n", " \n", @@ -142,43 +126,2138 @@ "" ], "text/plain": [ - " calitp_itp_id shape_id pct_urban pct_suburban pct_rural pct_max \\\n", - "0 4 shp-10-09 0.992617 NaN NaN 0.992617 \n", - "1 4 shp-10-09 0.992617 NaN NaN 0.992617 \n", - "2 4 shp-10-09 0.992617 NaN NaN 0.992617 \n", + " calitp_itp_id shape_id day_name departure_hour trips_per_hour \\\n", + "0 257 13737 Thursday 0 0 \n", + "1 257 13737 Thursday 1 0 \n", + "2 257 13737 Thursday 2 0 \n", "\n", - " tract_type ntd_id transit_provider _5307_funds _5311_funds \\\n", - "0 urban 90014 AC Transit 43522188.0 0.0 \n", - "1 urban 90014 AC Transit 43522188.0 0.0 \n", - "2 urban 90014 AC Transit 43522188.0 0.0 \n", + " mean_runtime_min \n", + "0 NaN \n", + "1 NaN \n", + "2 NaN " + ] + }, + "execution_count": 4, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "service.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "cb2b5b15-ec2a-4888-9e93-84237da326cb", + "metadata": {}, + "outputs": [], + "source": [ + "processed_shapes = gpd.read_parquet(f'{GCS_FILE_PATH}shapes_processed.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "0292c665-88f0-42d0-8784-8e5a8e55a169", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idshape_idtract_type
025713737urban
125713738suburban
2259p_110998suburban
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id shape_id tract_type\n", + "0 257 13737 urban\n", + "1 257 13738 suburban\n", + "2 259 p_110998 suburban" ] }, - "execution_count": 3, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "frequency_funds_tracts.head(3)" + "tracts_categorized = processed_shapes >> select(_.calitp_itp_id, _.shape_id, _.tract_type)\n", + "tracts_categorized.head(3)" ] }, { "cell_type": "code", - "execution_count": null, - "id": "cb2b5b15-ec2a-4888-9e93-84237da326cb", + "execution_count": 7, + "id": "ba423347-ce34-41fa-b002-3465747d0f7d", + "metadata": {}, + "outputs": [], + "source": [ + "service_tract_type = service >> inner_join(_, tracts_categorized, on = ['calitp_itp_id', 'shape_id'])" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "8984f28c-9b02-49d7-bc6f-f115117206d2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 392112 entries, 0 to 392111\n", + "Data columns (total 7 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 calitp_itp_id 392112 non-null int64 \n", + " 1 shape_id 392112 non-null object \n", + " 2 day_name 392112 non-null object \n", + " 3 departure_hour 392112 non-null int64 \n", + " 4 trips_per_hour 392112 non-null int64 \n", + " 5 mean_runtime_min 87861 non-null float64\n", + " 6 tract_type 386856 non-null object \n", + "dtypes: float64(1), int64(3), object(3)\n", + "memory usage: 23.9+ MB\n" + ] + } + ], + "source": [ + "service_tract_type.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "1ca1c294-9206-47f7-89bc-c9e8c5c876d5", "metadata": {}, "outputs": [], - "source": [] + "source": [ + "service_tract_type = service_tract_type >> filter(_.departure_hour > 4, _.departure_hour < 21) ## filter for performance" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "id": "d542a10d-9672-443a-8f2b-3de44d61be5e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idshape_idday_namedeparture_hourtrips_per_hourmean_runtime_mintract_type
525713737Thursday50NaNurban
625713737Thursday6449.0urban
725713737Thursday7455.0urban
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id shape_id day_name departure_hour trips_per_hour \\\n", + "5 257 13737 Thursday 5 0 \n", + "6 257 13737 Thursday 6 4 \n", + "7 257 13737 Thursday 7 4 \n", + "\n", + " mean_runtime_min tract_type \n", + "5 NaN urban \n", + "6 49.0 urban \n", + "7 55.0 urban " + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "service_tract_type.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "id": "a2dae63f-2601-4adc-8199-61433e9960ab", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idshape_idday_namedeparture_hourtrips_per_hourmean_runtime_mintract_type
525713737Thursday50NaNurban
625713737Thursday6449.0urban
725713737Thursday7455.0urban
825713737Thursday8459.0urban
925713737Thursday9255.0urban
........................
392104251p_298772Sunday160NaNurban
392105251p_298772Sunday170NaNurban
392106251p_298772Sunday180NaNurban
392107251p_298772Sunday190NaNurban
392108251p_298772Sunday200NaNurban
\n", + "

261408 rows × 7 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id shape_id day_name departure_hour trips_per_hour \\\n", + "5 257 13737 Thursday 5 0 \n", + "6 257 13737 Thursday 6 4 \n", + "7 257 13737 Thursday 7 4 \n", + "8 257 13737 Thursday 8 4 \n", + "9 257 13737 Thursday 9 2 \n", + "... ... ... ... ... ... \n", + "392104 251 p_298772 Sunday 16 0 \n", + "392105 251 p_298772 Sunday 17 0 \n", + "392106 251 p_298772 Sunday 18 0 \n", + "392107 251 p_298772 Sunday 19 0 \n", + "392108 251 p_298772 Sunday 20 0 \n", + "\n", + " mean_runtime_min tract_type \n", + "5 NaN urban \n", + "6 49.0 urban \n", + "7 55.0 urban \n", + "8 59.0 urban \n", + "9 55.0 urban \n", + "... ... ... \n", + "392104 NaN urban \n", + "392105 NaN urban \n", + "392106 NaN urban \n", + "392107 NaN urban \n", + "392108 NaN urban \n", + "\n", + "[261408 rows x 7 columns]" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "service_tract_type" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "da71d367-f086-4c60-ac18-4b7c4ec2fe82", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
min_runtime_min
calitp_itp_idshape_id
4shp-10-0928.0
shp-10-1027.0
shp-12-1351.0
\n", + "
" + ], + "text/plain": [ + " min_runtime_min\n", + "calitp_itp_id shape_id \n", + "4 shp-10-09 28.0\n", + " shp-10-10 27.0\n", + " shp-12-13 51.0" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "min_runtimes = service_tract_type.groupby(['calitp_itp_id', 'shape_id'])[['mean_runtime_min']].min()\n", + "min_runtimes = min_runtimes.rename(columns={'mean_runtime_min': 'min_runtime_min'})\n", + "min_runtimes.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "id": "95800f73-a173-4ac6-be0d-a983b62ab133", + "metadata": {}, + "outputs": [], + "source": [ + "service_tract_type = (service_tract_type >> inner_join(_, min_runtimes.reset_index(), on = ['calitp_itp_id', 'shape_id']))" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "id": "9a230da1-a936-46e2-864d-f360ebc37f35", + "metadata": {}, + "outputs": [], + "source": [ + "service_tract_type = service_tract_type.dropna(subset=['tract_type', 'min_runtime_min'])" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "id": "ed0e230b-6e89-4d97-944a-79dfc0299fd8", + "metadata": {}, + "outputs": [], + "source": [ + "## runtime for analysis is the mean runtime for a shape/day/hour for existing service, or the min runtime for new service\n", + "service_tract_type['runtime'] = service_tract_type[['mean_runtime_min', 'min_runtime_min']].max(axis = 1)" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "cd2a1b4c-a5bd-4bfc-9de7-c4fccb00b7f3", + "metadata": {}, + "outputs": [], + "source": [ + "service_tract_type = service_tract_type >> select(-_.mean_runtime_min, -_.min_runtime_min)\n", + "service_tract_type['runtime'] = service_tract_type['runtime'].astype('int64')" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "id": "68d788a1-dd06-4c14-982c-c2c72a0389cd", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 246384 entries, 0 to 261407\n", + "Data columns (total 7 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 calitp_itp_id 246384 non-null int64 \n", + " 1 shape_id 246384 non-null object\n", + " 2 day_name 246384 non-null object\n", + " 3 departure_hour 246384 non-null int64 \n", + " 4 trips_per_hour 246384 non-null int64 \n", + " 5 tract_type 246384 non-null object\n", + " 6 runtime 246384 non-null int64 \n", + "dtypes: int64(4), object(3)\n", + "memory usage: 15.0+ MB\n" + ] + } + ], + "source": [ + "service_tract_type.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "b89230aa-4120-4f56-b6d4-e298f55e8b75", + "metadata": {}, + "outputs": [], + "source": [ + "service_thursday = service_tract_type >> filter(_.day_name == 'Thursday') ## split for performance\n", + "service_weekend = service_tract_type >> filter(_.day_name != 'Thursday')" + ] + }, + { + "cell_type": "markdown", + "id": "1215c3cd-c658-462e-9caf-851bcb9fa473", + "metadata": {}, + "source": [ + "### Calculate Required Increase" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "5ef3fbd8-39e5-4dca-82ce-bf91402a1e99", + "metadata": {}, + "outputs": [], + "source": [ + "target_frequencies = {'urban': 4, 'suburban': 2, 'rural': 1} ## {tract type: target trips per hour}" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "id": "f90370da-10a9-4ec4-8aeb-6fed3385b596", + "metadata": {}, + "outputs": [], + "source": [ + "def calculate_additonal_trips(row, target_frequencies):\n", + " if row.trips_per_hour < target_frequencies[row.tract_type]:\n", + " additional_trips = (target_frequencies[row.tract_type]\n", + " - row.trips_per_hour)\n", + " else:\n", + " additional_trips = 0\n", + " row['additional_trips'] = additional_trips\n", + " return row" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "id": "9cff6cff-728c-4b6c-bc3b-ee96acd4c1a6", + "metadata": {}, + "outputs": [], + "source": [ + "service_thursday = service_thursday.apply(calculate_additonal_trips, axis=1, args=(target_frequencies,))\n", + "service_weekend = service_weekend.apply(calculate_additonal_trips, axis=1, args=(target_frequencies,))" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "id": "54d6ec54-ab57-4bd9-970b-135261845e89", + "metadata": {}, + "outputs": [], + "source": [ + "service_thursday['service_hrs'] = (service_thursday['runtime'] * service_thursday['trips_per_hour']) / 60 ## divide minutes to hours\n", + "service_weekend['service_hrs'] = (service_weekend['runtime'] * service_weekend['trips_per_hour']) / 60\n", + "\n", + "service_thursday['addl_service_hrs'] = (service_thursday['runtime'] * service_thursday['additional_trips']) / 60\n", + "service_weekend['addl_service_hrs'] = (service_weekend['runtime'] * service_weekend['additional_trips']) / 60" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "894b7498-a06d-47c0-8455-3bd5e13c1cd0", + "metadata": {}, + "outputs": [], + "source": [ + "service_thursday['service_hours_annual'] = service_thursday['service_hrs'] * 260 ## weekdays in year (df includes only Th)\n", + "service_thursday['addl_service_hrs_annual'] = service_thursday['addl_service_hrs'] * 260\n", + "\n", + "service_weekend['service_hours_annual'] = service_weekend['service_hrs'] * 52 ## weeks in year, since this df includes Sat and Sun\n", + "service_weekend['addl_service_hrs_annual'] = service_weekend['addl_service_hrs'] * 52" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "72776e30-44c6-4a61-8424-491631a08655", + "metadata": {}, + "outputs": [], + "source": [ + "service_combined = service_thursday.append(service_weekend) >> arrange(_.calitp_itp_id, _.shape_id, _.day_name, _.departure_hour)" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "37f893e7-d6e7-4fd8-b128-4464e6d5a694", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idshape_idday_namedeparture_hourtrips_per_hourtract_typeruntimeadditional_tripsservice_hrsaddl_service_hrsservice_hours_annualaddl_service_hrs_annual
24644shp-10-09Saturday50urban2840.001.8666670.097.066667
24654shp-10-09Saturday62urban3021.001.00000052.052.000000
24664shp-10-09Saturday73urban3211.600.53333383.227.733333
24674shp-10-09Saturday83urban3311.650.55000085.828.600000
24684shp-10-09Saturday93urban3811.900.63333398.832.933333
.......................................
225995473205 OThursday160rural9610.001.6000000.0416.000000
225996473205 OThursday171rural9601.600.000000416.00.000000
225997473205 OThursday180rural9610.001.6000000.0416.000000
225998473205 OThursday190rural9610.001.6000000.0416.000000
225999473205 OThursday200rural9610.001.6000000.0416.000000
\n", + "

246384 rows × 12 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id shape_id day_name departure_hour trips_per_hour \\\n", + "2464 4 shp-10-09 Saturday 5 0 \n", + "2465 4 shp-10-09 Saturday 6 2 \n", + "2466 4 shp-10-09 Saturday 7 3 \n", + "2467 4 shp-10-09 Saturday 8 3 \n", + "2468 4 shp-10-09 Saturday 9 3 \n", + "... ... ... ... ... ... \n", + "225995 473 205 O Thursday 16 0 \n", + "225996 473 205 O Thursday 17 1 \n", + "225997 473 205 O Thursday 18 0 \n", + "225998 473 205 O Thursday 19 0 \n", + "225999 473 205 O Thursday 20 0 \n", + "\n", + " tract_type runtime additional_trips service_hrs addl_service_hrs \\\n", + "2464 urban 28 4 0.00 1.866667 \n", + "2465 urban 30 2 1.00 1.000000 \n", + "2466 urban 32 1 1.60 0.533333 \n", + "2467 urban 33 1 1.65 0.550000 \n", + "2468 urban 38 1 1.90 0.633333 \n", + "... ... ... ... ... ... \n", + "225995 rural 96 1 0.00 1.600000 \n", + "225996 rural 96 0 1.60 0.000000 \n", + "225997 rural 96 1 0.00 1.600000 \n", + "225998 rural 96 1 0.00 1.600000 \n", + "225999 rural 96 1 0.00 1.600000 \n", + "\n", + " service_hours_annual addl_service_hrs_annual \n", + "2464 0.0 97.066667 \n", + "2465 52.0 52.000000 \n", + "2466 83.2 27.733333 \n", + "2467 85.8 28.600000 \n", + "2468 98.8 32.933333 \n", + "... ... ... \n", + "225995 0.0 416.000000 \n", + "225996 416.0 0.000000 \n", + "225997 0.0 416.000000 \n", + "225998 0.0 416.000000 \n", + "225999 0.0 416.000000 \n", + "\n", + "[246384 rows x 12 columns]" + ] + }, + "execution_count": 25, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "service_combined " + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "id": "dce25ba4-10bc-44b9-ae6e-9db200758942", + "metadata": {}, + "outputs": [], + "source": [ + "hours_by_operator = service_combined.groupby(['calitp_itp_id', 'tract_type'])[['addl_service_hrs_annual']].sum()" + ] + }, + { + "cell_type": "markdown", + "id": "ca0b2976-d6a9-41f7-bec7-ebc1a93e6859", + "metadata": {}, + "source": [ + "### Bus Capital Expenditures" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "id": "406d07eb-77ee-44b2-a927-e28d80aa1293", + "metadata": {}, + "outputs": [], + "source": [ + "ntd_metrics_2019 = pd.read_csv(f\"{GCS_FILE_PATH}ntd_metrics_2019.csv\") >> filter(_.State == 'CA')" + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "24dde2ff-0685-4653-80a4-35ef0df37b23", + "metadata": {}, + "outputs": [], + "source": [ + "# ntd_metrics_2019.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 29, + "id": "df1c4e60-4929-445f-bcf6-5053b466674f", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "ntd_metrics_2019 = ntd_metrics_2019[['Agency', 'NTD ID','Mode', 'Vehicle Revenue Hours']]\n", + "ntd_metrics_2019.rename(columns={'NTD ID': 'ntd_id', 'Vehicle Revenue Hours': 'vrh'}, inplace=True)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "a21c6e25-cd3e-4b6f-92af-ddaa7a30fffa", + "metadata": {}, + "outputs": [], + "source": [ + "def fix_vrh(value):\n", + " if type(value) != str:\n", + " return None\n", + " else:\n", + " return value.replace(',', '').strip()" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "id": "d5d63bce-682e-457d-a123-b3cdb32037e4", + "metadata": {}, + "outputs": [], + "source": [ + "ntd_metrics_2019['vrh'] = ntd_metrics_2019['vrh'].apply(fix_vrh).astype('int64')" + ] + }, + { + "cell_type": "code", + "execution_count": 32, + "id": "17b2a789-df30-42ba-9aec-9e6ca0e5d597", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Agencyntd_idModevrh
13Los Angeles County Metropolitan Transportation...90154HR313697
14Los Angeles County Metropolitan Transportation...90154RB110727
15Los Angeles County Metropolitan Transportation...90154LR866517
16Los Angeles County Metropolitan Transportation...90154MB6341989
17Los Angeles County Metropolitan Transportation...90154MB495401
...............
3612Los Angeles County Dept. of Public Works - Len...90275MB3261
3623Los Angeles County Department of Public Works ...90272MB3973
3644Los Angeles County Department of Public Works ...90270MB3667
3669Los Angeles County Dept. of Public Works - Ath...90269MB3262
3678City of Needles, dba: Needles Area Transit9R02-91020MB3412
\n", + "

436 rows × 4 columns

\n", + "
" + ], + "text/plain": [ + " Agency ntd_id Mode \\\n", + "13 Los Angeles County Metropolitan Transportation... 90154 HR \n", + "14 Los Angeles County Metropolitan Transportation... 90154 RB \n", + "15 Los Angeles County Metropolitan Transportation... 90154 LR \n", + "16 Los Angeles County Metropolitan Transportation... 90154 MB \n", + "17 Los Angeles County Metropolitan Transportation... 90154 MB \n", + "... ... ... ... \n", + "3612 Los Angeles County Dept. of Public Works - Len... 90275 MB \n", + "3623 Los Angeles County Department of Public Works ... 90272 MB \n", + "3644 Los Angeles County Department of Public Works ... 90270 MB \n", + "3669 Los Angeles County Dept. of Public Works - Ath... 90269 MB \n", + "3678 City of Needles, dba: Needles Area Transit 9R02-91020 MB \n", + "\n", + " vrh \n", + "13 313697 \n", + "14 110727 \n", + "15 866517 \n", + "16 6341989 \n", + "17 495401 \n", + "... ... \n", + "3612 3261 \n", + "3623 3973 \n", + "3644 3667 \n", + "3669 3262 \n", + "3678 3412 \n", + "\n", + "[436 rows x 4 columns]" + ] + }, + "execution_count": 32, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ntd_metrics_2019" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "9438eaa6-bd22-44f4-acd2-1c10270923ad", + "metadata": {}, + "outputs": [], + "source": [ + "bus_modes = ['CB', 'MB', 'RB', 'TB']" + ] + }, + { + "cell_type": "code", + "execution_count": 34, + "id": "27497b1d-c944-4a44-899c-7d8cfef5d9f0", + "metadata": {}, + "outputs": [], + "source": [ + "total_vrh = ntd_metrics_2019 >> filter(_.Mode.isin(bus_modes)) >> group_by('Agency', 'ntd_id') >> summarize(total_vrh = _.vrh.sum())" + ] + }, + { + "cell_type": "code", + "execution_count": 35, + "id": "31dd60c4-2913-4d18-8ab0-36ba391c2180", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
Agencyntd_idtotal_vrh
0Alameda-Contra Costa Transit District900142058964
1Amador Regional Transit System9R02-9100010972
2Anaheim Transportation Network90211232611
\n", + "
" + ], + "text/plain": [ + " Agency ntd_id total_vrh\n", + "0 Alameda-Contra Costa Transit District 90014 2058964\n", + "1 Amador Regional Transit System 9R02-91000 10972\n", + "2 Anaheim Transportation Network 90211 232611" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "total_vrh.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "id": "446d2dba-f133-4562-95c6-41cb1080d203", + "metadata": {}, + "outputs": [], + "source": [ + "ntd_vehicles_2019 = pd.read_csv(f\"{GCS_FILE_PATH}ntd_vehicles_2019.csv\") >> filter(_.State == 'CA')" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "id": "ba3a1b4c-6046-48be-92bf-4874ad9c66bd", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/pandas/core/frame.py:5039: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " return super().rename(\n", + "/tmp/ipykernel_1384/783502506.py:6: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " ntd_vehicles['bus'] = ntd_vehicles['bus'].str.replace(',', '')\n" + ] + } + ], + "source": [ + "ntd_vehicles = ntd_vehicles_2019[['NTD ID', 'Bus', 'Articulated Bus', 'Over-The-Road Bus',\n", + " 'Double Decker Bus', 'Trolleybus']]\n", + "ntd_vehicles.rename(columns={'NTD ID': 'ntd_id', 'Bus': 'bus', 'Articulated Bus': 'artic_bus',\n", + " 'Over-The-Road Bus': 'otr_bus', 'Double Decker Bus':'dbl_deck_bus',\n", + " 'Trolleybus': 'trolleybus'}, inplace=True)\n", + "ntd_vehicles['bus'] = ntd_vehicles['bus'].str.replace(',', '')\n", + "ntd_vehicles = ntd_vehicles.astype({'bus': 'int64', 'artic_bus': 'int64', 'otr_bus': 'int64',\n", + " 'dbl_deck_bus': 'int64', 'trolleybus': 'int64'})" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "c9a8610a-747b-4858-bd5b-aaeb8f7eec18", + "metadata": {}, + "outputs": [], + "source": [ + "ntd_joined = ntd_vehicles >> inner_join(_, total_vrh, on='ntd_id')" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "id": "7b7ec79a-5e22-485a-a256-e939d0cef8d4", + "metadata": {}, + "outputs": [], + "source": [ + "ntd_joined['total_buses'] = ntd_joined[['bus', 'artic_bus', 'otr_bus', 'dbl_deck_bus', 'trolleybus']].sum(axis=1)" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "318d22d2-d13c-4824-8728-44123b508ad5", + "metadata": {}, + "outputs": [], + "source": [ + "ntd_joined = ntd_joined[ntd_joined['total_buses'] > 5] ## filter outliers with very small fleets" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "b0b24534-41ff-433e-8a95-a97b8ed381a8", + "metadata": {}, + "outputs": [], + "source": [ + "ntd_joined['vrh_per_bus'] = ntd_joined['total_vrh'] / ntd_joined['total_buses']" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "8ee16242-d49d-4849-821a-cbace4320d4f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "2454.5673624288424" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ntd_joined['vrh_per_bus'].median()" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "8ff87dcb-c974-4ec7-b5a5-81a7fc3cfb27", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYwAAAEHCAYAAAC9TnFRAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjQuMywgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/MnkTPAAAACXBIWXMAAAsTAAALEwEAmpwYAAAjtklEQVR4nO3df3xcdZ3v8ddnJsk0NFBCWrBtWqu2oG0tRbIIdi8PBZGiFbiLIK4KjyvXuiy6iCu/1vUiut4L6OW6iHAX0WtRECtdbcWfCEWF5YcptqUtIJVfTctSiKE0NZ0kM5/7x5y0J5PJ5KSZmTPJvJ+Pxzxm5nvOmfkklPPJ+X6/5/M1d0dERGQkibgDEBGR8UEJQ0REIlHCEBGRSJQwREQkEiUMERGJpC7uAMpp6tSpPmfOnLjDEBEZN9atW/eKu08rtG1CJ4w5c+bQ3t4edxgiIuOGmT0/3DZ1SYmISCRKGCIiEokShoiIRKKEISIikShhiIhIJGVPGGb2nJk9bmbrzaw9aDvMzO4xs6eD5+bQ/lea2VYze8rMTg21Hxt8zlYzu8HMrNyxh3V2p9mw7VU6u9OV/FoRkapRqSuMd7n7YndvC95fAdzr7vOAe4P3mNl84FxgAbAUuMnMksExNwPLgXnBY2mFYmf1+u0sufY+PnLrIyy59j7WrN9eqa8WEakacXVJnQGsCF6vAM4Mtd/p7ml3fxbYChxnZtOBQ9z9Ic/VY78tdExZdXanuXzVRvb2Zdmd7mdvX5bLVm3UlYaI1JxKJAwHfmVm68xsedB2hLu/CBA8Hx60zwS2hY7tCNpmBq/z24cws+Vm1m5m7S+//PKYg+/o6qE+MfjXVJ9I0NHVM+bPFhEZTypxp/cSd99hZocD95jZk0X2LTQu4UXahza63wLcAtDW1jbm1aFamxvpy2YHtfVls7Q2N471o0VExpWyX2G4+47geSfwI+A44KWgm4ngeWewewcwK3R4K7AjaG8t0F52LU0prjtrEZPqExycqmNSfYLrzlpES1OqEl8vIlI1ynqFYWaTgYS77w5evwf4IrAGOB+4JnheHRyyBrjDzK4HZpAb3H7U3TNmttvMjgceAc4Dvl7O2MNOXzyTJXOn0tHVQ2tzo5KFiNSkcndJHQH8KJgBWwfc4e6/MLPfAyvN7ALgBeBsAHffbGYrgS1AP3CRu2eCz7oQ+A7QCPw8eFRMS1NKiUJEaprlJh1NTG1tba5qtSIi0ZnZutAtEIPoTm8REYlECUNERCJRwhARkUiUMEREJBIlDBERiUQJQ0REIlHCEBGRSJQwREQkEiUMERGJRAlDREQiUcIQEZFIlDBERCQSJQwREYlECUNERCJRwhARkUiUMEREJBIlDBERiUQJQ0REIlHCEBGRSJQwREQkEiWMYXR2p9mw7VU6u9NxhyIiUhXq4g6gGq1ev53LV22kPpGgL5vlurMWcfrimXGHJSISK11h5OnsTnP5qo3s7cuyO93P3r4sl63aqCsNEal5Shh5Orp6qE8M/rXUJxJ0dPXEFJGISHVQwsjT2txIXzY7qK0vm6W1uTGmiEREqoMSRp6WphTXnbWISfUJDk7VMak+wXVnLaKlKTVkXw2Mi0gt0aB3AacvnsmSuVPp6OqhtbmxYLLQwLiI1BoljGG0NKUKJgoYPDC+l1z31WWrNrJk7tRhjxERGe/UJXUANDAuIrVICeMAaGBcRGqREsYBGM3AuIjIRKExjAMUZWBcRGQiUcIYg2ID4yIiE426pEREJBIlDBERiaQiCcPMkmb2BzO7O3h/mJndY2ZPB8/NoX2vNLOtZvaUmZ0aaj/WzB4Ptt1gZlaJ2EVEJKdSVxgXA0+E3l8B3Ovu84B7g/eY2XzgXGABsBS4ycySwTE3A8uBecFjaWVCFxERqEDCMLNW4H3AraHmM4AVwesVwJmh9jvdPe3uzwJbgePMbDpwiLs/5O4O3BY6ZsJQbSoRqWaVmCX1NeAy4OBQ2xHu/iKAu79oZocH7TOBh0P7dQRtfcHr/PYhzGw5uSsRZs+eXYLwK0O1qUSk2pX1CsPMlgE73X1d1EMKtHmR9qGN7re4e5u7t02bNi3i18ZLizaJyHhQ7iuMJcDpZvZeYBJwiJl9D3jJzKYHVxfTgZ3B/h3ArNDxrcCOoL21QPuE0NHVQzJvDH+gNpXu8xCRalHWKwx3v9LdW919DrnB7Pvc/SPAGuD8YLfzgdXB6zXAuWaWMrM3kBvcfjTovtptZscHs6POCx0z7m3avos9vZlBbapNJSLVJq47va8BVprZBcALwNkA7r7ZzFYCW4B+4CJ3HziTXgh8B2gEfh48xr3O7jRf+umWIe2ff998XV2ISFWpWMJw9/uB+4PXncDJw+z3ZeDLBdrbgYXli3Cwzu50RepEDZRKH1hXA2ByKsnCmVPK9p0iIgdCtaQKqOSMpUKl0jNZV3eUiFQdlQbJU+kZSyqVLiLjha4w8hTqIir3jCWVSheR8UAJI09rcyO9mcqvpqdS6SJS7dQlleeBra+QCY0p1CdNXUQiIihhDDIwftEfusBIGCyZOzW+oEREqoS6pEIKjV/UBeMXA9s1xiAitUoJI6TQFNc9vRluf+R51mzYocKAIlLT1CUV0tKU4vPvmz+kfWV7hwoDikjNU8LIs3DmFJpSyaL7JBPG2id3Fk0aWttCRCYaJYw8rc2NpPuzRffZk85w1ZrNLLn2Ptas3z5k++r121ly7X185NZHht1HRGS8UcIoILeo334Jg1SdMTl05bGnN1Owe0prW4jIRKWEkaejq4fG+sFzASY31PHN89q4+v0LmNwwuLuqPjSLauD4+kSi6D7jmbraRGqXZknlKTRTqi+bZcGMKSyYAf+8etOQba3Njfuq205uSBY8fiIUE9QysiK1TVcYeYoVAxxu2wNbX9k3ZrHsxgc4p611whUTVFebiOgKo4BixQDztwEsufY+9vZl993wt7K9g7s/+dfs6c1MmBv94ijKKCLVRQljGMWKAYa3bdj2asET6Z7eDEfPOrQSoVbEcF11E6GrTUSiUZfUGNXKiVTrdoiIrjDGaOBEelneYPBEPJFq3Q6R2qaEUQK1dCLVuh0itUsJo0R0IhWRiW7UCcPMEkCTu79WhniqysC9FeGrhs7uNJt37AKMBTMOUZIQkZoRKWGY2R3A3wEZYB0wxcyud/evlDO4ON3+8PNc/ZPN1CcTZNy57qxFOPDZH26gL5MrHVKXgOvPWayb10SkJkSdJTU/uKI4E/gZMBv4aLmCitvtDz/P5368id6M76sZdeldG7k0lCwA+rNw6V0bdPOaiNSEqAmj3szqySWM1e7eB3jxQ8anzu40V9+9ZUh7wsDMhrQnbeLUiRIRKSZqwvg34DlgMvBbM3s9MCHHMDq6emhIDk0M/VkfUsUWoC+TGVKQcCxU3E9EqlWkhOHuN7j7THd/r+c8D7yrzLHFYrj1ML7w/gV89eyjqc9LJslkgmU3PlCSNS+0joaIVLOog97/Y5hNXyxhLFUj/0oiabB04etoaUqxZO5UHvpTJ5esXE9fxtnbl0sul63ayJK5Uw941lS4uN9AmZGxfqaISClF7ZLaE3pkgNOAOWWKKVYdXT0k88Yq6hK2b5yipSnFrMMOYlJd8XUxDuR7J/I6GiIy/kW6wnD3/x1+b2ZfBdaUJaKYTW5Iks4MvsJIZ3zfOEVnd5pdPb30ZjKD9hlr/ahaqUklIuPXgd7pfRDwxlIGUi329GaYVJ/Y19UEMKk+V302vIBQ1nP3YTTW15WkflQt1aQSkfEp6hjG4+yfRpsEpjFBxy+G+4t+ckNyyBhDqi7BNz78tqJ3fBe6W3w4E60m1Ug/+2h+NyISv6hXGMtCr/uBl9y9vwzxxK6lKcU5ba3c9tAL+9rOaWtlT29myLoXDckEUxrrhz3ZHciSphOlJtVIP7uWexUZf6JOq30eaAHOAP4GeGs5g4pTZ3eale0dg9pWtneMeq3uWl7SdKSfvZZ/NyLjWaSEEUyrXUEuaUwFvmNm/1zOwOIy3GylPb2ZUS0gVMuznkb62Wv5dyMynkXtkvoQcIy77wUws2uAx4B/KXaQmU0Cfgukgu+6y92vMrPDgB+Qm5r7HHCOu3cFx1wJXEBu+u4/uPsvg/Zjge8AjeTqWV3shW69HqNis5WOnnVo5DGGWp71NNLPXsu/G5HxLOp9GM8Bk0LvU8CfIhyXBk5y96OBxcBSMzseuAK4193nAfcG7zGz+cC5wAJgKXCTmQ3c8HAzsByYFzyWRox9VEZairSlKcXRsw4dcZyhlpc0jfI7rNXfjch4ZsX+SDezr5ObHTUb+CvgnuD9KcAD7n5u5C8yOwh4ALgQuA14p7u/aGbTgfvd/ajg6gJ3/1/BMb8EvkAuYa119zcH7R8Kjv9Ese9sa2vz9vb2qCEOMjCDZ3JDkj29mQOeyVPLM4E0S0qk8sb6/5WZrXP3tkLbRuqSGjjbrgN+FGq/fxRfngyOnwt8w90fMbMj3P1FgCBpHB7sPhN4OHR4R9DWF7zOby+blqYUD2x9ZcwzeSbKrKcDMdLPXsu/G5FyKPfsw6IJw91XRPkQM1vl7mcN8xkZYLGZHQr8yMwWFvuoQh9RpL1QLMvJdV0xe/bsYmEXpdpOIjKeVOKcFXUMYyQj3vXt7q+SuzJZCrwUdEURPO8MdusAZoUOawV2BO2tBdoLfc8t7t7m7m3Tpk0b3U8RUqimlGbyiEi1qsTsw1IljOH+2p8WXFlgZo3Au4EnydWhOj/Y7XxgdfB6DXCumaXM7A3kBrcfDbqvdpvZ8ZZbxei80DFlsWn7Lvb0Dq4X1ZvJaCaPiFSlSsw+LFXCGM50YK2ZbQR+D9zj7ncD1wCnmNnT5AbQrwFw983ASmAL8AvgoqBLC3KD5bcCW8nN0Pp5uYLu7E7zpZ8OXXUvk3Ue3PpKwf1Hs+iRFkkSkVKrxOzDorOkIn+I2R/c/ZgSxFNSBzpLasO2V/nwrQ/Tnc4M2TapPsGDl5+07z/CaAeZqrEkhmYriUwccc6SGpjltMLdP1Jkt8tHHVUV27R9V8FkAfv7BFuaUqMeZKrGgfRqTGAicuDKOftwxC6poEtompk1FNnnVyWNKkbDdUcN6M3s7xMc7SBTtZXEUE0nERmNqKVBngMeNLM15FbdA8Ddry9HUHEaOKmHq9KGffJdc/dl79EOMlVbSYxCP2v4CkpEJCzqoPcO4O5g/4NDjwmn0Ek97LSFr9v3erSDTNVWEqPaEpiIVLeoS7ReDWBmk919z0j7j2eF1sMYkErakKm2o130qJoWSdIqfyIyGlFX3DsB+BbQBMw2s6OBT7j735czuDgUWg9jgCWMyQ1JNmx7ddDJfjyXuKimBCYi1S3qGMbXgFPJ3ViHu28wsxPLFVScCt3hDdCQNM5pa2XZjQ+MaUZRNc5KGs8JT0QqJ/KNe+6+La+p8LzTca7QHd4NdQnu+O9vZ2V7x5hmFGlWkoiMZ1ETxjYzewfgZtZgZp8FnihjXLEYbkrtVcvmU1+XLHAEo5oSW23TakVERiNqwvg74CJyJcW3k1sM6aIyxRSbQif0yakkC2dOYXJDkr19g2cU7e3LMrmhcCIpRLOSRGQ8i5Qw3P0Vd/+wux/h7tPc/SPu3lnu4CqttbmRvf15BQf7cyf0Pb0ZUsm86rVJY8eu6FcH1TatdiJRfS6R8os6S+qNwL8Cx5OrTPsQcIm7P1PG2GKRX1tr4H1rcyOWMMjs396XcT5+Wztf+cDRkQeuNSup9KpxIoHIRBS1S+oOclVkpwMzgB8C3y9XUHHp6OqhsX5wDm2sr9s3xnDRO+fSkHeVke73UQ9cR10XXEamiQQilRN1Wq25+3dD779nZp8sR0Bxam1upKevf1BbT18/m7bv4oO3PBSMbxj1CejL7r/SUDmN+Ki8iUjlRE0Ya83sCuBOcl1SHwR+amaHAbj7n8sUX8Xl1mfyQe+/ePdm0v0+bH0pDVzHRxMJRConasL4YPD8ibz2j5E7u464ROt40NHVw6S6JH2Z/VcZCbMgf+xPIpPqE2SzTqouWbFyGlqzojCVNxGpnKi1pN5QbLuZneLu95QmpPgU+ms13T/0qsIdfvYP/4U9vZmKnMA1qFucJhKIVEaplmi9tkSfE6uWphSfefeRI+6XyWbZ8uJrFRm41qBuNJpIIFJ+pUoYQ4svjVOHTR52nah9+rNU7KStu8NFpFqUKmGMfWHwKtF8UH2k/Sp10tagrohUi1IljAmj6y99kfar1Elbd4eLSLWIOktqJM+V6HNit3jWoQXbLz5pLv/2u2dimYmjQV0RqQaRE0ZQrXZO+Bh3vy14/puSRxaTzS++RjJhZEI35p13wmwuec9RnPeOObGdtLVmhYjELWotqe8CbwLWs38dDAduK09Y8RiYkRROFqm6BBefnJs5pZO2iNSyqFcYbcB8z6/MN8EUKjNRlzSVmRARIfqg9ybgdeUMpBoUmpG0J51h0/ZdMUUkIlI9iiYMM/uJma0BpgJbzOyXZrZm4FGZECunpSnF55fNH9L+pZ9uqcg9F1rTQUSq2UhdUl8Nnp0JdHNeMQtnTGFyQ4I9vfuvNBJmbN6xixOPPHxfW6lrO6n8h4hUu6IJw91/Y2YJYKO7L6xQTLHatH3XoGQB8JfeDBd85/d84fSFfPj415f85B4u/zEwfnLZqo0smTtVYyciUjVGHPR296yZbTCz2e7+QiWCiktnd5ov/GRzwW19WfjcjzexJ93P9b/+Y0lP7lrTQUTGg6izpKYDm83sUWDPQKO7n16WqGKyeccu+jLFJ4J95VdP0ZAsXNvpQE/uKv8hIuNB1IRxN/Bt4AUm9FjGyD9awoy+TGlP7lrTQUTGg6gJ42DgAuDP5Fbdu8vdXypbVDFZMOMQ6hK5arTDSfdn+afT3sz1v/5jSU/uKv8hItUu6gJKVwNXm9kicqvv/cbMOtz93WWNrsJamlJcffpCPvfjTUX3S/dnefDyk0p+cted5CJSzUZbrXYn8J9AJ3D4CPuOS517ekfc58a1TwNowR4RqSmREoaZXWhm9wP3kruJ7+PuvqicgcWhszvNv/76jyPu15BMagEjEak5Ua8wXg982t0XuPtV7r4lykFmNsvM1prZE2a22cwuDtoPM7N7zOzp4Lk5dMyVZrbVzJ4ys1ND7cea2ePBthvMrOSD75t3vMYIk6QA6M1k2dXTpzuyRaSmREoY7n6Fu68/gM/vB/7R3d8CHA9cZGbzgSuAe919HrmrlisAgm3nAguApcBNZpYMPutmYDkwL3gsPYB4RlA4Wyx76+tI1RkHp+qoTxqZbJaLbn+MJdfex5r120sfhohIFSrrinvu/qK7Pxa83g08AcwEzgBWBLutAM4MXp8B3OnuaXd/FtgKHGdm04FD3P2hoGLubaFjSmbBjCkkE0MvXE5401T+44qT+caHjyFhuVlUu9P97O3LVmxtbxGRuFVsiVYzmwMcAzwCHOHuL0IuqbB/AH0msC10WEfQNjN4nd9e6HuWm1m7mbW//PLLow+0QAX3L96du/t7SmMD9cPctCciMtFVJGGYWROwitw4yGvFdi3QNlzhw4L9R+5+i7u3uXvbtGnTRhVnR1cPqfrkkHYzY+2TO3nkmU6605lB23RHtojUilKt6T0sM6snlyxud/d/D5pfMrPp7v5i0N20M2jvAGaFDm8FdgTtrQXaS6q1uXHQansD9vZluWrNpiFFCQE+8+4jNbVWRGpCWa8wgplM3wKecPfrQ5vWAOcHr88HVofazzWzlJm9gdzg9qNBt9VuMzs++MzzQseUTEtTimNmTSm4rVCyAPjqr57SwLeI1IRyd0ktAT4KnGRm64PHe4FrgFPM7GnglOA97r4ZWAlsAX4BXOTuA31AFwK3khsI/xPw81IHu/Wl3Tz8bNeojunNuAa+RaQmlLVLyt0fYPiKficPc8yXgS8XaG8Hyromx/ptrx7QcaUoRV7qBZlEREqt7GMY48niWYcW3V6XgMtOfTNf/dVT9Ibu8OvNjG3gW6vtich4ULFptePB3CMO5rwTZg+7PZlIcNaxrXz17KOpT+6/cMpkszy49ZUD+s7wanu6t0NEqpkSRp4vnvFWfn3JibzryKFTctP9We545AWWzJ1K+P6+/iwHfJIfWG0vTPd2iEg1UsIo4JFn/8zaPxa+6e/GtU+zecdrNCQH369xoCd5rbYnIuOFEkaezu40V989fG3FXKLwkp3kB1bbm1Sf4OBUHZPqE1ptT0Sqkga983R09dCQNHr7C2/vy2aZMaWRi945lxvXPk1DMjnmVfe02p6IjAdKGHlamxvpL3C3d0MCEskE57S1suzGB4JxB2P5iW/kb98+e8wnea22JyLVTl1SeVqaUpzT1jqozYBPnXwkd3/yr1nZ3rFvRlO6P8s37t8aT6AiIhWmhJGnszvND37fMajNga/f90d27Bo6oylhxuYduyoYoYhIPJQw8nR09RRcE6M3Aw/9qXPIYPdfejN8/LZ21ZMSkQlPCSPPcBVrAb794HN8/n3zSdUN/rWl+1VPSkQmPiWMPC1NKc5YPL3gtoZkgoUzp/DN89o4qL4092GIiIwXmiWV5/aHn2dle+HupYF7LVqbG8nmrd+km+1EZKLTFUZIZ3eaq38y/E17n182f9/0V91sJyK1RlcYIbkBbyAzdFsqaSycsX9xJd1sJyK1RgkjpLW5kWHGu8EY0uWkm+1EpJaoSyqkpSnFVz6waFDpcsitg/GVDxyt5CAiNU0JI8/pi2dy6XuOImmQSkJ90rj6jIVa0EhEap4SRp7bH36e//nzJ8k4pDPQl3G+dPcW3WMhIjVPCSNkuNLmSTPdYyEiNU8JI2SgtHm+vjGu2S0iMhEoYYS0Njeyt2/onNqr3r9AA94iUvOUMPKYDb7CqE8aSxe+LqZoRESqhxJGSEdXD5PqBteIaqhTjSgREVDCGKS1uXFI+fI96Qybtmu9CxERJYyQlqYUn182f0j7FzWtVkRECSPfwhlTmNwwuFsq3Z/ljkdeiCkiEZHqoISRp7W5kf4CBaVuXPu0rjJEpKYpYeRpaUrxsSVzhrQ3JJMa/BaRmqaEkWf1+u18+8Fnh7RrgSQRqXVKGCGd3WkuX7WRdP/gLqlUnRZIEhHRehghHV091CcS7GX/1NqD6pP8348ey4lHTosxMhGR+OkKI6TQfRhZnAUzDokpIhGR6qGEEaK1ukVEhqcuqTxaq1tEpLCyXmGY2bfNbKeZbQq1HWZm95jZ08Fzc2jblWa21cyeMrNTQ+3HmtnjwbYbLL9CYIm1NKU4etahShYiIiHl7pL6DrA0r+0K4F53nwfcG7zHzOYD5wILgmNuMrOBW65vBpYD84JH/meKiEiZlTVhuPtvgT/nNZ8BrAherwDODLXf6e5pd38W2AocZ2bTgUPc/SF3d+C20DEiIlIhcQx6H+HuLwIEz4cH7TOBbaH9OoK2mcHr/PaCzGy5mbWbWfvLL79c0sBFRGpZNc2SKjQu4UXaC3L3W9y9zd3bpk3TvRMiIqUSR8J4KehmInjeGbR3ALNC+7UCO4L21gLtIiJSQXEkjDXA+cHr84HVofZzzSxlZm8gN7j9aNBttdvMjg9mR50XOkZERCqkrPdhmNn3gXcCU82sA7gKuAZYaWYXAC8AZwO4+2YzWwlsAfqBi9w9E3zUheRmXDUCPw8eIiJSQZabeDQxtbW1eXt7e9xhiIiMG2a2zt3bCm2rpkFvERGpYkoYIiISiRKGiIhEooQhIiKRKGGIiEgkShgiIhKJEoaIiESihCEiIpEoYYiISCRKGCIiEokShoiIRKKEISIikShhFNDZnWbDtlfp7E7HHYqISNUoa3nz8Wj1+u1cvmoj9YkEfdks1521iNMXD7sirIhIzdAVRkhnd5rLV21kb1+W3el+9vZluWzVRl1piIighDFIR1cP9YnBv5L6RIKOrp6YIhIRqR5KGCGtzY30ZbOD2vqyWVqbG2OKSESkeihhhLQ0pbjurEVMqk9wcKqOSfUJrjtrES1NqbhDExGJnQa985y+eCZL5k6lo6uH1uZGJQsRkYASRgEtTSklChGRPOqSEhGRSJQwREQkEiUMERGJRAlDREQiUcIQEZFIzN3jjqFszOxl4PkDOHQq8EqJwyknxVteire8FG/5HEisr3f3aYU2TOiEcaDMrN3d2+KOIyrFW16Kt7wUb/mUOlZ1SYmISCRKGCIiEokSRmG3xB3AKCne8lK85aV4y6eksWoMQ0REItEVhoiIRKKEISIikShh5DGzpWb2lJltNbMr4o6nGDP7tpntNLNNcccShZnNMrO1ZvaEmW02s4vjjqkYM5tkZo+a2YYg3qvjjmkkZpY0sz+Y2d1xxzISM3vOzB43s/Vm1h53PCMxs0PN7C4zezL4N3xC3DENx8yOCn6vA4/XzOzTY/5cjWHsZ2ZJ4I/AKUAH8HvgQ+6+JdbAhmFmJwLdwG3uvjDueEZiZtOB6e7+mJkdDKwDzqzi368Bk92928zqgQeAi9394ZhDG5aZfQZoAw5x92Vxx1OMmT0HtLn7uLgJzsxWAL9z91vNrAE4yN1fjTmsEQXnte3A2939QG5k3kdXGIMdB2x192fcvRe4Ezgj5piG5e6/Bf4cdxxRufuL7v5Y8Ho38AQwM96ohuc53cHb+uBRtX9hmVkr8D7g1rhjmWjM7BDgROBbAO7eOx6SReBk4E9jTRaghJFvJrAt9L6DKj6hjWdmNgc4Bngk5lCKCrp41gM7gXvcvZrj/RpwGZAdYb9q4cCvzGydmS2PO5gRvBF4Gfh/QZffrWY2Oe6gIjoX+H4pPkgJYzAr0Fa1f1GOV2bWBKwCPu3ur8UdTzHunnH3xUArcJyZVWXXn5ktA3a6+7q4YxmFJe7+NuA04KKgi7Va1QFvA25292OAPUBVj3ECBF1npwM/LMXnKWEM1gHMCr1vBXbEFMuEFIwFrAJud/d/jzueqILuh/uBpfFGMqwlwOnBuMCdwElm9r14QyrO3XcEzzuBH5HrEq5WHUBH6ArzLnIJpNqdBjzm7i+V4sOUMAb7PTDPzN4QZOZzgTUxxzRhBIPI3wKecPfr445nJGY2zcwODV43Au8Gnow1qGG4+5Xu3uruc8j9u73P3T8Sc1jDMrPJwcQHgq6d9wBVO9vP3f8T2GZmRwVNJwNVOVkjz4coUXcU5C6zJODu/Wb2SeCXQBL4trtvjjmsYZnZ94F3AlPNrAO4yt2/FW9URS0BPgo8HowLAPyTu/8svpCKmg6sCGaZJICV7l7101XHiSOAH+X+hqAOuMPdfxFvSCP6FHB78MfkM8B/izmeoszsIHIzPj9Rss/UtFoREYlCXVIiIhKJEoaIiESihCEiIpEoYYiISCRKGCIiE8RoC5Ka2TlmtiUornnHiPtrlpSIyMQwmoKkZjYPWAmc5O5dZnZ4cBPlsHSFIVJEUNL670fYZ46Z/W2Ez5pTilL0ZvYFM/vsWD9HJp5CBUnN7E1m9ougZtfvzOzNwaaPA99w967g2KLJApQwREZyKFA0YQBzgBETRimYmW62ldG6BfiUux8LfBa4KWg/EjjSzB40s4fNbMSyN/rHJ1LcNcCbgjvT7wnaTiNXlPJf3P0HwT5vCfZZQa4u0neBgWqmn3T3/xjpi8zsEeBjA9UFzOx+4B+B9wMzyCWmV8it2TI/2D4b+Jq73zDGn1MmoKDQ5zuAHwZ31QOkguc6YB65ahGtwO/MbGGxsu26whAp7gpyawksBh4GFgNHk6sr9ZVgUagryC2ss9jd/w+5UuinBJVYPwhEPZnfCZwD+xabmhGqPnsscIa7D1zJvBk4lVzBvquCoo4i+RLAq8G/zYHHW4JtHcBqd+9z92eBp8glkKIfJiLR/DXw/aDk+UvAb4C/KrBfPfBNM3ucXFnp+RE/fyVwdvD6HAaXpF7j7j2h9z9193SwWt1OcrWZRAYJlg941szOhlwBUDM7Otj8Y+BdQftUcl1UzxT7PCUMkegKrZdSyCXAS+SuRNqAhigHuft2oNPMFpG7MrkztHlP3u7p0OsM6l4W9hUkfQg4ysw6zOwC4MPABWa2AdjM/lVEf0nu39sWYC1wqbt3Fvt8/SMTKW43cHDw+rfAJ4K1nQ8jt2TnpeRWZTw4dMwUcmsnZM3sfHKVj6O6k9yqeVPc/fGxBi+1xd0/NMymIQPanrun4jPBIxJdYYgUEfzF9WAwHfYEYCOwAbgPuCxYJ2Ej0G9mG8zsEnKzUM43s4fJXebnXx0Ucxe59SxWlvDHECkJ3bgnIiKR6ApDREQi0RiGSIWZ2anAtXnNz7r7f40jHpGo1CUlIiKRqEtKREQiUcIQEZFIlDBERCQSJQwREYnk/wM1coRhAt62lQAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "ntd_joined[['total_vrh', 'vrh_per_bus']].plot(x='total_vrh', y='vrh_per_bus', kind='scatter')" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "fc04c986-24ae-4aef-96da-701c094860b5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
ntd_idbusartic_busotr_busdbl_deck_bustrolleybusAgencytotal_vrhtotal_busesvrh_per_bus
3990173230000Transit Joint Powers Authority for Merced Coun...114903234995.782609
689R02-9104790000Mendocino Transit Authority3904094337.777778
3390211550000Anaheim Transportation Network232611554229.290909
8900311730000Riverside Transit Agency6863211733967.173410
129002915915000Omnitrans6760451743885.316092
.................................
1569R02-9105860000City of Ojai804161340.166667
489R02-91062320000Eastern Sierra Transit Authority40516321266.125000
4390205460000City of Elk Grove55961461216.543478
289R02-91007150000Fresno County Rural Transit Agency17355151157.000000
10590303001700Santa Barbara County Association of Governments892917525.235294
\n", + "

102 rows × 10 columns

\n", + "
" + ], + "text/plain": [ + " ntd_id bus artic_bus otr_bus dbl_deck_bus trolleybus \\\n", + "39 90173 23 0 0 0 0 \n", + "68 9R02-91047 9 0 0 0 0 \n", + "33 90211 55 0 0 0 0 \n", + "8 90031 173 0 0 0 0 \n", + "12 90029 159 15 0 0 0 \n", + ".. ... ... ... ... ... ... \n", + "156 9R02-91058 6 0 0 0 0 \n", + "48 9R02-91062 32 0 0 0 0 \n", + "43 90205 46 0 0 0 0 \n", + "28 9R02-91007 15 0 0 0 0 \n", + "105 90303 0 0 17 0 0 \n", + "\n", + " Agency total_vrh \\\n", + "39 Transit Joint Powers Authority for Merced Coun... 114903 \n", + "68 Mendocino Transit Authority 39040 \n", + "33 Anaheim Transportation Network 232611 \n", + "8 Riverside Transit Agency 686321 \n", + "12 Omnitrans 676045 \n", + ".. ... ... \n", + "156 City of Ojai 8041 \n", + "48 Eastern Sierra Transit Authority 40516 \n", + "43 City of Elk Grove 55961 \n", + "28 Fresno County Rural Transit Agency 17355 \n", + "105 Santa Barbara County Association of Governments 8929 \n", + "\n", + " total_buses vrh_per_bus \n", + "39 23 4995.782609 \n", + "68 9 4337.777778 \n", + "33 55 4229.290909 \n", + "8 173 3967.173410 \n", + "12 174 3885.316092 \n", + ".. ... ... \n", + "156 6 1340.166667 \n", + "48 32 1266.125000 \n", + "43 46 1216.543478 \n", + "28 15 1157.000000 \n", + "105 17 525.235294 \n", + "\n", + "[102 rows x 10 columns]" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ntd_joined >> arrange(-_.vrh_per_bus)" + ] + }, + { + "cell_type": "markdown", + "id": "d7f8afaf-1d6e-4bc8-965a-0f2c956bda96", + "metadata": {}, + "source": [ + "### Methodology notes\n", + "\n", + "* filtered to buses\n", + "* all 2019 NTD data\n", + "* using 12 year useful life\n", + "* bus cost:\n", + " * based on CARB Innovative Clean Transit cost model for a 40', 550kWh electric bus in 2022\n", + " * Inclusive of charger and maintenance infrastructure upgrades, but not potential land aquisition costs for expanded facilities." + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "91243ad7-7dd2-4895-85b4-a322accb68e3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
addl_service_hrs_annual
calitp_itp_idtract_type
4rural0.000000e+00
suburban6.081400e+04
urban3.315296e+06
10rural2.219360e+04
11rural1.142171e+05
.........
381urban3.553689e+05
386rural3.567200e+03
389rural7.304873e+04
suburban2.150633e+04
473rural3.244627e+04
\n", + "

257 rows × 1 columns

\n", + "
" + ], + "text/plain": [ + " addl_service_hrs_annual\n", + "calitp_itp_id tract_type \n", + "4 rural 0.000000e+00\n", + " suburban 6.081400e+04\n", + " urban 3.315296e+06\n", + "10 rural 2.219360e+04\n", + "11 rural 1.142171e+05\n", + "... ...\n", + "381 urban 3.553689e+05\n", + "386 rural 3.567200e+03\n", + "389 rural 7.304873e+04\n", + " suburban 2.150633e+04\n", + "473 rural 3.244627e+04\n", + "\n", + "[257 rows x 1 columns]" + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hours_by_operator" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "29920e5e-cc55-4449-a550-303da1cc6bf2", + "metadata": {}, + "outputs": [], + "source": [ + "bus_cost = 776941 ## https://ww2.arb.ca.gov/resources/documents/transit-fleet-cost-model" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "id": "e3d5dd28-d279-40e6-972d-f1be17189c4f", + "metadata": {}, + "outputs": [], + "source": [ + "median_vrh_per_bus = ntd_joined['vrh_per_bus'].median()" + ] + }, + { + "cell_type": "code", + "execution_count": 50, + "id": "27d7945d-47f0-4c2a-b827-14a68547bfad", + "metadata": {}, + "outputs": [], + "source": [ + "hours_by_operator['additional_buses'] = hours_by_operator['addl_service_hrs_annual'] / median_vrh_per_bus" + ] + }, + { + "cell_type": "code", + "execution_count": 51, + "id": "7ace9e20-a7fa-44dc-bdf7-f1c417e72b4e", + "metadata": {}, + "outputs": [], + "source": [ + "hours_by_operator['bus_capex'] = hours_by_operator['additional_buses'] * bus_cost" + ] + }, + { + "cell_type": "code", + "execution_count": 52, + "id": "4b746de0-c109-44ed-a1de-4146b3a481f5", + "metadata": {}, + "outputs": [], + "source": [ + "hours_by_operator['bus_capex_annualized'] = hours_by_operator['bus_capex'] / 14 ## 14 year service life" + ] + }, + { + "cell_type": "code", + "execution_count": 53, + "id": "920bfd84-f4f2-4ecd-8a1a-074aa8d59a08", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
addl_service_hrs_annualadditional_busesbus_capexbus_capex_annualized
calitp_itp_idtract_type
4rural0.000000e+000.0000000.000000e+000.000000e+00
suburban6.081400e+0424.7758531.924938e+071.374955e+06
urban3.315296e+061350.6642561.049386e+097.495617e+07
10rural2.219360e+049.0417567.024911e+065.017794e+05
11rural1.142171e+0546.5324913.615300e+072.582357e+06
..................
381urban3.553689e+05144.7786161.124844e+088.034603e+06
386rural3.567200e+031.4532911.129121e+068.065151e+04
389rural7.304873e+0429.7603292.312202e+071.651573e+06
suburban2.150633e+048.7617616.807372e+064.862408e+05
473rural3.244627e+0413.2187311.027017e+077.335839e+05
\n", + "

257 rows × 4 columns

\n", + "
" + ], + "text/plain": [ + " addl_service_hrs_annual additional_buses \\\n", + "calitp_itp_id tract_type \n", + "4 rural 0.000000e+00 0.000000 \n", + " suburban 6.081400e+04 24.775853 \n", + " urban 3.315296e+06 1350.664256 \n", + "10 rural 2.219360e+04 9.041756 \n", + "11 rural 1.142171e+05 46.532491 \n", + "... ... ... \n", + "381 urban 3.553689e+05 144.778616 \n", + "386 rural 3.567200e+03 1.453291 \n", + "389 rural 7.304873e+04 29.760329 \n", + " suburban 2.150633e+04 8.761761 \n", + "473 rural 3.244627e+04 13.218731 \n", + "\n", + " bus_capex bus_capex_annualized \n", + "calitp_itp_id tract_type \n", + "4 rural 0.000000e+00 0.000000e+00 \n", + " suburban 1.924938e+07 1.374955e+06 \n", + " urban 1.049386e+09 7.495617e+07 \n", + "10 rural 7.024911e+06 5.017794e+05 \n", + "11 rural 3.615300e+07 2.582357e+06 \n", + "... ... ... \n", + "381 urban 1.124844e+08 8.034603e+06 \n", + "386 rural 1.129121e+06 8.065151e+04 \n", + "389 rural 2.312202e+07 1.651573e+06 \n", + " suburban 6.807372e+06 4.862408e+05 \n", + "473 rural 1.027017e+07 7.335839e+05 \n", + "\n", + "[257 rows x 4 columns]" + ] + }, + "execution_count": 53, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hours_by_operator" + ] + }, + { + "cell_type": "code", + "execution_count": 54, + "id": "52c7ee9f-986d-4041-8a6d-1f9a9a498bec", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
addl_service_hrs_annualadditional_busesbus_capexbus_capex_annualized
tract_type
rural6.194919e+062523.8335531.960870e+091.400621e+08
suburban2.060605e+06839.4981946.522406e+084.658861e+07
urban5.397544e+0721989.7960941.708477e+101.220341e+09
\n", + "
" + ], + "text/plain": [ + " addl_service_hrs_annual additional_buses bus_capex \\\n", + "tract_type \n", + "rural 6.194919e+06 2523.833553 1.960870e+09 \n", + "suburban 2.060605e+06 839.498194 6.522406e+08 \n", + "urban 5.397544e+07 21989.796094 1.708477e+10 \n", + "\n", + " bus_capex_annualized \n", + "tract_type \n", + "rural 1.400621e+08 \n", + "suburban 4.658861e+07 \n", + "urban 1.220341e+09 " + ] + }, + "execution_count": 54, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hours_by_operator.groupby('tract_type').sum()" + ] + }, + { + "cell_type": "code", + "execution_count": 55, + "id": "645197a6-4a8c-43f4-b5f2-bb9d50c74268", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "addl_service_hrs_annual 6.223096e+07\n", + "additional_buses 2.535313e+04\n", + "bus_capex 1.969788e+10\n", + "bus_capex_annualized 1.406992e+09\n", + "dtype: float64" + ] + }, + "execution_count": 55, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "hours_by_operator.sum()" + ] + }, + { + "cell_type": "markdown", + "id": "12f3dbb7-c0c9-4ce2-b995-fe0a2eaf0953", + "metadata": {}, + "source": [ + "### Sandbox" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "f4c0d1b6-24dd-41dd-a7c4-fd39ec391411", + "metadata": {}, + "outputs": [], + "source": [ + "# tbl.transitstacks.provider_info() >> select(_.calitp_itp_id == _.itp_id, _.ntd_id) >> collect() >> inner_join(_, ntd_joined, on='ntd_id')" + ] } ], "metadata": { diff --git a/bus_service_increase/tract_categorization.ipynb b/bus_service_increase/tract_categorization.ipynb index a5c676924..0a690461a 100644 --- a/bus_service_increase/tract_categorization.ipynb +++ b/bus_service_increase/tract_categorization.ipynb @@ -2,10 +2,19 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "fda96150-e931-4346-a85a-95741bd1c06e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -31,7 +40,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "675c695e-898f-44b5-a5aa-496941cd4f6d", "metadata": {}, "outputs": [], @@ -41,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "2553a59e-dc0c-4018-a3ca-85dcf3d636a7", "metadata": {}, "outputs": [], @@ -51,7 +60,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "1923e674-cccb-415c-a12e-c2284041af14", "metadata": {}, "outputs": [], @@ -61,17 +70,124 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "b90f2d08-b02a-4cc1-b857-d5af7dff663e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idntd_idtransit_provider_5307_funds_5311_fundsoperating_expenses_total_2019shape_idday_namedeparture_hourroute_idtrips_per_hourmean_runtime_min
0257NonePresidioGo Shuttle0.0NaN0.013737Thursday0660NaN
1257NonePresidioGo Shuttle0.0NaN0.013737Thursday1660NaN
2257NonePresidioGo Shuttle0.0NaN0.013737Thursday2660NaN
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id ntd_id transit_provider _5307_funds _5311_funds \\\n", + "0 257 None PresidioGo Shuttle 0.0 NaN \n", + "1 257 None PresidioGo Shuttle 0.0 NaN \n", + "2 257 None PresidioGo Shuttle 0.0 NaN \n", + "\n", + " operating_expenses_total_2019 shape_id day_name departure_hour route_id \\\n", + "0 0.0 13737 Thursday 0 66 \n", + "1 0.0 13737 Thursday 1 66 \n", + "2 0.0 13737 Thursday 2 66 \n", + "\n", + " trips_per_hour mean_runtime_min \n", + "0 0 NaN \n", + "1 0 NaN \n", + "2 0 NaN " + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "service_funding_joined.head(3)" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "70be0cc7-1527-49b7-9340-d8c0f7e19a2c", "metadata": {}, "outputs": [], @@ -83,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "dfd37e81-2b3c-432e-bd80-0e1b990ec7d2", "metadata": { "tags": [] @@ -108,7 +224,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "7b362d3a-48e6-4419-8097-bdbe34dff568", "metadata": { "tags": [] @@ -144,7 +260,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "c5aa5ab7-210b-442b-a09b-e7bb0b92e632", "metadata": {}, "outputs": [], @@ -154,7 +270,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "c3033048-07ca-4aa4-9ca1-08e4bcd4dad0", "metadata": {}, "outputs": [], @@ -164,7 +280,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "ed426836-ef12-42da-9147-29a25781145f", "metadata": {}, "outputs": [], @@ -175,10 +291,76 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "eea30800-7299-433d-9d59-7f9ad1c238db", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idshape_idgeometry
025713737LINESTRING (-216058.966 -21114.229, -216058.96...
34425713738LINESTRING (-216058.966 -21114.229, -216058.96...
0259p_110998LINESTRING (-194070.739 270848.067, -194110.74...
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id shape_id \\\n", + "0 257 13737 \n", + "344 257 13738 \n", + "0 259 p_110998 \n", + "\n", + " geometry \n", + "0 LINESTRING (-216058.966 -21114.229, -216058.96... \n", + "344 LINESTRING (-216058.966 -21114.229, -216058.96... \n", + "0 LINESTRING (-194070.739 270848.067, -194110.74... " + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "all_shapes.head(3)" ] @@ -193,7 +375,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "4151e559-6eae-46aa-ac8a-6200f5b53ad6", "metadata": {}, "outputs": [], @@ -204,7 +386,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "e1591713-7e6a-4e66-97c0-8b74f1a671d8", "metadata": {}, "outputs": [], @@ -214,7 +396,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "e6c7477d-9c04-4586-9afb-f3773d113442", "metadata": {}, "outputs": [], @@ -237,7 +419,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "94f1d6d3-e48f-4f2c-9efe-d36148776882", "metadata": {}, "outputs": [], @@ -256,7 +438,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "4cc2b49f-fbd5-4184-9fae-9c3e81db1155", "metadata": {}, "outputs": [], @@ -270,7 +452,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "4118280b-a981-4215-bc13-40b27b09e4ea", "metadata": {}, "outputs": [], @@ -280,665 +462,99 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "73830c74-4f20-44f1-a7d1-e9b2d56fd8df", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idshape_idgeometrypct_urbanpct_suburbanpct_ruralpct_maxtract_type
025713737LINESTRING (-216058.966 -21114.229, -216058.96...0.7997930.165513NaN0.799793urban
125713738LINESTRING (-216058.966 -21114.229, -216058.96...NaN1.000000NaN1.000000suburban
2259p_110998LINESTRING (-194070.739 270848.067, -194110.74...NaN0.5915380.408180.591538suburban
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id shape_id geometry \\\n", + "0 257 13737 LINESTRING (-216058.966 -21114.229, -216058.96... \n", + "1 257 13738 LINESTRING (-216058.966 -21114.229, -216058.96... \n", + "2 259 p_110998 LINESTRING (-194070.739 270848.067, -194110.74... \n", + "\n", + " pct_urban pct_suburban pct_rural pct_max tract_type \n", + "0 0.799793 0.165513 NaN 0.799793 urban \n", + "1 NaN 1.000000 NaN 1.000000 suburban \n", + "2 NaN 0.591538 0.40818 0.591538 suburban " + ] + }, + "execution_count": 19, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "processed_shapes.head(3)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "dade04a4-80fc-4439-8b8d-b8706a01998a", - "metadata": {}, - "outputs": [], - "source": [ - "processed_shapes = processed_shapes.set_index(['calitp_itp_id', 'shape_id'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c66f8267-6cce-4699-b852-9836abd65476", - "metadata": {}, - "outputs": [], - "source": [ - "service_funding_joined = service_funding_joined.set_index(['calitp_itp_id', 'shape_id'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "faa1317a-aaa7-4dbe-91e6-f26ef4906d37", - "metadata": {}, - "outputs": [], - "source": [ - "frequency_funds_tracts = processed_shapes.join(service_funding_joined, how='inner').reset_index()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "958f6f4d-7dd0-47a5-9ab0-3c564c5e8fb9", - "metadata": {}, - "outputs": [], - "source": [ - "frequency_funds_tracts.head(3)" - ] - }, - { - "cell_type": "markdown", - "id": "f69eb5d6-c845-4f90-8ed5-6a0eff0d677a", - "metadata": {}, - "source": [ - "### Refactored" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b6dada01-925f-4fb0-9716-f38933d671af", - "metadata": {}, - "outputs": [], - "source": [ - "## Filter 5AM to 9PM (best done here for performance)\n", - "frequency_funds_tracts = frequency_funds_tracts >> filter(_.departure_hour > 4, _.departure_hour < 21)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "abe4059b-e7fd-4e5f-ac8b-1b5f3b6b93f4", - "metadata": {}, - "outputs": [], - "source": [ - "frequency_funds_tracts.departure_hour.unique()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "f0c88c4e-4b7b-454a-8a5b-3e61b07c9b39", - "metadata": {}, - "outputs": [], - "source": [ - "min_runtimes = frequency_funds_tracts.groupby(['calitp_itp_id', 'shape_id'])[['mean_runtime_min']].min()\n", - "min_runtimes" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6a27d77f-c77a-4c1f-8512-35ede23c679b", - "metadata": {}, - "outputs": [], - "source": [ - "def fill_na_runtimes(row):\n", - " '''\n", - " If no service runs within an hour, assume runtime is minimum runtime for that service.\n", - " '''\n", - " if pd.isna(row.mean_runtime_min):\n", - " row['mean_runtime_min'] = min_runtimes.loc[ix[row.calitp_itp_id, row.shape_id]][0]\n", - " return row" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d9d6dfa3-1a81-45cf-aebd-4eb9d34f8619", - "metadata": {}, - "outputs": [], - "source": [ - "frequency_funds_tracts = frequency_funds_tracts.apply(fill_na_runtimes, axis = 1)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e6dbcb40-792b-4f5d-8691-c43c5c90c80c", - "metadata": {}, - "outputs": [], - "source": [ - "frequency_funds_tracts.head(2)" - ] - }, - { - "cell_type": "markdown", - "id": "819c793a-1d97-48dc-824f-a54609bfb08e", - "metadata": {}, - "source": [ - "## Single Function Difference" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c40bb284-e0c7-4572-8866-9c818c76045c", - "metadata": {}, - "outputs": [], - "source": [ - "target_frequencies = {'urban': 4, 'suburban': 2, 'rural': 1} ## {tract type: target trips per hour}" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "06c7af3b-2161-486c-97ae-6827971af20d", - "metadata": {}, - "outputs": [], - "source": [ - "frequency_funds_tracts = frequency_funds_tracts.dropna(subset=['tract_type']) ## very few na" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c9ffacae-e65d-4568-8f16-c572a918d2b8", - "metadata": {}, - "outputs": [], - "source": [ - "def calculate_additonal_trips(row, target_frequencies):\n", - " if row.trips_per_hour < target_frequencies[row.tract_type]:\n", - " additional_trips = (target_frequencies[row.tract_type]\n", - " - row.trips_per_hour)\n", - " else:\n", - " additional_trips = 0\n", - " row['additional_trips'] = additional_trips\n", - " return row" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "43dba7dc-0afb-4153-b0a8-c803b1bd43be", - "metadata": {}, - "outputs": [], - "source": [ - "with_new_trips = frequency_funds_tracts.apply(calculate_additonal_trips, axis=1, args=(target_frequencies,))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "36066f92-65a3-4df7-b202-1e05dff6c482", - "metadata": {}, - "outputs": [], - "source": [ - "with_new_trips.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "db7a3fc1-d7c3-400c-a389-236e5b461f55", - "metadata": {}, - "outputs": [], - "source": [ - "def annualize(row, cols):\n", - " for col in cols:\n", - " if row.day_name == 'Thursday':\n", - " col_annualized = row[f'{col}'] * 260 ## weekdays in year\n", - " else:\n", - " col_annualized = row[f'{col}'] * 52 ## saturdays or sundays in year\n", - " row[f'{col}_annualized'] = col_annualized\n", - " return row" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5a88a0e6-652f-4efb-b8ac-31127a9a8c02", - "metadata": {}, - "outputs": [], - "source": [ - "with_new_trips['service_hrs'] = (with_new_trips['mean_runtime_min'] * with_new_trips['trips_per_hour']) / 60 ## divide minutes to hours\n", - "with_new_trips['additional_service_hrs'] = (with_new_trips['mean_runtime_min'] * with_new_trips['additional_trips']) / 60" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "d4ae2f1e-0dd0-41b5-baf0-08a2d47a3d02", - "metadata": {}, - "outputs": [], - "source": [ - "with_new_trips.shape" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "89307134-0d5b-4aef-bab2-4739001f4cec", - "metadata": {}, - "outputs": [], - "source": [ - "with_new_trips = with_new_trips.apply(annualize, axis=1,\n", - " args=(['trips_per_hour', 'service_hrs',\n", - " 'additional_trips', 'additional_service_hrs'],)) ## bit slow; ~10min to run" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4162c35e-46a1-4fa3-90eb-a3f09c9c2feb", - "metadata": {}, - "outputs": [], - "source": [ - "with_new_trips.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "fc3cd291-b87f-4420-9711-acf9b42825d1", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator = with_new_trips.groupby(['calitp_itp_id', 'tract_type'])[['additional_service_hrs_annualized']].sum()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "e4be6b59-b04c-431f-94e7-7044c805b5df", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator = hours_by_operator >> arrange(-_.additional_service_hrs_annualized)\n", - "hours_by_operator['annual_service_cost'] = hours_by_operator['additional_service_hrs_annualized'] * 150 ## 85%ile for CA agencies in 2019 NTD" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8aaa5785-e4cf-4304-98b2-565ac56ea6ce", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator.groupby('tract_type')[['annual_service_cost', 'additional_service_hrs_annualized']].sum()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a5cffda9-229f-49d2-b865-1179f2881271", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator['annual_service_cost'].sum() / 1e9" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1614d93a-51b2-49dd-a721-73cc37c3577d", - "metadata": {}, - "outputs": [], - "source": [ - "# opex_df = service_funding_joined.reset_index().drop_duplicates(['calitp_itp_id', 'operating_expenses_total_2019'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "abc4d795-9278-4c54-9916-678179a74add", - "metadata": {}, - "outputs": [], - "source": [ - "## note these are existing hours for 5am-9pm span only\n", - "existing_hours = with_new_trips.groupby(['calitp_itp_id', 'transit_provider'])[['service_hrs_annualized']].sum()\n", - "existing_hours >> arrange(-_.service_hrs_annualized)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "30d2aff3-3d89-443c-83c4-a52b733d41e0", - "metadata": {}, - "outputs": [], - "source": [ - "## oh, we've filtered out a lot of overnight service! (hence the hour undercount and oddly high cost...)\n", - "## OK for now since 85%ile cost seems fine, otherwise could re-run and group above..." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a9a1dae9-d0b5-4703-a98e-135093bda772", - "metadata": {}, - "outputs": [], - "source": [ - "# opex_joined = opex_df.set_index('calitp_itp_id').join(existing_hours)\n", - "# opex_joined['cost_per_service_hr'] = opex_joined['operating_expenses_total_2019'] / opex_joined['service_hrs_annualized']\n", - "# opex_joined" - ] - }, - { - "cell_type": "markdown", - "id": "b7284bd4-bd3d-4682-a7ea-cdc8cc3d47e0", - "metadata": {}, - "source": [ - "### Bus Capital Expenditures" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3572e62d-61ab-4af1-85ec-5ee34ef8407d", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_metrics_2019 = pd.read_csv(f\"{GCS_FILE_PATH}ntd_metrics_2019.csv\") >> filter(_.State == 'CA')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "613e4a1a-c109-4ac6-b9f8-eed10f4b16fe", - "metadata": {}, - "outputs": [], - "source": [ - "# ntd_metrics_2019.columns" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a8827891-7680-45c2-8b53-94f04d8706ec", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "ntd_metrics_2019 = ntd_metrics_2019[['Agency', 'NTD ID','Mode', 'Vehicle Revenue Hours']]\n", - "ntd_metrics_2019.rename(columns={'NTD ID': 'ntd_id', 'Vehicle Revenue Hours': 'vrh'}, inplace=True)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1205852a-ea3c-4bd6-a0a8-e609879c7d1b", - "metadata": {}, - "outputs": [], - "source": [ - "def fix_vrh(value):\n", - " if type(value) != str:\n", - " return None\n", - " else:\n", - " return value.replace(',', '').strip()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "556ed520-ea5b-4b37-95bf-1d1d5ea20dca", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_metrics_2019['vrh'] = ntd_metrics_2019['vrh'].apply(fix_vrh).astype('int64')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0069b473-e46a-43d6-9e3c-436a6af1978d", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_metrics_2019" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "833360e3-ffac-4f96-9b1e-10229ee11207", - "metadata": {}, - "outputs": [], - "source": [ - "bus_modes = ['CB', 'MB', 'RB', 'TB']" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "1c7aca7e-6be5-4cb1-8250-6218bb3f5120", - "metadata": {}, - "outputs": [], - "source": [ - "total_vrh = ntd_metrics_2019 >> filter(_.Mode.isin(bus_modes)) >> group_by('Agency', 'ntd_id') >> summarize(total_vrh = _.vrh.sum())" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "4bc1e2ee-6b86-4b71-ba8c-a4f9dced87cb", - "metadata": {}, - "outputs": [], - "source": [ - "total_vrh.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "74c9e44e-845f-4fa2-b82c-451317d6f51a", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_vehicles_2019 = pd.read_csv(f\"{GCS_FILE_PATH}ntd_vehicles_2019.csv\") >> filter(_.State == 'CA')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a56bd449-135f-4397-adc0-049be016ab5e", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_vehicles = ntd_vehicles_2019[['NTD ID', 'Bus', 'Articulated Bus', 'Over-The-Road Bus',\n", - " 'Double Decker Bus', 'Trolleybus']]\n", - "ntd_vehicles.rename(columns={'NTD ID': 'ntd_id', 'Bus': 'bus', 'Articulated Bus': 'artic_bus',\n", - " 'Over-The-Road Bus': 'otr_bus', 'Double Decker Bus':'dbl_deck_bus',\n", - " 'Trolleybus': 'trolleybus'}, inplace=True)\n", - "ntd_vehicles['bus'] = ntd_vehicles['bus'].str.replace(',', '')\n", - "ntd_vehicles = ntd_vehicles.astype({'bus': 'int64', 'artic_bus': 'int64', 'otr_bus': 'int64',\n", - " 'dbl_deck_bus': 'int64', 'trolleybus': 'int64'})" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "6de231f7-2811-45fd-ba78-c11ab7390680", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_joined = ntd_vehicles >> inner_join(_, total_vrh, on='ntd_id')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "79ac1719-5b5b-4f33-bccb-74d35037a735", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_joined['total_buses'] = ntd_joined[['bus', 'artic_bus', 'otr_bus', 'dbl_deck_bus', 'trolleybus']].sum(axis=1)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3f8529da-2cc8-4479-b4cf-2e507e5d537c", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_joined = ntd_joined[ntd_joined['total_buses'] > 5] ## filter outliers with very small fleets" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3b618120-748c-4fd9-9d0d-5c6cc93ec3ab", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_joined['vrh_per_bus'] = ntd_joined['total_vrh'] / ntd_joined['total_buses']" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3fc4253f-7a7a-4ee4-afd1-858d4c1e27a9", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_joined['vrh_per_bus'].median()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "c6176e6a-fa28-44a9-a92a-7b93366d1e37", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_joined[['total_vrh', 'vrh_per_bus']].plot(x='total_vrh', y='vrh_per_bus', kind='scatter')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8ce1a60e-d0e3-4f89-8524-d12e2fc8ac76", - "metadata": {}, - "outputs": [], - "source": [ - "ntd_joined >> arrange(-_.vrh_per_bus)" - ] - }, - { - "cell_type": "markdown", - "id": "062c5ea9-1cbe-4232-bc06-e990f72fc030", - "metadata": {}, - "source": [ - "### Methodology notes\n", - "\n", - "* filtered to buses\n", - "* all 2019 NTD data\n", - "* using 12 year useful life\n", - "* bus cost:\n", - " * based on CARB Innovative Clean Transit cost model for a 40', 550kWh electric bus in 2022\n", - " * Inclusive of charger and maintenance infrastructure upgrades, but not potential land aquisition costs for expanded facilities." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b2eae10d-21db-4742-90a8-56c70216196d", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "0130b5a5-80c3-4970-af35-699cd95b89dc", - "metadata": {}, - "outputs": [], - "source": [ - "bus_cost = 776941 ## https://ww2.arb.ca.gov/resources/documents/transit-fleet-cost-model" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2e72a55c-3604-4d2f-82ed-2d9fe0746663", - "metadata": {}, - "outputs": [], - "source": [ - "median_vrh_per_bus = ntd_joined['vrh_per_bus'].median()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "67dbbf3a-9554-470e-a7ec-6e0c42ff0ba0", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator['additional_buses'] = hours_by_operator['additional_service_hrs_annualized'] / median_vrh_per_bus" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "00c42596-7331-451c-96b8-f4e5f66a6e06", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator['bus_capex'] = hours_by_operator['additional_buses'] * bus_cost" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "3f77b96f-82bf-46a2-bea9-327c7c28740c", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator['bus_capex_annualized'] = hours_by_operator['bus_capex'] / 14 ## 14 year service life" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "46b39a08-8857-4725-8f75-e300e453ca04", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "db35ca89-4ae6-413a-8704-d612d5c9f531", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator.groupby('tract_type').sum()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "2086d777-52a0-4197-887d-8e63642fe8a8", - "metadata": {}, - "outputs": [], - "source": [ - "hours_by_operator.sum()" - ] - }, - { - "cell_type": "markdown", - "id": "327820e6-19b3-4ec6-b600-ea426d94c0fd", - "metadata": {}, - "source": [ - "### Sandbox" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "baa3272e-0927-409d-b89c-5d776c6fadee", - "metadata": {}, - "outputs": [], - "source": [ - "# tbl.transitstacks.provider_info() >> select(_.calitp_itp_id == _.itp_id, _.ntd_id) >> collect() >> inner_join(_, ntd_joined, on='ntd_id')" - ] } ], "metadata": { From c5756648475d63bae07b7cbb5f47f725e380514c Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Tue, 7 Dec 2021 01:07:05 +0000 Subject: [PATCH 08/24] start hqta revisions, siuba query error --- .../bus_corridors.ipynb | 299 +++++++-- .../combine_and_visualize.ipynb | 380 +++++------ .../point_exports_opr.ipynb | 606 ++++++++++++++++++ .../rail_ferry_brt.ipynb | 67 +- 4 files changed, 1101 insertions(+), 251 deletions(-) create mode 100644 high_quality_transit_areas/point_exports_opr.ipynb diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index c060d0d90..87bf082cb 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -17,72 +17,79 @@ "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.11.1)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.14.0)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.2.1)\n", + "Collecting pygeos\n", + " Using cached pygeos-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB)\n", + "Collecting ipyleaflet\n", + " Using cached ipyleaflet-0.15.0-py2.py3-none-any.whl (3.3 MB)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", + "Collecting xyzservices>=2021.8.1\n", + " Using cached xyzservices-2021.11.0-py3-none-any.whl (34 kB)\n", + "Collecting traittypes<3,>=0.2.1\n", + " Using cached traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB)\n", "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", + "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", + "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (58.3.0)\n", + "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", + "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.2)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.4.1)\n", "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", + "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.21)\n", - "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.2)\n", + "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.17.3)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", - "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", + "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", - "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.2.0)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.2)\n", + "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", + "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", + "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.14.6)\n", + "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.4)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.20)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", + "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", + "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", + "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" + "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n", + "Installing collected packages: xyzservices, traittypes, pygeos, ipyleaflet\n", + "Successfully installed ipyleaflet-0.15.0 pygeos-0.12.0 traittypes-0.2.1 xyzservices-2021.11.0\n" ] } ], @@ -92,10 +99,19 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -152,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -164,7 +180,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -176,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], @@ -201,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "e3d9fa0d-35b0-4a9c-8e45-c5114e5c09a1", "metadata": {}, "outputs": [], @@ -231,7 +247,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 12, "id": "65c74fbd-059f-4df8-a3a1-e6c1361489b7", "metadata": {}, "outputs": [], @@ -249,12 +265,13 @@ " >> filter(_.calitp_itp_id == int(itp_id)) >> collect())\n", " wednesday = wednesday >> arrange(-_.service_date)\n", " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.weekday() == 2)]\n", - " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.month < 12)]\n", - " wednesday = wednesday[wednesday['service_date'] == wednesday['service_date'].iloc[0]] ## pick most recent Wednesday from Nov or earlier\n", + " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.month == 12)] ## December\n", + " wednesday = wednesday[wednesday['service_date'] == wednesday['service_date'].iloc[0]] ## pick most recent Wednesday from Dec or earlier\n", " \n", " bus_routes = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " >> filter(_.route_type.isin(['3', '11'])) ## bus and trolleybus\n", + " # >> filter(_.route_type.isin(['3', '11'])) ## bus and trolleybus\n", + " >> filter(_.route_type == '3')\n", " >> select(_.route_id) >> collect())\n", " print('loaded bus routes')\n", " \n", @@ -292,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "id": "1049eee5-d4d9-43a1-9a84-c3bd3687f6d3", "metadata": {}, "outputs": [], @@ -313,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "id": "0d3207be-d38f-4f17-a97f-0f84cae25d77", "metadata": {}, "outputs": [], @@ -446,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "id": "9483141f-c197-4fc8-80f0-4efa8d2b44c4", "metadata": {}, "outputs": [], @@ -496,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 25, "id": "e9d94df4-21cd-46d6-a8ab-fe4d4c01d728", "metadata": {}, "outputs": [], @@ -506,24 +523,143 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 13, "id": "b1089592-7a20-4c3b-a27f-5eb6193213de", - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "loaded shapes\n", - "loaded bus routes\n", - "loaded trips\n", - "loaded stop times\n", - "loaded stops\n" + "loaded bus routes\n" + ] + }, + { + "ename": "AssertionError", + "evalue": "Unexpected param: (__[POSTCOMPILE_service_id_1])", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/tmp/ipykernel_44/1117417450.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlbt_views\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_operator_views\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m170\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/tmp/ipykernel_44/4270395868.py\u001b[0m in \u001b[0;36mget_operator_views\u001b[0;34m(itp_id)\u001b[0m\n\u001b[1;32m 29\u001b[0m >> collect())\n\u001b[1;32m 30\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 31\u001b[0;31m trips = (tbl.gtfs_schedule.trips()\n\u001b[0m\u001b[1;32m 32\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitp_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 33\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwednesday\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3505\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[0;32m-> 3507\u001b[0;31m [\n\u001b[0m\u001b[1;32m 3508\u001b[0m f._compiler_dispatch(\n\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[1;32m 3507\u001b[0m [\n\u001b[0;32m-> 3508\u001b[0;31m f._compiler_dispatch(\n\u001b[0m\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3510\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_subquery\u001b[0;34m(self, subquery, **kw)\u001b[0m\n\u001b[1;32m 2875\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_subquery\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2876\u001b[0m \u001b[0mkw\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"subquery\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvisit_alias\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2879\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_lateral\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_alias\u001b[0;34m(self, alias, asfrom, ashint, iscrud, fromhints, subquery, lateral, enclosing_alias, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 2834\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfroms\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0malias\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0malias_name\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2835\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2836\u001b[0;31m inner = alias.element._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2837\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlateral\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2838\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_service_id_1])" ] } ], "source": [ - "bbb_views = get_operator_views(300)" + "lbt_views = get_operator_views(170)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "908af6e2-bef2-4458-8125-67cd28454493", + "metadata": {}, + "outputs": [], + "source": [ + "bus_routes" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "a04ec0e7-df45-4d2f-b477-1f0cb2c6c6ca", + "metadata": {}, + "outputs": [], + "source": [ + "bus_routes = (tbl.gtfs_schedule.routes()\n", + " >> filter(_.calitp_itp_id == 170)\n", + " >> filter(_.route_type == '3', _.route_type == '11') ## bus and trolleybus\n", + " >> select(_.route_id) >> collect())" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "e7912a98-883b-4c6b-aedf-95533d9497c5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
route_id
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: [route_id]\n", + "Index: []" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bus_routes" ] }, { @@ -564,7 +700,7 @@ } ], "source": [ - "bbb_hqta = single_operator_hqta(300)" + "lbt_hqta = single_operator_hqta(300)" ] }, { @@ -628,7 +764,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 3, "id": "7968cab1-fb27-43b7-ad4c-4b84e03cee81", "metadata": {}, "outputs": [], @@ -1452,7 +1588,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 4, "id": "dd0aada1-9341-4837-978b-0e4c01bec26a", "metadata": {}, "outputs": [], @@ -1462,7 +1598,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "id": "007242a3-d4d2-4acd-8bff-169fc513ad2b", "metadata": {}, "outputs": [], @@ -1472,7 +1608,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 6, "id": "e85121b8-8052-4bd2-9270-fc7462700a58", "metadata": {}, "outputs": [], @@ -1482,7 +1618,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "id": "baaa3b22-d2dd-4afb-a081-e666a0037e8e", "metadata": {}, "outputs": [], @@ -1492,7 +1628,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 8, "id": "090dd0b2-4de3-47b0-abed-9d16356bbf2c", "metadata": {}, "outputs": [], @@ -1500,6 +1636,41 @@ "dissolved = dissolved[dissolved['geometry'].area > 50*3000] ##50m width * 3000m shape min" ] }, + { + "cell_type": "code", + "execution_count": 37, + "id": "ca18f616-9719-458d-beb6-e3aa7492fd32", + "metadata": {}, + "outputs": [], + "source": [ + "dissolved = gpd.read_parquet(f'{GCS_FILE_PATH}shape_hqta_dissolve.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "b340161b-cd68-4cef-90ba-7f9f83fe30b0", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "4affcd4b579e4b049b95f07f8e24a36f", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[33.596015707487744, -117.87571863402819], controls=(ZoomControl(options=['position', 'zoom_in_text…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "map_hqta(dissolved)" + ] + }, { "cell_type": "code", "execution_count": 14, diff --git a/high_quality_transit_areas/combine_and_visualize.ipynb b/high_quality_transit_areas/combine_and_visualize.ipynb index a8ac4cfd1..19ba79e8b 100644 --- a/high_quality_transit_areas/combine_and_visualize.ipynb +++ b/high_quality_transit_areas/combine_and_visualize.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 6, + "execution_count": 1, "id": "7f9e615b-d071-4728-b774-1d02f509c332", "metadata": { "collapsed": true, @@ -17,71 +17,72 @@ "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.11.1)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.14.0)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.2.1)\n", + "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", + "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", + "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", - "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (58.3.0)\n", + "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", + "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", + "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", + "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", + "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.2)\n", - "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", + "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.4.1)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.21)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", + "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.2)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.17.3)\n", - "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", - "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", + "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", + "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.2)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.2.0)\n", + "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", + "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.14.6)\n", + "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.4)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", + "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", + "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.20)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", + "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" ] } @@ -100,7 +101,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.0-CAPI-1.16.0). Conversions between both will be slow.\n", + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", " warnings.warn(\n" ] } @@ -124,7 +125,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 3, "id": "e31ad027-1acc-44f8-bdd6-31f1b9b36a77", "metadata": {}, "outputs": [], @@ -136,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 4, "id": "bcbea24e-ab7e-400a-8813-6a477471c1d6", "metadata": {}, "outputs": [], @@ -147,62 +148,53 @@ }, { "cell_type": "code", - "execution_count": 5, - "id": "0e807584-dfb2-4385-b274-7276b0bc38d0", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, - "tags": [] - }, + "execution_count": 7, + "id": "6aec4721-0827-40f3-be60-0790916b0385", + "metadata": {}, "outputs": [ { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] + "data": { + "text/plain": [ + "Index(['stop_id', 'calitp_itp_id', 'stop_lat', 'stop_lon', 'itp_id_stop_id',\n", + " 'itp_id_trip_id', 'route_id', 'itp_id_route_id', 'trip_id', 'geometry',\n", + " 'calitp_url_number', 'route_type', 'agency_id', 'route_short_name',\n", + " 'route_long_name', 'route_desc', 'route_url', 'route_color',\n", + " 'route_text_color', 'route_sort_order', 'continuous_pickup',\n", + " 'continuous_drop_off', 'calitp_extracted_at', 'hqta_type'],\n", + " dtype='object')" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "geoparquet_gcs_export(bus_hqtc, 'bus_hqtc')" + "rail_ferry_brt_stops.columns" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, + "id": "0e807584-dfb2-4385-b274-7276b0bc38d0", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# geoparquet_gcs_export(bus_hqtc, 'bus_hqtc')" + ] + }, + { + "cell_type": "code", + "execution_count": 11, "id": "3b9a9f5e-6371-4367-978c-c0be0e6d979f", "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, "tags": [] }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], + "outputs": [], "source": [ - "geoparquet_gcs_export(rail_ferry_brt_stops, 'rail_ferry_brt_stops')" + "# geoparquet_gcs_export(rail_ferry_brt_stops, 'rail_ferry_brt_stops')" ] }, { @@ -245,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "441de95c-34c4-46bd-a95c-bfa0fd0338ea", "metadata": {}, "outputs": [ @@ -273,61 +265,53 @@ " hq_transit_corr\n", " shape_id\n", " geometry\n", - " level_0\n", " calitp_itp_id\n", " hqta_segment_id\n", - " n_trips\n", " segment_sequence\n", " stop_id\n", - " am_peak\n", - " pm_peak\n", + " am_max_trips\n", + " pm_max_trips\n", " hqta_type\n", " \n", " \n", " \n", " \n", - " 2464\n", + " 2256\n", " True\n", - " 0500\n", - " MULTIPOLYGON (((193308.696 -465893.120, 193308...\n", - " 0\n", - " 142\n", - " 2197551287\n", - " 134.0\n", + " 01582b61-5a02-4e6c-bd37-bad46bb036a9\n", + " POLYGON ((-133311.510 166655.910, -133353.419 ...\n", + " 48\n", + " 1937384376\n", " 0\n", - " 3977\n", - " 9.0\n", + " 12f4ecb6-c161-480e-8ec2-d7e3b63c7e38\n", + " 7.0\n", " 8.0\n", " hq_transit_corr\n", " \n", " \n", - " 2466\n", + " 2257\n", " True\n", - " 10\n", - " MULTIPOLYGON (((170627.569 -429628.875, 170627...\n", + " 0500\n", + " POLYGON ((212373.929 -486798.063, 212402.264 -...\n", + " 142\n", + " 4126984225\n", " 1\n", - " 243\n", - " 2088216280\n", - " 64.0\n", - " 2\n", - " 604\n", - " 4.7\n", + " 4654\n", " 5.0\n", + " 7.0\n", " hq_transit_corr\n", " \n", " \n", - " 2467\n", + " 2258\n", " True\n", - " 100706_SEPT21\n", - " MULTIPOLYGON (((149722.349 -435846.031, 149624...\n", + " 0843\n", + " MULTIPOLYGON (((200815.723 -472198.343, 200811...\n", + " 142\n", + " 1555422069\n", " 0\n", - " 182\n", - " 2368710740\n", - " 120.0\n", - " 1\n", - " 16374\n", + " 6679\n", + " 5.0\n", " 6.0\n", - " 8.0\n", " hq_transit_corr\n", " \n", " \n", @@ -335,28 +319,28 @@ "" ], "text/plain": [ - " hq_transit_corr shape_id \\\n", - "2464 True 0500 \n", - "2466 True 10 \n", - "2467 True 100706_SEPT21 \n", + " hq_transit_corr shape_id \\\n", + "2256 True 01582b61-5a02-4e6c-bd37-bad46bb036a9 \n", + "2257 True 0500 \n", + "2258 True 0843 \n", "\n", - " geometry level_0 \\\n", - "2464 MULTIPOLYGON (((193308.696 -465893.120, 193308... 0 \n", - "2466 MULTIPOLYGON (((170627.569 -429628.875, 170627... 1 \n", - "2467 MULTIPOLYGON (((149722.349 -435846.031, 149624... 0 \n", + " geometry calitp_itp_id \\\n", + "2256 POLYGON ((-133311.510 166655.910, -133353.419 ... 48 \n", + "2257 POLYGON ((212373.929 -486798.063, 212402.264 -... 142 \n", + "2258 MULTIPOLYGON (((200815.723 -472198.343, 200811... 142 \n", "\n", - " calitp_itp_id hqta_segment_id n_trips segment_sequence stop_id \\\n", - "2464 142 2197551287 134.0 0 3977 \n", - "2466 243 2088216280 64.0 2 604 \n", - "2467 182 2368710740 120.0 1 16374 \n", + " hqta_segment_id segment_sequence stop_id \\\n", + "2256 1937384376 0 12f4ecb6-c161-480e-8ec2-d7e3b63c7e38 \n", + "2257 4126984225 1 4654 \n", + "2258 1555422069 0 6679 \n", "\n", - " am_peak pm_peak hqta_type \n", - "2464 9.0 8.0 hq_transit_corr \n", - "2466 4.7 5.0 hq_transit_corr \n", - "2467 6.0 8.0 hq_transit_corr " + " am_max_trips pm_max_trips hqta_type \n", + "2256 7.0 8.0 hq_transit_corr \n", + "2257 5.0 7.0 hq_transit_corr \n", + "2258 5.0 6.0 hq_transit_corr " ] }, - "execution_count": 9, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -367,7 +351,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "f104e680-a949-4e07-a4dd-19950207c66f", "metadata": {}, "outputs": [], @@ -389,7 +373,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "96caf70f-e497-4df4-9b1a-20b54f7b7f83", "metadata": {}, "outputs": [], @@ -399,7 +383,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "cdb9023e-8397-4eed-b829-0ab22ee26580", "metadata": {}, "outputs": [], @@ -409,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "id": "a54925c8-cb64-452f-b8ac-18407ed3f9d6", "metadata": {}, "outputs": [], @@ -419,7 +403,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 10, "id": "c3f748fa-861d-4d7c-b005-480d6ecc30a2", "metadata": {}, "outputs": [], @@ -429,7 +413,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 11, "id": "ca09eb4e-97b4-48b6-ba21-542ac35c8ceb", "metadata": {}, "outputs": [], @@ -448,7 +432,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 12, "id": "82e5d819-63dc-4ba3-a9f9-c314f5a4ca33", "metadata": {}, "outputs": [], @@ -458,7 +442,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 28, "id": "6273ed98-b5a2-4e83-bfac-9f487f8c6142", "metadata": {}, "outputs": [], @@ -479,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 29, "id": "c35ed21e-d6e0-42cf-8bd5-e4792d5d3c14", "metadata": {}, "outputs": [], @@ -489,7 +473,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 30, "id": "2df43e17-9ca0-4c46-b6a1-92d77ec98d3a", "metadata": { "tags": [] @@ -744,7 +728,7 @@ "[349 rows x 12 columns]" ] }, - "execution_count": 41, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -755,7 +739,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 31, "id": "6ab04e63-f673-48d4-bf1a-d01d203f5b33", "metadata": {}, "outputs": [], @@ -765,17 +749,17 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 32, "id": "92d2df98-49d9-4786-bd53-df2ddc107354", "metadata": {}, "outputs": [], "source": [ - "row_per_stop = row_per_stop[['calitp_itp_id', 'geometry']]" + "row_per_stop = row_per_stop[['calitp_itp_id', 'stop_id', 'geometry']]" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 33, "id": "faaa147d-ae1e-4b9b-a7a2-ff462a3c66fd", "metadata": {}, "outputs": [], @@ -785,7 +769,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 34, "id": "3e574e12-8017-4867-9230-8fa891e914bb", "metadata": {}, "outputs": [], @@ -795,7 +779,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 35, "id": "d01200cc-cda2-4635-af68-3b8448e70b5a", "metadata": {}, "outputs": [ @@ -821,6 +805,7 @@ " \n", " \n", " calitp_itp_id\n", + " stop_id\n", " geometry\n", " hqta_type\n", " \n", @@ -829,18 +814,21 @@ " \n", " 0\n", " 142\n", + " 3977\n", " POINT (199058.382 -471125.032)\n", " major_transit_stop\n", " \n", " \n", " 1\n", " 142\n", + " 3977\n", " POINT (198531.592 -471368.189)\n", " major_transit_stop\n", " \n", " \n", " 2\n", " 142\n", + " 3977\n", " POINT (193068.693 -465847.391)\n", " major_transit_stop\n", " \n", @@ -849,13 +837,13 @@ "" ], "text/plain": [ - " calitp_itp_id geometry hqta_type\n", - "0 142 POINT (199058.382 -471125.032) major_transit_stop\n", - "1 142 POINT (198531.592 -471368.189) major_transit_stop\n", - "2 142 POINT (193068.693 -465847.391) major_transit_stop" + " calitp_itp_id stop_id geometry hqta_type\n", + "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop\n", + "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop\n", + "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop" ] }, - "execution_count": 46, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -866,7 +854,31 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 36, + "id": "5bbfaa07-f16c-46a9-ae5e-338a5b7f5d8b", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], + "source": [ + "geoparquet_gcs_export(row_per_stop, 'major_bus_stops')" + ] + }, + { + "cell_type": "code", + "execution_count": 24, "id": "dcccae17-5f35-4fc4-a5dc-0e5cf45e2f25", "metadata": {}, "outputs": [], @@ -876,7 +888,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 25, "id": "19f9b7dd-1b2b-4c7a-9ba9-3e1e1e9b46be", "metadata": { "tags": [] @@ -895,7 +907,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 26, "id": "7d959fef-e315-4985-b3fd-72192096a691", "metadata": {}, "outputs": [], @@ -908,7 +920,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 27, "id": "909f1b0f-0d99-4713-90e5-cf86e7bcab1e", "metadata": {}, "outputs": [], @@ -942,7 +954,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 28, "id": "e13cb57b-0905-4b8c-9f8f-d6d87c09c533", "metadata": {}, "outputs": [], @@ -954,7 +966,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 29, "id": "da513fe3-7893-48a1-b33b-de36e5c97443", "metadata": {}, "outputs": [], @@ -968,7 +980,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 30, "id": "96ea1b81-97d2-4d9f-986b-cb82fcb1d481", "metadata": {}, "outputs": [], @@ -988,7 +1000,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 31, "id": "e25ad411-6ea1-4232-bb47-6df3bb1f4167", "metadata": {}, "outputs": [], @@ -1001,7 +1013,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 32, "id": "fe2aeb20-1714-4543-ba8b-8d655ea1efa4", "metadata": {}, "outputs": [], @@ -1011,19 +1023,41 @@ }, { "cell_type": "code", - "execution_count": 190, + "execution_count": 6, + "id": "92d5b4c7-6723-471f-bafa-dada933393f7", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "all_hqta = gpd.read_parquet(f'{GCS_FILE_PATH}ca_high_quality_transit.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "be750b0a-11e8-4905-bc62-6d2b7462a11a", + "metadata": {}, + "outputs": [], + "source": [ + "metro = bus_hqtc >> filter(_.calitp_itp_id == '182')" + ] + }, + { + "cell_type": "code", + "execution_count": 18, "id": "a3adc41e-90f1-4117-8e49-938c4c838a8d", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "4c92e1550b174cb0abb9a992ac7f0e41", + "model_id": "4399525e0c1b47be87a271b99c3093b7", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "Map(center=[33.741232185414454, -117.84488376191148], controls=(ZoomControl(options=['position', 'zoom_in_text…" + "Map(center=[34.078792878404975, -118.30956119336547], controls=(ZoomControl(options=['position', 'zoom_in_text…" ] }, "metadata": {}, @@ -1031,31 +1065,15 @@ } ], "source": [ - "map_hqta(all_hqta, 'hqta_type')" + "map_hqta(metro, 'pm_max_trips')" ] }, { "cell_type": "code", - "execution_count": 191, + "execution_count": null, "id": "f614dc84-c6c1-482e-a6eb-d621ccb3af67", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/tmp/ipykernel_46/4200137629.py:1: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " all_hqta.to_parquet('./data/combined/ca_high_quality_transit.parquet')\n", - "/tmp/ipykernel_46/4200137629.py:3: UserWarning: Column names longer than 10 characters will be truncated when saved to ESRI Shapefile.\n", - " all_hqta.to_file('./data/combined/ca_high_quality_transit/ca_high_quality_transit.shp')\n" - ] - } - ], + "outputs": [], "source": [ "geoparquet_gcs_export(all_hqta, 'ca_high_quality_transit')\n", "# all_hqta.to_file('./ca_high_quality_transit.geojson', driver='GeoJSON')\n", diff --git a/high_quality_transit_areas/point_exports_opr.ipynb b/high_quality_transit_areas/point_exports_opr.ipynb new file mode 100644 index 000000000..6a08e38d9 --- /dev/null +++ b/high_quality_transit_areas/point_exports_opr.ipynb @@ -0,0 +1,606 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "4a93602d-4289-4d8f-b037-28f244972772", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], + "source": [ + "import calitp\n", + "from calitp.tables import tbl\n", + "from siuba import *\n", + "\n", + "import pandas as pd\n", + "import numpy as np\n", + "import geopandas as gpd\n", + "import fiona\n", + "import shapely\n", + "\n", + "from ipyleaflet import Map, GeoJSON, projections, basemaps, GeoData, LayersControl, WidgetControl, GeoJSON\n", + "from ipywidgets import Text, HTML\n", + "\n", + "from utilities import *" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "e497dcce-0705-4b97-9968-47119cdf386e", + "metadata": {}, + "outputs": [], + "source": [ + "major_bus = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops.parquet')\n", + "major_bus['mode'] = 'bus'" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "12d40de1-7beb-4126-b9ee-14ba288d347f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idgeometryhqta_typemode
01423977POINT (199058.382 -471125.032)major_transit_stopbus
11423977POINT (198531.592 -471368.189)major_transit_stopbus
21423977POINT (193068.693 -465847.391)major_transit_stopbus
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id geometry hqta_type \\\n", + "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop \n", + "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop \n", + "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop \n", + "\n", + " mode \n", + "0 bus \n", + "1 bus \n", + "2 bus " + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "major_bus.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d3bda835-a20f-4ad7-9279-0b9f10f36a93", + "metadata": {}, + "outputs": [], + "source": [ + "## rail/ferry/brt explicitly by mode" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "774a2131-9fdc-4386-a003-6310d9ef8c9b", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_stops = gpd.read_parquet(f'{GCS_FILE_PATH}rail_brt_ferry.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "29a747be-1fe6-4d83-b65d-da06a1378cf0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['stop_id', 'calitp_itp_id', 'stop_lat', 'stop_lon', 'itp_id_stop_id',\n", + " 'itp_id_trip_id', 'route_id', 'itp_id_route_id', 'trip_id', 'geometry',\n", + " 'calitp_url_number', 'route_type', 'agency_id', 'route_short_name',\n", + " 'route_long_name', 'route_desc', 'route_url', 'route_color',\n", + " 'route_text_color', 'route_sort_order', 'continuous_pickup',\n", + " 'continuous_drop_off', 'calitp_extracted_at'],\n", + " dtype='object')" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "956999cb-3445-48d1-9aa3-5c0e3ae32dbc", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_stops['route_type'] = rail_ferry_brt_stops['route_type'].fillna('99')" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "id": "f43e3337-4026-406d-85cc-fcd11d8e1661", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idroute_typen
02414
14367
2109910
31399523
41545
54145
6569918
712744
8182355
91829995
10200419
1120099546
122269931
13232329
142469960
1527399104
1627843
1727899121
182799950
19280424
202819910
2128299265
2229499120
233159912
243239962
2533843
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id route_type n\n", + "0 2 4 14\n", + "1 4 3 67\n", + "2 10 99 10\n", + "3 13 99 523\n", + "4 15 4 5\n", + "5 41 4 5\n", + "6 56 99 18\n", + "7 127 4 4\n", + "8 182 3 55\n", + "9 182 99 95\n", + "10 200 4 19\n", + "11 200 99 546\n", + "12 226 99 31\n", + "13 232 3 29\n", + "14 246 99 60\n", + "15 273 99 104\n", + "16 278 4 3\n", + "17 278 99 121\n", + "18 279 99 50\n", + "19 280 4 24\n", + "20 281 99 10\n", + "21 282 99 265\n", + "22 294 99 120\n", + "23 315 99 12\n", + "24 323 99 62\n", + "25 338 4 3" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops >> count(_.calitp_itp_id, _.route_type)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "71a2646b-0a53-48e4-ac35-586b2dda3dd3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idcalitp_itp_idroute_type
0CRN13None
1MKA13None
2OKJ13None
3PLO13None
4QCY13None
............
742483569414
77GF:430002004
78GF:430032004
79GF:430042004
80GF:430072004
\n", + "

2255 rows × 3 columns

\n", + "
" + ], + "text/plain": [ + " stop_id calitp_itp_id route_type\n", + "0 CRN 13 None\n", + "1 MKA 13 None\n", + "2 OKJ 13 None\n", + "3 PLO 13 None\n", + "4 QCY 13 None\n", + ".. ... ... ...\n", + "74 2483569 41 4\n", + "77 GF:43000 200 4\n", + "78 GF:43003 200 4\n", + "79 GF:43004 200 4\n", + "80 GF:43007 200 4\n", + "\n", + "[2255 rows x 3 columns]" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops[['stop_id', 'calitp_itp_id', 'route_type']]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b2511687-caf3-4984-91a4-6c0cdeceedd0", + "metadata": {}, + "outputs": [], + "source": [ + "## other stops within hq bus corridor (mode=bus)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "34662e06-2545-48bd-a75d-4f63e2639cb7", + "metadata": {}, + "outputs": [], + "source": [ + "bus_hqtc = gpd.read_parquet(f'{GCS_FILE_PATH}shape_hqta_dissolve.parquet')\n", + "bus_hqtc = bus_hqtc[bus_hqtc['hq_transit_corr']]\n", + "bus_hqtc['hqta_type'] = 'hq_transit_corr'" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "1b71b26f-71ef-449a-a520-7b2a1c8929e3", + "metadata": {}, + "outputs": [], + "source": [ + "all_stops = tbl.gtfs_schedule.stops() >> collect()\n", + "all_stops = gpd.GeoDataFrame(all_stops,\n", + " geometry = gpd.points_from_xy(all_stops.stop_lon, all_stops.stop_lat),\n", + " crs = 'EPSG:4326')" + ] + } + ], + "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.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 2ce4cf7e8..67dcf8776 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,10 +2,19 @@ "cells": [ { "cell_type": "code", - "execution_count": 26, + "execution_count": 1, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -54,14 +63,60 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", - "metadata": {}, - "outputs": [], + "metadata": { + "collapsed": true, + "jupyter": { + "outputs_hidden": true + }, + "tags": [] + }, + "outputs": [ + { + "ename": "AssertionError", + "evalue": "Unexpected param: (__[POSTCOMPILE_route_type_1])", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/tmp/ipykernel_281/2695592209.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m rail_routes = (tbl.gtfs_schedule.routes()\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'0'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m >> collect())\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_route_type_1])" + ] + } + ], "source": [ "rail_routes = (tbl.gtfs_schedule.routes()\n", " >> filter(_.route_type.isin(['0', '1', '2']))\n", - " >> select(_.calitp_itp_id, _.route_id)\n", + " >> select(_.calitp_itp_id, _.route_id, _.route_type)\n", " >> collect())" ] }, From 3a0912658859d919b33fdf73c5c9bcbf79d61245 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 8 Dec 2021 19:10:29 +0000 Subject: [PATCH 09/24] fix+refactor rail_ferry_brt --- .../rail_ferry_brt.ipynb | 836 ++++++++---------- 1 file changed, 382 insertions(+), 454 deletions(-) diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 67dcf8776..55fc7534c 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -3,6 +3,93 @@ { "cell_type": "code", "execution_count": 1, + "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", + "metadata": { + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", + "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", + "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", + "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", + "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", + "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", + "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", + "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", + "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", + "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", + "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", + "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", + "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", + "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", + "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", + "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", + "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", + "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", + "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", + "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", + "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", + "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", + "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", + "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", + "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", + "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", + "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", + "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", + "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", + "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", + "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", + "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", + "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", + "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", + "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", + "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", + "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", + "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", + "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", + "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", + "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", + "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", + "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" + ] + } + ], + "source": [ + "!pip install -r requirements.txt" + ] + }, + { + "cell_type": "code", + "execution_count": 2, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, "outputs": [ @@ -58,121 +145,137 @@ "id": "6ddca2c1-c222-4a1c-9eeb-5fcbfd4c903f", "metadata": {}, "source": [ - "### Rail Service" + "### Rail Service\n", + "\n", + "* temporary workaround with dim tables, should use tbl.gtfs schedule but LA Metro rail not in" ] }, { "cell_type": "code", - "execution_count": 2, - "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, - "tags": [] - }, - "outputs": [ - { - "ename": "AssertionError", - "evalue": "Unexpected param: (__[POSTCOMPILE_route_type_1])", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_281/2695592209.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m rail_routes = (tbl.gtfs_schedule.routes()\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'0'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m >> collect())\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_route_type_1])" - ] - } - ], + "execution_count": 3, + "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", + "metadata": {}, + "outputs": [], "source": [ - "rail_routes = (tbl.gtfs_schedule.routes()\n", - " >> filter(_.route_type.isin(['0', '1', '2']))\n", - " >> select(_.calitp_itp_id, _.route_id, _.route_type)\n", - " >> collect())" + "rail_routes = (tbl.views.gtfs_schedule_dim_routes()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " >> filter(_.calitp_itp_id != 200) # avoid MTC feed in favor of individual operator feeds\n", + " >> filter((_.route_type == '0') |\n", + " (_.route_type == '1') |\n", + " (_.route_type == '2'))\n", + " # >> filter(_.calitp_itp_id == 182)\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type)\n", + " )" ] }, { "cell_type": "code", "execution_count": 4, - "id": "dbcf2c67-44e3-446a-94f3-9a1bb9b04fc6", + "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], "source": [ - "def routes_to_stops(df_routes):\n", - " df_routes['itp_id_route_id'] = df_routes.calitp_itp_id.astype(str) + df_routes.route_id\n", - " \n", - " df_trips = (tbl.gtfs_schedule.trips()\n", - " >> filter(_.calitp_itp_id.isin(df_routes.calitp_itp_id))\n", - " >> collect()\n", - " >> select(_.calitp_itp_id, _.route_id, _.trip_id)\n", - " >> filter(_.route_id.isin(df_routes.route_id)))\n", + "def routes_to_stops(routes_tbl):\n", " \n", - " df_trips['itp_id_route_id'] = df_trips.calitp_itp_id.astype(str) + df_trips.route_id\n", - " df_trips.drop(columns=['calitp_itp_id', 'route_id'], inplace=True)\n", - " \n", - " df_trips = df_routes >> inner_join(_, df_trips, on='itp_id_route_id')\n", - " df_trips['itp_id_trip_id'] = df_trips.calitp_itp_id.astype(str) + df_trips.trip_id\n", - " df_operators = [int(str(x)) for x in list(df_trips.calitp_itp_id.unique())]\n", - " \n", - " df_stop_times = (tbl.gtfs_schedule.stop_times()\n", - " >> filter(_.calitp_itp_id.isin(df_operators))\n", - " >> select(_.calitp_itp_id, _.stop_id, _.trip_id)\n", + " tbl_trips = (tbl.views.gtfs_schedule_dim_trips()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.trip_id)\n", + " # >> filter(_.calitp_itp_id == 182) ## LA Metro\n", + " # >> filter(_.route_id == '801') ## Metro A Line (Blue) LRT\n", + " >> inner_join(_, routes_tbl, on=['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type, _.trip_id)\n", + " # >> collect()\n", + " )\n", + "\n", + " tbl_st_times = (tbl.views.gtfs_schedule_dim_stop_times()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " # >> filter(_.calitp_itp_id.isin(df_operators))\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.trip_id)\n", + " >> inner_join(_, tbl_trips, on=['calitp_itp_id', 'calitp_url_number', 'trip_id'])\n", + " >> distinct(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.route_type)\n", + " )\n", + "\n", + " stops = (tbl.views.gtfs_schedule_dim_stops()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " >> select(_.calitp_itp_id, _.calitp_url_number,\n", + " _.stop_id, _.stop_lat, _.stop_lon)\n", + " >> inner_join(_, tbl_st_times,\n", + " on = ['calitp_itp_id', 'calitp_url_number', 'stop_id'])\n", " >> collect()\n", - " )\n", - " df_stop_times['itp_id_trip_id'] = df_stop_times.calitp_itp_id.astype(str) + df_stop_times.trip_id\n", - " df_stop_times.drop(columns=['calitp_itp_id', 'trip_id'], inplace=True)\n", - " df_stop_times = df_stop_times >> inner_join(_, df_trips, on='itp_id_trip_id')\n", - " df_stop_times = df_stop_times.drop_duplicates(subset=['stop_id', 'calitp_itp_id'])\n", - " df_stop_times['itp_id_stop_id'] = df_stop_times.calitp_itp_id.astype(str) + df_stop_times.stop_id\n", - " \n", - " df_stops = (tbl.gtfs_schedule.stops()\n", - " >> select(_.stop_id, _.calitp_itp_id, _.stop_lat, _.stop_lon)\n", - " >> filter(_.calitp_itp_id.isin(df_stop_times.calitp_itp_id))\n", - " >> collect()\n", - " )\n", - " \n", - " df_stops['itp_id_stop_id'] = df_stops.calitp_itp_id.astype(str) + df_stops.stop_id\n", - " df_stop_times.drop(columns=['calitp_itp_id', 'stop_id'], inplace=True)\n", - " df_stops = df_stops >> inner_join(_, df_stop_times, on='itp_id_stop_id')\n", - " df_stops = gpd.GeoDataFrame(df_stops,\n", - " geometry = gpd.points_from_xy(df_stops.stop_lon, df_stops.stop_lat),\n", - " crs = 'EPSG:4326')\n", - " return df_stops.to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)" + " )\n", + " stops = gpd.GeoDataFrame(stops,\n", + " geometry = gpd.points_from_xy(stops.stop_lon, stops.stop_lat),\n", + " crs = 'EPSG:4326').to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)\n", + " return stops" ] }, { "cell_type": "code", "execution_count": 5, - "id": "32b0a3a0-cb47-4b38-a5ef-ec4da9b94d3d", + "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# rail_routes = (tbl.gtfs_schedule.routes()\n", + "# >> filter((_.route_type == '0') |\n", + "# (_.route_type == '1') |\n", + "# (_.route_type == '2'))\n", + "# >> filter(_.calitp_itp_id == 182)\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type)\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", + "metadata": {}, + "outputs": [], + "source": [ + "# tbl_trips = (tbl.gtfs_schedule.trips() \n", + "# >> inner_join(_, rail_routes, on=['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type, _.trip_id)\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", + "metadata": {}, + "outputs": [], + "source": [ + "# tbl_st_times = (tbl.gtfs_schedule.stop_times()\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.trip_id)\n", + "# >> inner_join(_, tbl_trips, on=['calitp_itp_id', 'calitp_url_number', 'trip_id'])\n", + "# >> distinct(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.route_type)\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", + "metadata": {}, + "outputs": [], + "source": [ + "# rail_stops = (tbl.gtfs_schedule.stops()\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.stop_lat, _.stop_lon)\n", + "# >> inner_join(_, tbl_st_times, on = ['calitp_itp_id', 'calitp_url_number', 'stop_id'])\n", + "# >> collect()\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], "source": [ @@ -181,12 +284,27 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 10, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6dd08c23eb034e769c8317c27148dccf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[37.79790800531397, -121.26366399999999], controls=(ZoomControl(options=['position', 'zoom_in_text'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "# map_hqta(rail_stops)" + "map_hqta(rail_stops, 'route_type')" ] }, { @@ -203,20 +321,21 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], "source": [ "metro_brt = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == 182)\n", - " >> filter(_.route_id.isin(['901-13149', '910-13149']))\n", - " >> collect())" + " >> filter((_.route_id == '901-13149') |\n", + " (_.route_id =='910-13149'))\n", + " )" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 12, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -226,7 +345,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 13, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -243,7 +362,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 14, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -253,7 +372,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 15, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -263,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 16, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -271,12 +390,12 @@ "act_brt = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == 4)\n", " >> filter(_.route_id == '1T')\n", - " >> collect())" + " )" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 17, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -286,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 18, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -296,7 +415,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 19, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -304,12 +423,12 @@ "omni_brt = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == 232)\n", " >> filter(_.route_id == '9648')\n", - " >> collect())" + " )" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 20, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -319,7 +438,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 21, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -337,7 +456,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 22, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -345,12 +464,12 @@ "ferry = (tbl.gtfs_schedule.routes()\n", " >> filter(_.route_type == '4')\n", " # >> filter(_.route_id == '9648')\n", - " >> collect())" + " )" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 23, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -362,7 +481,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 24, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -380,7 +499,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 25, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -394,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 26, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, "outputs": [ @@ -419,149 +538,65 @@ " \n", " \n", " \n", - " stop_id\n", " calitp_itp_id\n", + " calitp_url_number\n", + " stop_id\n", " stop_lat\n", " stop_lon\n", - " itp_id_stop_id\n", - " itp_id_trip_id\n", - " route_id\n", - " itp_id_route_id\n", - " trip_id\n", + " route_type\n", " geometry\n", - " ...\n", - " route_short_name\n", - " route_long_name\n", - " route_desc\n", - " route_url\n", - " route_color\n", - " route_text_color\n", - " route_sort_order\n", - " continuous_pickup\n", - " continuous_drop_off\n", - " calitp_extracted_at\n", " \n", " \n", " \n", " \n", " 0\n", - " CRN\n", - " 13\n", - " 41.056920\n", - " -94.361617\n", - " 13CRN\n", - " 1352818299\n", - " 96\n", - " 1396\n", - " 52818299\n", - " POINT (2130400.260 627641.309)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400002\n", + " 37.797908\n", + " -121.263664\n", + " 2\n", + " POINT (-111116.950 -23544.700)\n", " \n", " \n", " 1\n", - " MKA\n", - " 13\n", - " 42.940583\n", - " -87.924359\n", - " 13MKA\n", - " 133412815756\n", - " 54\n", - " 1354\n", - " 3412815756\n", - " POINT (2577583.013 986856.496)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400001\n", + " 37.957058\n", + " -121.278948\n", + " 2\n", + " POINT (-112222.169 -5836.078)\n", " \n", " \n", " 2\n", - " OKJ\n", - " 13\n", - " 37.793866\n", - " -122.271667\n", - " 13OKJ\n", - " 135452816206\n", - " 84\n", - " 1384\n", - " 5452816206\n", - " POINT (-199750.592 -22341.380)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400003\n", + " 37.696468\n", + " -121.433869\n", + " 2\n", + " POINT (-126252.943 -34607.238)\n", " \n", " \n", " 3\n", - " PLO\n", - " 13\n", - " 41.662384\n", - " -88.538272\n", - " 13PLO\n", - " 133832815187\n", - " 93\n", - " 1393\n", - " 3832815187\n", - " POINT (2576234.283 836414.716)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400004.3\n", + " 37.657549\n", + " -121.882962\n", + " 2\n", + " POINT (-165877.168 -38241.179)\n", " \n", " \n", " 4\n", - " QCY\n", - " 13\n", - " 39.957063\n", - " -91.368525\n", - " 13QCY\n", - " 133832815187\n", - " 93\n", - " 1393\n", - " 3832815187\n", - " POINT (2408238.879 582112.897)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400004.1\n", + " 37.697081\n", + " -121.717648\n", + " 2\n", + " POINT (-151236.096 -34123.815)\n", " \n", " \n", " ...\n", @@ -572,242 +607,93 @@ " ...\n", " ...\n", " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", " \n", " \n", - " 74\n", - " 2483569\n", + " 28\n", " 41\n", - " 37.856636\n", - " -122.478275\n", - " 412483569\n", - " 41t_373938_b_28421_tn_0\n", - " 11643\n", - " 4111643\n", - " t_373938_b_28421_tn_0\n", - " POINT (-217731.552 -14910.728)\n", - " ...\n", - " None\n", - " Pier 41 - Sausalito - Tiburon - Angel Island\n", - " None\n", - " None\n", - " f5cb04\n", - " 000000\n", - " 3\n", - " 1\n", - " 1\n", - " 2021-05-03\n", + " 0\n", + " 2483549\n", + " 37.872939\n", + " -122.455446\n", + " 4\n", + " POINT (-215679.403 -13151.168)\n", " \n", " \n", - " 77\n", - " GF:43000\n", - " 200\n", - " 37.795869\n", - " -122.392450\n", - " 200GF:43000\n", - " 200GF:7296302\n", - " GF:SF\n", - " 200GF:SF\n", - " GF:7296302\n", - " POINT (-210363.380 -21857.544)\n", - " ...\n", - " SF\n", - " Sausalito - San Francisco Ferry\n", - " None\n", - " http://goldengateferry.org/schedules/Sausalito...\n", - " 0000FF\n", - " FFFFFF\n", + " 29\n", + " 41\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 2483569\n", + " 37.856636\n", + " -122.478275\n", + " 4\n", + " POINT (-217731.552 -14910.728)\n", " \n", " \n", - " 78\n", - " GF:43003\n", - " 200\n", - " 37.856401\n", - " -122.478251\n", - " 200GF:43003\n", - " 200GF:7296302\n", - " GF:SF\n", - " 200GF:SF\n", - " GF:7296302\n", - " POINT (-217730.126 -14936.899)\n", - " ...\n", - " SF\n", - " Sausalito - San Francisco Ferry\n", - " None\n", - " http://goldengateferry.org/schedules/Sausalito...\n", - " 0000FF\n", - " FFFFFF\n", + " 31\n", + " 338\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 818729\n", + " 37.770840\n", + " -122.385791\n", + " 4\n", + " POINT (-209847.993 -24653.833)\n", " \n", " \n", - " 79\n", - " GF:43004\n", - " 200\n", - " 37.945316\n", - " -122.508735\n", - " 200GF:43004\n", - " 200GF:7296280\n", - " GF:LF\n", - " 200GF:LF\n", - " GF:7296280\n", - " POINT (-220146.197 -4985.515)\n", - " ...\n", - " LF\n", - " Larkspur - San Francisco Ferry\n", - " None\n", - " http://goldengateferry.org/schedules/Larkspur.php\n", - " 0000FF\n", - " FFFFFF\n", + " 32\n", + " 338\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 818733\n", + " 37.864540\n", + " -122.313932\n", + " 4\n", + " POINT (-203274.531 -14397.269)\n", " \n", " \n", - " 80\n", - " GF:43007\n", - " 200\n", - " 37.872770\n", - " -122.455928\n", - " 200GF:43007\n", - " 200GF:7309934\n", - " GF:TF\n", - " 200GF:TF\n", - " GF:7309934\n", - " POINT (-215722.217 -13168.852)\n", - " ...\n", - " TF\n", - " Tiburon - San Francisco Ferry\n", - " None\n", - " None\n", - " 0000FF\n", - " FFFFFF\n", + " 33\n", + " 338\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 818727\n", + " 37.797482\n", + " -122.395025\n", + " 4\n", + " POINT (-210585.228 -21672.628)\n", " \n", " \n", "\n", - "

2255 rows × 23 columns

\n", + "

1324 rows × 7 columns

\n", "" ], "text/plain": [ - " stop_id calitp_itp_id stop_lat stop_lon itp_id_stop_id \\\n", - "0 CRN 13 41.056920 -94.361617 13CRN \n", - "1 MKA 13 42.940583 -87.924359 13MKA \n", - "2 OKJ 13 37.793866 -122.271667 13OKJ \n", - "3 PLO 13 41.662384 -88.538272 13PLO \n", - "4 QCY 13 39.957063 -91.368525 13QCY \n", - ".. ... ... ... ... ... \n", - "74 2483569 41 37.856636 -122.478275 412483569 \n", - "77 GF:43000 200 37.795869 -122.392450 200GF:43000 \n", - "78 GF:43003 200 37.856401 -122.478251 200GF:43003 \n", - "79 GF:43004 200 37.945316 -122.508735 200GF:43004 \n", - "80 GF:43007 200 37.872770 -122.455928 200GF:43007 \n", - "\n", - " itp_id_trip_id route_id itp_id_route_id trip_id \\\n", - "0 1352818299 96 1396 52818299 \n", - "1 133412815756 54 1354 3412815756 \n", - "2 135452816206 84 1384 5452816206 \n", - "3 133832815187 93 1393 3832815187 \n", - "4 133832815187 93 1393 3832815187 \n", - ".. ... ... ... ... \n", - "74 41t_373938_b_28421_tn_0 11643 4111643 t_373938_b_28421_tn_0 \n", - "77 200GF:7296302 GF:SF 200GF:SF GF:7296302 \n", - "78 200GF:7296302 GF:SF 200GF:SF GF:7296302 \n", - "79 200GF:7296280 GF:LF 200GF:LF GF:7296280 \n", - "80 200GF:7309934 GF:TF 200GF:TF GF:7309934 \n", + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "0 10 0 3400002 37.797908 -121.263664 \n", + "1 10 0 3400001 37.957058 -121.278948 \n", + "2 10 0 3400003 37.696468 -121.433869 \n", + "3 10 0 3400004.3 37.657549 -121.882962 \n", + "4 10 0 3400004.1 37.697081 -121.717648 \n", + ".. ... ... ... ... ... \n", + "28 41 0 2483549 37.872939 -122.455446 \n", + "29 41 0 2483569 37.856636 -122.478275 \n", + "31 338 0 818729 37.770840 -122.385791 \n", + "32 338 0 818733 37.864540 -122.313932 \n", + "33 338 0 818727 37.797482 -122.395025 \n", "\n", - " geometry ... route_short_name \\\n", - "0 POINT (2130400.260 627641.309) ... NaN \n", - "1 POINT (2577583.013 986856.496) ... NaN \n", - "2 POINT (-199750.592 -22341.380) ... NaN \n", - "3 POINT (2576234.283 836414.716) ... NaN \n", - "4 POINT (2408238.879 582112.897) ... NaN \n", - ".. ... ... ... \n", - "74 POINT (-217731.552 -14910.728) ... None \n", - "77 POINT (-210363.380 -21857.544) ... SF \n", - "78 POINT (-217730.126 -14936.899) ... SF \n", - "79 POINT (-220146.197 -4985.515) ... LF \n", - "80 POINT (-215722.217 -13168.852) ... TF \n", + " route_type geometry \n", + "0 2 POINT (-111116.950 -23544.700) \n", + "1 2 POINT (-112222.169 -5836.078) \n", + "2 2 POINT (-126252.943 -34607.238) \n", + "3 2 POINT (-165877.168 -38241.179) \n", + "4 2 POINT (-151236.096 -34123.815) \n", + ".. ... ... \n", + "28 4 POINT (-215679.403 -13151.168) \n", + "29 4 POINT (-217731.552 -14910.728) \n", + "31 4 POINT (-209847.993 -24653.833) \n", + "32 4 POINT (-203274.531 -14397.269) \n", + "33 4 POINT (-210585.228 -21672.628) \n", "\n", - " route_long_name route_desc \\\n", - "0 NaN NaN \n", - "1 NaN NaN \n", - "2 NaN NaN \n", - "3 NaN NaN \n", - "4 NaN NaN \n", - ".. ... ... \n", - "74 Pier 41 - Sausalito - Tiburon - Angel Island None \n", - "77 Sausalito - San Francisco Ferry None \n", - "78 Sausalito - San Francisco Ferry None \n", - "79 Larkspur - San Francisco Ferry None \n", - "80 Tiburon - San Francisco Ferry None \n", - "\n", - " route_url route_color \\\n", - "0 NaN NaN \n", - "1 NaN NaN \n", - "2 NaN NaN \n", - "3 NaN NaN \n", - "4 NaN NaN \n", - ".. ... ... \n", - "74 None f5cb04 \n", - "77 http://goldengateferry.org/schedules/Sausalito... 0000FF \n", - "78 http://goldengateferry.org/schedules/Sausalito... 0000FF \n", - "79 http://goldengateferry.org/schedules/Larkspur.php 0000FF \n", - "80 None 0000FF \n", - "\n", - " route_text_color route_sort_order continuous_pickup continuous_drop_off \\\n", - "0 NaN NaN NaN NaN \n", - "1 NaN NaN NaN NaN \n", - "2 NaN NaN NaN NaN \n", - "3 NaN NaN NaN NaN \n", - "4 NaN NaN NaN NaN \n", - ".. ... ... ... ... \n", - "74 000000 3 1 1 \n", - "77 FFFFFF 0 None None \n", - "78 FFFFFF 0 None None \n", - "79 FFFFFF 0 None None \n", - "80 FFFFFF 0 None None \n", - "\n", - " calitp_extracted_at \n", - "0 NaN \n", - "1 NaN \n", - "2 NaN \n", - "3 NaN \n", - "4 NaN \n", - ".. ... \n", - "74 2021-05-03 \n", - "77 2021-11-07 \n", - "78 2021-11-07 \n", - "79 2021-11-07 \n", - "80 2021-11-07 \n", - "\n", - "[2255 rows x 23 columns]" + "[1324 rows x 7 columns]" ] }, - "execution_count": 22, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -818,7 +704,49 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, + "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", + "metadata": {}, + "outputs": [], + "source": [ + "## clip to CA since we now have Amtrak national..." + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "b4d279ae-5283-47e6-b503-f01738f7672a", + "metadata": {}, + "outputs": [], + "source": [ + "import intake\n", + "catalog = intake.open_catalog('./catalog.yml')" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "c76728cc-b293-4f57-8002-3efa845a1dad", + "metadata": {}, + "outputs": [], + "source": [ + "ca_shape = catalog.stanford_shorelines.read().to_crs('EPSG:6414') >> filter(_.STFIPS == '06')\n", + "# ca_shape['geometry'].iloc[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "8b7beb5f-2128-4482-9648-abdfcc8e0001", + "metadata": {}, + "outputs": [], + "source": [ + "rail_brt_ferry = rail_brt_ferry.clip(ca_shape)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, "id": "fa029d00-acac-4242-9048-d8024e70f914", "metadata": {}, "outputs": [], @@ -828,7 +756,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 32, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, "outputs": [ From 77731ea0ca0863e746b456ae67cd4fac91ab773c Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 8 Dec 2021 21:04:17 +0000 Subject: [PATCH 10/24] illustrate nb save issue --- .../bus_corridors.ipynb | 8 +- high_quality_transit_areas/catalog.yml | 10 + .../rail_ferry_brt.ipynb | 400 +++--------------- 3 files changed, 74 insertions(+), 344 deletions(-) create mode 100644 high_quality_transit_areas/catalog.yml diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 87bf082cb..5c7f4f82b 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -99,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, "outputs": [ @@ -168,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -180,7 +180,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -192,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], diff --git a/high_quality_transit_areas/catalog.yml b/high_quality_transit_areas/catalog.yml new file mode 100644 index 000000000..58e7a59a4 --- /dev/null +++ b/high_quality_transit_areas/catalog.yml @@ -0,0 +1,10 @@ +metadata: + version: 1 +sources: + stanford_shorelines: + driver: shapefile + description: Stanford shoreline data + url: https://earthworks.stanford.edu/catalog/stanford-vt021tk4894 + args: + urlpath: gs://calitp-analytics-data/data-analyses/msd_dashboard_metric/stanford_shorelines.zip + use_fsspec: true \ No newline at end of file diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 55fc7534c..512cd65f8 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,106 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", - "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", - "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", - "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", - "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", - "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", - "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", - "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", - "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", - "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", - "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", - "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", - "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", - "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", - "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", - "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", - "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", - "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", - "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", - "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", - "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", - "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", - "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" - ] - } - ], - "source": [ - "!pip install -r requirements.txt" - ] - }, - { - "cell_type": "code", - "execution_count": 2, + "outputs": [], + "source": [ + "# !pip install -r requirements.txt" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -152,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", "metadata": {}, "outputs": [], @@ -171,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], @@ -215,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", "metadata": { "tags": [] @@ -233,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", "metadata": {}, "outputs": [], @@ -246,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", "metadata": {}, "outputs": [], @@ -260,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", "metadata": {}, "outputs": [], @@ -274,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], @@ -284,27 +200,12 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "6dd08c23eb034e769c8317c27148dccf", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[37.79790800531397, -121.26366399999999], controls=(ZoomControl(options=['position', 'zoom_in_text'…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "map_hqta(rail_stops, 'route_type')" + "# map_hqta(rail_stops, 'route_type')" ] }, { @@ -321,7 +222,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], @@ -335,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -345,7 +246,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -362,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -372,7 +273,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -382,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -395,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -405,7 +306,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -415,7 +316,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -428,7 +329,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -438,7 +339,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -456,7 +357,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -469,7 +370,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -481,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -499,7 +400,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -513,198 +414,17 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometry
0100340000237.797908-121.2636642POINT (-111116.950 -23544.700)
1100340000137.957058-121.2789482POINT (-112222.169 -5836.078)
2100340000337.696468-121.4338692POINT (-126252.943 -34607.238)
31003400004.337.657549-121.8829622POINT (-165877.168 -38241.179)
41003400004.137.697081-121.7176482POINT (-151236.096 -34123.815)
........................
28410248354937.872939-122.4554464POINT (-215679.403 -13151.168)
29410248356937.856636-122.4782754POINT (-217731.552 -14910.728)
31338081872937.770840-122.3857914POINT (-209847.993 -24653.833)
32338081873337.864540-122.3139324POINT (-203274.531 -14397.269)
33338081872737.797482-122.3950254POINT (-210585.228 -21672.628)
\n", - "

1324 rows × 7 columns

\n", - "
" - ], - "text/plain": [ - " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", - "0 10 0 3400002 37.797908 -121.263664 \n", - "1 10 0 3400001 37.957058 -121.278948 \n", - "2 10 0 3400003 37.696468 -121.433869 \n", - "3 10 0 3400004.3 37.657549 -121.882962 \n", - "4 10 0 3400004.1 37.697081 -121.717648 \n", - ".. ... ... ... ... ... \n", - "28 41 0 2483549 37.872939 -122.455446 \n", - "29 41 0 2483569 37.856636 -122.478275 \n", - "31 338 0 818729 37.770840 -122.385791 \n", - "32 338 0 818733 37.864540 -122.313932 \n", - "33 338 0 818727 37.797482 -122.395025 \n", - "\n", - " route_type geometry \n", - "0 2 POINT (-111116.950 -23544.700) \n", - "1 2 POINT (-112222.169 -5836.078) \n", - "2 2 POINT (-126252.943 -34607.238) \n", - "3 2 POINT (-165877.168 -38241.179) \n", - "4 2 POINT (-151236.096 -34123.815) \n", - ".. ... ... \n", - "28 4 POINT (-215679.403 -13151.168) \n", - "29 4 POINT (-217731.552 -14910.728) \n", - "31 4 POINT (-209847.993 -24653.833) \n", - "32 4 POINT (-203274.531 -14397.269) \n", - "33 4 POINT (-210585.228 -21672.628) \n", - "\n", - "[1324 rows x 7 columns]" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "rail_brt_ferry" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", "metadata": {}, "outputs": [], @@ -714,7 +434,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "b4d279ae-5283-47e6-b503-f01738f7672a", "metadata": {}, "outputs": [], @@ -725,18 +445,32 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "c76728cc-b293-4f57-8002-3efa845a1dad", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "ca_shape = catalog.stanford_shorelines.read().to_crs('EPSG:6414') >> filter(_.STFIPS == '06')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0174ddab-347c-47d2-b824-98e360719b94", "metadata": {}, "outputs": [], "source": [ - "ca_shape = catalog.stanford_shorelines.read().to_crs('EPSG:6414') >> filter(_.STFIPS == '06')\n", - "# ca_shape['geometry'].iloc[0]" + "## after this cell displays output the notebook refuses to save...\n", + "## File Save Error for rail_ferry_brt.ipynb\n", + "## Invalid response: 413 Request Entity Too Large\n", + "ca_shape['geometry'].iloc[0]" ] }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "8b7beb5f-2128-4482-9648-abdfcc8e0001", "metadata": {}, "outputs": [], @@ -746,7 +480,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "fa029d00-acac-4242-9048-d8024e70f914", "metadata": {}, "outputs": [], @@ -756,24 +490,10 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], + "outputs": [], "source": [ "geoparquet_gcs_export(rail_brt_ferry, 'rail_brt_ferry')" ] From 2f93a1def8cade1fb5415babccf681cd248b964f Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Thu, 9 Dec 2021 00:09:13 +0000 Subject: [PATCH 11/24] view lbt PCH corridor pending debug --- .../bus_corridors.ipynb | 1175 ++++++++++++++--- .../rail_ferry_brt.ipynb | 278 +++- 2 files changed, 1260 insertions(+), 193 deletions(-) diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 5c7f4f82b..21a0736e3 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 18, "id": "d7bcdd2a-75f6-429b-8c2e-10263abf7ace", "metadata": { "collapsed": true, @@ -17,79 +17,73 @@ "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Collecting pygeos\n", - " Using cached pygeos-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB)\n", - "Collecting ipyleaflet\n", - " Using cached ipyleaflet-0.15.0-py2.py3-none-any.whl (3.3 MB)\n", + "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", + "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Collecting xyzservices>=2021.8.1\n", - " Using cached xyzservices-2021.11.0-py3-none-any.whl (34 kB)\n", - "Collecting traittypes<3,>=0.2.1\n", - " Using cached traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB)\n", + "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", + "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", - "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", + "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", + "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", + "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", + "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", + "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", + "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", - "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", + "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", - "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", + "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", + "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", + "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n", - "Installing collected packages: xyzservices, traittypes, pygeos, ipyleaflet\n", - "Successfully installed ipyleaflet-0.15.0 pygeos-0.12.0 traittypes-0.2.1 xyzservices-2021.11.0\n" + "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" ] } ], @@ -99,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, "outputs": [ @@ -168,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -180,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -192,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], @@ -247,7 +241,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "id": "65c74fbd-059f-4df8-a3a1-e6c1361489b7", "metadata": {}, "outputs": [], @@ -267,32 +261,38 @@ " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.weekday() == 2)]\n", " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.month == 12)] ## December\n", " wednesday = wednesday[wednesday['service_date'] == wednesday['service_date'].iloc[0]] ## pick most recent Wednesday from Dec or earlier\n", + " wednesday = wednesday >> select(_.calitp_itp_id, _.calitp_url_number, _.service_id)\n", " \n", " bus_routes = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " # >> filter(_.route_type.isin(['3', '11'])) ## bus and trolleybus\n", - " >> filter(_.route_type == '3')\n", - " >> select(_.route_id) >> collect())\n", + " >> filter((_.route_type == '3') | (_.route_type == '11'))\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id) \n", + " # >> collect()\n", + " )\n", " print('loaded bus routes')\n", " \n", " if itp_id == 273:\n", " trips = (tbl.gtfs_schedule.trips()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " >> filter(_.service_id.isin(['1'])) ## temporary hardcode for SacRT\n", - " >> filter(_.route_id.isin(bus_routes.route_id))\n", + " >> filter(_.service_id == '1') ## temporary hardcode for SacRT\n", + " >> inner_join(_, bus_routes, on = ['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", " >> collect())\n", " else:\n", " trips = (tbl.gtfs_schedule.trips()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " >> filter(_.service_id.isin(wednesday.service_id))\n", - " >> filter(_.route_id.isin(bus_routes.route_id))\n", - " >> collect())\n", + " >> inner_join(_, bus_routes, on = ['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", + " >> collect()\n", + " >> inner_join(_, wednesday, on = ['calitp_itp_id', 'calitp_url_number', 'service_id'])\n", + " )\n", " print('loaded trips')\n", " stop_times = (tbl.gtfs_schedule.stop_times()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", " >> collect())\n", - " stop_times = (stop_times >> filter(_.trip_id.isin(trips.trip_id))\n", - " >> select(-_.calitp_itp_id, -_.calitp_extracted_at))\n", + " stop_times = (stop_times >> inner_join(_, trips, on = ['calitp_itp_id', 'calitp_url_number', 'trip_id'])\n", + " >> select(-_.stop_headsign, -_.pickup_type, -_.drop_off_type,\n", + " -_.continuous_pickup, -_.continuous_drop_off, -_.shape_dist_travelled,\n", + " -_.timepoint)\n", + " )\n", " print('loaded stop times')\n", "\n", " stops = (tbl.gtfs_schedule.stops() \n", @@ -309,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 13, "id": "1049eee5-d4d9-43a1-9a84-c3bd3687f6d3", "metadata": {}, "outputs": [], @@ -330,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 14, "id": "0d3207be-d38f-4f17-a97f-0f84cae25d77", "metadata": {}, "outputs": [], @@ -463,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 31, "id": "9483141f-c197-4fc8-80f0-4efa8d2b44c4", "metadata": {}, "outputs": [], @@ -507,24 +507,24 @@ " hqta = hqta.set_crs('EPSG:6414')\n", " except:\n", " continue\n", - " \n", - " return hqta.drop(columns=['n', 'departure_hour']).reset_index(drop=True)" + " return hqta\n", + " # return hqta.drop(columns=['n', 'departure_hour']).reset_index(drop=True)" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 27, "id": "e9d94df4-21cd-46d6-a8ab-fe4d4c01d728", "metadata": {}, "outputs": [], "source": [ - "debug_ids = ['25349']" + "debug_ids = ['940143']" ] }, { "cell_type": "code", - "execution_count": 13, - "id": "b1089592-7a20-4c3b-a27f-5eb6193213de", + "execution_count": 21, + "id": "54227d0f-b539-4852-96e2-50472f40fb08", "metadata": { "tags": [] }, @@ -534,54 +534,10 @@ "output_type": "stream", "text": [ "loaded shapes\n", - "loaded bus routes\n" - ] - }, - { - "ename": "AssertionError", - "evalue": "Unexpected param: (__[POSTCOMPILE_service_id_1])", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_44/1117417450.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlbt_views\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_operator_views\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m170\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/tmp/ipykernel_44/4270395868.py\u001b[0m in \u001b[0;36mget_operator_views\u001b[0;34m(itp_id)\u001b[0m\n\u001b[1;32m 29\u001b[0m >> collect())\n\u001b[1;32m 30\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 31\u001b[0;31m trips = (tbl.gtfs_schedule.trips()\n\u001b[0m\u001b[1;32m 32\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitp_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 33\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwednesday\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3505\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[0;32m-> 3507\u001b[0;31m [\n\u001b[0m\u001b[1;32m 3508\u001b[0m f._compiler_dispatch(\n\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[1;32m 3507\u001b[0m [\n\u001b[0;32m-> 3508\u001b[0;31m f._compiler_dispatch(\n\u001b[0m\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3510\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_subquery\u001b[0;34m(self, subquery, **kw)\u001b[0m\n\u001b[1;32m 2875\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_subquery\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2876\u001b[0m \u001b[0mkw\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"subquery\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvisit_alias\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2879\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_lateral\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_alias\u001b[0;34m(self, alias, asfrom, ashint, iscrud, fromhints, subquery, lateral, enclosing_alias, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 2834\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfroms\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0malias\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0malias_name\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2835\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2836\u001b[0;31m inner = alias.element._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2837\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlateral\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2838\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_service_id_1])" + "loaded bus routes\n", + "loaded trips\n", + "loaded stop times\n", + "loaded stops\n" ] } ], @@ -591,31 +547,412 @@ }, { "cell_type": "code", - "execution_count": null, - "id": "908af6e2-bef2-4458-8125-67cd28454493", - "metadata": {}, - "outputs": [], + "execution_count": 32, + "id": "f6c92a46-4a65-4a0f-9bbc-a9d9050417d0", + "metadata": { + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "there are 100 shapes total\n", + "calculating for shape_id 510066\n", + "progress: 0/100 shapes (0.0%)\n", + "calculating for shape_id 610106\n", + "calculating for shape_id 610105\n", + "calculating for shape_id 510067\n", + "calculating for shape_id 1210143\n", + "calculating for shape_id 460064\n", + "calculating for shape_id 1210138\n", + "calculating for shape_id 460067\n", + "no line for shape 460067\n", + "calculating for shape_id 1920161\n", + "calculating for shape_id 1920167\n", + "calculating for shape_id 1730123\n", + "calculating for shape_id 1910292\n", + "calculating for shape_id 1910295\n", + "calculating for shape_id 1730122\n", + "calculating for shape_id 220068\n", + "calculating for shape_id 220074\n", + "calculating for shape_id 1710168\n", + "calculating for shape_id 1710162\n", + "calculating for shape_id 1720090\n", + "calculating for shape_id 1720091\n", + "no line for shape 1720091\n", + "calculating for shape_id 10070\n", + "calculating for shape_id 20008\n", + "calculating for shape_id 40001\n", + "calculating for shape_id 40002\n", + "no line for shape 40002\n", + "calculating for shape_id 410006\n", + "calculating for shape_id 80002\n", + "progress: 25/100 shapes (25.0%)\n", + "calculating for shape_id 10069\n", + "no line for shape 10069\n", + "calculating for shape_id 80003\n", + "no line for shape 80003\n", + "calculating for shape_id 1510067\n", + "calculating for shape_id 20010\n", + "calculating for shape_id 450111\n", + "no line for shape 450111\n", + "calculating for shape_id 710048\n", + "calculating for shape_id 1750012\n", + "no line for shape 1750012\n", + "calculating for shape_id 1510064\n", + "calculating for shape_id 450110\n", + "calculating for shape_id 410007\n", + "no line for shape 410007\n", + "calculating for shape_id 710046\n", + "calculating for shape_id 1040017\n", + "calculating for shape_id 1310131\n", + "calculating for shape_id 1310132\n", + "no stops for shape 1310132\n", + "calculating for shape_id 1040018\n", + "calculating for shape_id 1750010\n", + "no stops for shape 1750010\n", + "calculating for shape_id 910129\n", + "calculating for shape_id 1010081\n", + "calculating for shape_id 1030063\n", + "calculating for shape_id 910132\n", + "calculating for shape_id 1010082\n", + "no line for shape 1010082\n", + "calculating for shape_id 1810080\n", + "calculating for shape_id 1030064\n", + "calculating for shape_id 230018\n", + "calculating for shape_id 230015\n", + "progress: 50/100 shapes (50.0%)\n", + "calculating for shape_id 1120045\n", + "calculating for shape_id 1110083\n", + "calculating for shape_id 210080\n", + "calculating for shape_id 210079\n", + "no line for shape 210079\n", + "calculating for shape_id 1820070\n", + "calculating for shape_id 1810081\n", + "calculating for shape_id 1110082\n", + "no stops for shape 1110082\n", + "calculating for shape_id 920113\n", + "calculating for shape_id 1120046\n", + "no line for shape 1120046\n", + "calculating for shape_id 1820071\n", + "no stops for shape 1820071\n", + "calculating for shape_id 930151\n", + "calculating for shape_id 920111\n", + "no stops for shape 920111\n", + "calculating for shape_id 930148\n", + "no stops for shape 930148\n", + "calculating for shape_id 930150\n", + "no line for shape 930150\n", + "calculating for shape_id 930147\n", + "no stops for shape 930147\n", + "calculating for shape_id 920115\n", + "no stops for shape 920115\n", + "calculating for shape_id 920112\n", + "no line for shape 920112\n", + "calculating for shape_id 460065\n", + "no line for shape 460065\n", + "calculating for shape_id 910131\n", + "no line for shape 910131\n", + "calculating for shape_id 910130\n", + "no stops for shape 910130\n", + "calculating for shape_id 460063\n", + "no stops for shape 460063\n", + "calculating for shape_id 460069\n", + "no line for shape 460069\n", + "calculating for shape_id 1720093\n", + "no line for shape 1720093\n", + "calculating for shape_id 1740030\n", + "no stops for shape 1740030\n", + "calculating for shape_id 1720092\n", + "progress: 75/100 shapes (75.0%)\n", + "no stops for shape 1720092\n", + "calculating for shape_id 1510066\n", + "no stops for shape 1510066\n", + "calculating for shape_id 410005\n", + "no line for shape 410005\n", + "calculating for shape_id 4050003\n", + "calculating for shape_id 910140\n", + "no line for shape 910140\n", + "calculating for shape_id 4050001\n", + "calculating for shape_id 1210141\n", + "no line for shape 1210141\n", + "calculating for shape_id 940134\n", + "no line for shape 940134\n", + "calculating for shape_id 940133\n", + "no line for shape 940133\n", + "calculating for shape_id 210078\n", + "no line for shape 210078\n", + "calculating for shape_id 460075\n", + "no line for shape 460075\n", + "calculating for shape_id 460071\n", + "no line for shape 460071\n", + "calculating for shape_id 450109\n", + "no line for shape 450109\n", + "calculating for shape_id 220073\n", + "no line for shape 220073\n", + "calculating for shape_id 210083\n", + "no line for shape 210083\n", + "calculating for shape_id 1920165\n", + "no line for shape 1920165\n", + "calculating for shape_id 1910305\n", + "no stops for shape 1910305\n", + "calculating for shape_id 1910304\n", + "no line for shape 1910304\n", + "calculating for shape_id 1910302\n", + "no stops for shape 1910302\n", + "calculating for shape_id 1910297\n", + "no stops for shape 1910297\n", + "calculating for shape_id 1910287\n", + "no line for shape 1910287\n", + "calculating for shape_id 1720096\n", + "no line for shape 1720096\n", + "calculating for shape_id 1720095\n", + "no stops for shape 1720095\n", + "calculating for shape_id 1210144\n", + "no line for shape 1210144\n", + "calculating for shape_id 940143\n", + "***debug shape*** 940143\n", + "no line for shape 940143\n" + ] + } + ], "source": [ - "bus_routes" + "lbt_hqta = single_operator_hqta(lbt_views)" ] }, { "cell_type": "code", - "execution_count": 43, - "id": "a04ec0e7-df45-4d2f-b477-1f0cb2c6c6ca", + "execution_count": 33, + "id": "2ab838e9-ba14-4057-a0ab-9e6401e83f16", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idgeometryhqta_segment_idsegment_sequenceshape_idstop_idam_max_tripspm_max_tripshq_transit_corr
0170POLYGON ((167654.764 -470242.512, 167655.638 -...1081235767051006640101616True
1170POLYGON ((167694.221 -469153.485, 167693.191 -...9304416331510066000477True
2170POLYGON ((167669.771 -467897.042, 167669.770 -...29273764112510066169877True
3170POLYGON ((167646.521 -466641.120, 167646.502 -...36487189893510066055044False
4170POLYGON ((167605.970 -464592.739, 167604.537 -...11932541904510066055544False
..............................
8170POLYGON ((167565.314 -466042.457, 167566.287 -...2433783489424050003525111False
9170POLYGON ((167563.316 -466013.754, 167563.368 -...3860309591434050003525111False
10170POLYGON ((167564.027 -466023.335, 167507.511 -...259261282454050003061054False
11170POLYGON ((167584.688 -466111.742, 167498.932 -...2524795608464050003525111False
0170POLYGON ((165145.529 -464024.944, 165145.017 -...123563336844050001013422False
\n", + "

383 rows × 9 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id geometry \\\n", + "0 170 POLYGON ((167654.764 -470242.512, 167655.638 -... \n", + "1 170 POLYGON ((167694.221 -469153.485, 167693.191 -... \n", + "2 170 POLYGON ((167669.771 -467897.042, 167669.770 -... \n", + "3 170 POLYGON ((167646.521 -466641.120, 167646.502 -... \n", + "4 170 POLYGON ((167605.970 -464592.739, 167604.537 -... \n", + ".. ... ... \n", + "8 170 POLYGON ((167565.314 -466042.457, 167566.287 -... \n", + "9 170 POLYGON ((167563.316 -466013.754, 167563.368 -... \n", + "10 170 POLYGON ((167564.027 -466023.335, 167507.511 -... \n", + "11 170 POLYGON ((167584.688 -466111.742, 167498.932 -... \n", + "0 170 POLYGON ((165145.529 -464024.944, 165145.017 -... \n", + "\n", + " hqta_segment_id segment_sequence shape_id stop_id am_max_trips \\\n", + "0 1081235767 0 510066 4010 16 \n", + "1 930441633 1 510066 0004 7 \n", + "2 2927376411 2 510066 1698 7 \n", + "3 3648718989 3 510066 0550 4 \n", + "4 1193254190 4 510066 0555 4 \n", + ".. ... ... ... ... ... \n", + "8 2433783489 42 4050003 5251 1 \n", + "9 3860309591 43 4050003 5251 1 \n", + "10 259261282 45 4050003 0610 5 \n", + "11 2524795608 46 4050003 5251 1 \n", + "0 1235633368 4 4050001 0134 2 \n", + "\n", + " pm_max_trips hq_transit_corr \n", + "0 16 True \n", + "1 7 True \n", + "2 7 True \n", + "3 4 False \n", + "4 4 False \n", + ".. ... ... \n", + "8 1 False \n", + "9 1 False \n", + "10 4 False \n", + "11 1 False \n", + "0 2 False \n", + "\n", + "[383 rows x 9 columns]" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "bus_routes = (tbl.gtfs_schedule.routes()\n", - " >> filter(_.calitp_itp_id == 170)\n", - " >> filter(_.route_type == '3', _.route_type == '11') ## bus and trolleybus\n", - " >> select(_.route_id) >> collect())" + "lbt_hqta" ] }, { "cell_type": "code", - "execution_count": 42, - "id": "e7912a98-883b-4c6b-aedf-95533d9497c5", + "execution_count": 36, + "id": "c5fcee96-a46e-4d56-afe3-717d7841945d", "metadata": {}, "outputs": [ { @@ -639,68 +976,594 @@ " \n", " \n", " \n", - " route_id\n", + " calitp_itp_id\n", + " geometry\n", + " hqta_segment_id\n", + " segment_sequence\n", + " shape_id\n", + " stop_id\n", + " am_max_trips\n", + " pm_max_trips\n", + " hq_transit_corr\n", " \n", " \n", " \n", + " \n", + " 3\n", + " 170\n", + " POLYGON ((170683.457 -468570.782, 170703.916 -...\n", + " 3462120608\n", + " 4\n", + " 460064\n", + " 0477\n", + " 6\n", + " 6\n", + " True\n", + " \n", " \n", "\n", "" ], "text/plain": [ - "Empty DataFrame\n", - "Columns: [route_id]\n", - "Index: []" + " calitp_itp_id geometry \\\n", + "3 170 POLYGON ((170683.457 -468570.782, 170703.916 -... \n", + "\n", + " hqta_segment_id segment_sequence shape_id stop_id am_max_trips \\\n", + "3 3462120608 4 460064 0477 6 \n", + "\n", + " pm_max_trips hq_transit_corr \n", + "3 6 True " ] }, - "execution_count": 42, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bus_routes" + "lbt_hqta >> filter(_.stop_id == '0477')" ] }, { "cell_type": "code", - "execution_count": 30, - "id": "f6c92a46-4a65-4a0f-9bbc-a9d9050417d0", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, - "tags": [] - }, + "execution_count": 41, + "id": "1d258bdf-1164-4036-a16f-c7f942711c3f", + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "there are 0 shapes total\n" + "\n", + "Int64Index: 383 entries, 0 to 0\n", + "Data columns (total 9 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 calitp_itp_id 383 non-null object \n", + " 1 geometry 383 non-null geometry\n", + " 2 hqta_segment_id 383 non-null int64 \n", + " 3 segment_sequence 383 non-null object \n", + " 4 shape_id 383 non-null object \n", + " 5 stop_id 383 non-null object \n", + " 6 am_max_trips 383 non-null int64 \n", + " 7 pm_max_trips 383 non-null int64 \n", + " 8 hq_transit_corr 383 non-null bool \n", + "dtypes: bool(1), geometry(1), int64(3), object(4)\n", + "memory usage: 27.3+ KB\n" ] - }, + } + ], + "source": [ + "lbt_hqta.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "8c170b28-4de1-4ac1-b265-920ec3a976b4", + "metadata": {}, + "outputs": [ { - "ename": "KeyError", - "evalue": "\"['n' 'departure_hour'] not found in axis\"", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_46/1844755579.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mbart_hqta\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msingle_operator_hqta\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbart_views\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/tmp/ipykernel_46/483469756.py\u001b[0m in \u001b[0;36msingle_operator_hqta\u001b[0;34m(views)\u001b[0m\n\u001b[1;32m 39\u001b[0m \u001b[0;32mcontinue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 41\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mhqta\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'n'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'departure_hour'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreset_index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/util/_decorators.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 309\u001b[0m \u001b[0mstacklevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstacklevel\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 310\u001b[0m )\n\u001b[0;32m--> 311\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 312\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 313\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[1;32m 4904\u001b[0m \u001b[0mweight\u001b[0m \u001b[0;36m1.0\u001b[0m \u001b[0;36m0.8\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4905\u001b[0m \"\"\"\n\u001b[0;32m-> 4906\u001b[0;31m return super().drop(\n\u001b[0m\u001b[1;32m 4907\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4908\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[1;32m 4148\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m \u001b[0;32min\u001b[0m \u001b[0maxes\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4149\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlabels\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 4150\u001b[0;31m \u001b[0mobj\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_drop_axis\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4151\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4152\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0minplace\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m_drop_axis\u001b[0;34m(self, labels, axis, level, errors)\u001b[0m\n\u001b[1;32m 4183\u001b[0m \u001b[0mnew_axis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4184\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 4185\u001b[0;31m \u001b[0mnew_axis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4186\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0maxis_name\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mnew_axis\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4187\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, errors)\u001b[0m\n\u001b[1;32m 6015\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmask\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0many\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6016\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0merrors\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;34m\"ignore\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 6017\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"{labels[mask]} not found in axis\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6018\u001b[0m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m~\u001b[0m\u001b[0mmask\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6019\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdelete\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyError\u001b[0m: \"['n' 'departure_hour'] not found in axis\"" - ] + "data": { + "text/plain": [ + "array(['510066', '610106', '610105', '510067', '1210143', '460064',\n", + " '1210138', '1920161', '1920167', '1730123', '1910292', '1910295',\n", + " '1730122', '220068', '220074', '1710168', '1710162', '1720090',\n", + " '10070', '20008', '40001', '410006', '80002', '1510067', '20010',\n", + " '710048', '1510064', '450110', '710046', '1040017', '1310131',\n", + " '1040018', '910129', '1010081', '1030063', '910132', '1810080',\n", + " '1030064', '230018', '230015', '1120045', '1110083', '210080',\n", + " '1820070', '1810081', '920113', '930151', '4050003', '4050001'],\n", + " dtype=object)" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "lbt_hqta.shape_id.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "f03f090c-2508-46a4-b705-18df2c015186", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "5cc25219c19c41b6b83610ca0d0397f2", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[33.77270983724983, -118.1893899136652], controls=(ZoomControl(options=['position', 'zoom_in_text',…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "map_hqta(lbt_hqta, 'hqta_segment_id')" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "c19aba0b-b265-4cfe-8e76-0fca0447acda", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e9ed295d930b409c8063ff3abea43ad6", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[33.91231602534506, -118.10067122142928], controls=(ZoomControl(options=['position', 'zoom_in_text'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "map_hqta(lbt_hqta >> filter(_.shape_id == '1730123'))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4e62a18b-a65f-4027-87f2-7da1227a4d3b", + "metadata": {}, + "outputs": [], + "source": [ + "## investigate PCH not being an hqta..." + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "970b2cb6-7511-44be-bfb1-4d1c1d1bfe2b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idgeometryhqta_segment_idsegment_sequenceshape_idstop_idam_max_tripspm_max_tripshq_transit_corr
0170POLYGON ((175350.451 -454051.814, 175349.213 -...263163155101730123411355True
1170POLYGON ((175836.936 -454587.721, 175836.959 -...395710928911730123411632False
2170POLYGON ((175798.075 -455972.107, 175798.083 -...192662005121730123411932False
3170POLYGON ((175827.602 -457076.012, 175827.610 -...9770266131730123303332False
4170POLYGON ((175854.103 -458921.667, 175854.135 -...261241411841730123412432False
5170POLYGON ((176737.013 -460049.998, 176737.342 -...397105310451730123190933False
6170POLYGON ((177991.832 -460007.766, 178010.111 -...197500301861730123190222False
7170POLYGON ((178396.327 -461576.519, 178395.927 -...4607772471730123156933False
8170POLYGON ((178429.971 -462989.509, 178430.591 -...244947623781730123180255False
9170POLYGON ((178152.046 -463095.761, 178090.699 -...384245609191730123127243False
10170POLYGON ((175975.412 -463280.594, 175977.308 -...3062012927101730123197243False
11170POLYGON ((175919.561 -463405.079, 175916.534 -...3246762857111730123179522False
12170POLYGON ((176053.775 -464584.739, 176053.777 -...1485634259121730123179222False
13170POLYGON ((176068.527 -465823.921, 176068.537 -...797690437131730123178822False
14170POLYGON ((175997.767 -467784.889, 175997.533 -...2985254886141730123052922False
15170POLYGON ((175564.080 -467890.219, 175563.606 -...3337121648151730123052722False
16170POLYGON ((173784.416 -467841.455, 173785.048 -...1608597194161730123177922False
17170POLYGON ((171789.381 -467743.362, 171793.498 -...686165596171730123134677False
18170POLYGON ((171187.739 -467856.064, 171187.546 -...3092845517181730123167277False
19170POLYGON ((169935.539 -467879.393, 169923.522 -...3479053147191730123166777False
20170POLYGON ((168696.051 -467903.956, 168680.399 -...2645542972201730123166377True
21170POLYGON ((168037.524 -467916.250, 168037.372 -...3936942250211730123166277False
22170POLYGON ((167357.829 -467928.625, 167358.227 -...1939974416221730123005478False
23170POLYGON ((167281.629 -469235.162, 167281.182 -...7802714223173012303601010False
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id geometry \\\n", + "0 170 POLYGON ((175350.451 -454051.814, 175349.213 -... \n", + "1 170 POLYGON ((175836.936 -454587.721, 175836.959 -... \n", + "2 170 POLYGON ((175798.075 -455972.107, 175798.083 -... \n", + "3 170 POLYGON ((175827.602 -457076.012, 175827.610 -... \n", + "4 170 POLYGON ((175854.103 -458921.667, 175854.135 -... \n", + "5 170 POLYGON ((176737.013 -460049.998, 176737.342 -... \n", + "6 170 POLYGON ((177991.832 -460007.766, 178010.111 -... \n", + "7 170 POLYGON ((178396.327 -461576.519, 178395.927 -... \n", + "8 170 POLYGON ((178429.971 -462989.509, 178430.591 -... \n", + "9 170 POLYGON ((178152.046 -463095.761, 178090.699 -... \n", + "10 170 POLYGON ((175975.412 -463280.594, 175977.308 -... \n", + "11 170 POLYGON ((175919.561 -463405.079, 175916.534 -... \n", + "12 170 POLYGON ((176053.775 -464584.739, 176053.777 -... \n", + "13 170 POLYGON ((176068.527 -465823.921, 176068.537 -... \n", + "14 170 POLYGON ((175997.767 -467784.889, 175997.533 -... \n", + "15 170 POLYGON ((175564.080 -467890.219, 175563.606 -... \n", + "16 170 POLYGON ((173784.416 -467841.455, 173785.048 -... \n", + "17 170 POLYGON ((171789.381 -467743.362, 171793.498 -... \n", + "18 170 POLYGON ((171187.739 -467856.064, 171187.546 -... \n", + "19 170 POLYGON ((169935.539 -467879.393, 169923.522 -... \n", + "20 170 POLYGON ((168696.051 -467903.956, 168680.399 -... \n", + "21 170 POLYGON ((168037.524 -467916.250, 168037.372 -... \n", + "22 170 POLYGON ((167357.829 -467928.625, 167358.227 -... \n", + "23 170 POLYGON ((167281.629 -469235.162, 167281.182 -... \n", + "\n", + " hqta_segment_id segment_sequence shape_id stop_id am_max_trips \\\n", + "0 2631631551 0 1730123 4113 5 \n", + "1 3957109289 1 1730123 4116 3 \n", + "2 1926620051 2 1730123 4119 3 \n", + "3 97702661 3 1730123 3033 3 \n", + "4 2612414118 4 1730123 4124 3 \n", + "5 3971053104 5 1730123 1909 3 \n", + "6 1975003018 6 1730123 1902 2 \n", + "7 46077724 7 1730123 1569 3 \n", + "8 2449476237 8 1730123 1802 5 \n", + "9 3842456091 9 1730123 1272 4 \n", + "10 3062012927 10 1730123 1972 4 \n", + "11 3246762857 11 1730123 1795 2 \n", + "12 1485634259 12 1730123 1792 2 \n", + "13 797690437 13 1730123 1788 2 \n", + "14 2985254886 14 1730123 0529 2 \n", + "15 3337121648 15 1730123 0527 2 \n", + "16 1608597194 16 1730123 1779 2 \n", + "17 686165596 17 1730123 1346 7 \n", + "18 3092845517 18 1730123 1672 7 \n", + "19 3479053147 19 1730123 1667 7 \n", + "20 2645542972 20 1730123 1663 7 \n", + "21 3936942250 21 1730123 1662 7 \n", + "22 1939974416 22 1730123 0054 7 \n", + "23 78027142 23 1730123 0360 10 \n", + "\n", + " pm_max_trips hq_transit_corr \n", + "0 5 True \n", + "1 2 False \n", + "2 2 False \n", + "3 2 False \n", + "4 2 False \n", + "5 3 False \n", + "6 2 False \n", + "7 3 False \n", + "8 5 False \n", + "9 3 False \n", + "10 3 False \n", + "11 2 False \n", + "12 2 False \n", + "13 2 False \n", + "14 2 False \n", + "15 2 False \n", + "16 2 False \n", + "17 7 False \n", + "18 7 False \n", + "19 7 False \n", + "20 7 True \n", + "21 7 False \n", + "22 8 False \n", + "23 10 False " + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "lbt_hqta = single_operator_hqta(300)" + "lbt_hqta >> filter(_.shape_id == '1730123')" ] }, { diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 512cd65f8..706376a07 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", "metadata": { "tags": [] @@ -14,10 +14,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -68,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", "metadata": {}, "outputs": [], @@ -87,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], @@ -131,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", "metadata": { "tags": [] @@ -149,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", "metadata": {}, "outputs": [], @@ -162,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", "metadata": {}, "outputs": [], @@ -176,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", "metadata": {}, "outputs": [], @@ -190,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], @@ -200,7 +209,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, "outputs": [], @@ -222,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], @@ -236,7 +245,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -246,7 +255,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -263,7 +272,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -273,7 +282,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -283,7 +292,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -296,7 +305,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -306,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -316,7 +325,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -329,7 +338,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -339,7 +348,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -357,7 +366,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -370,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -382,7 +391,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -400,7 +409,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -414,17 +423,198 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometry
0100340000237.797908-121.2636642POINT (-111116.950 -23544.700)
1100340000137.957058-121.2789482POINT (-112222.169 -5836.078)
2100340000337.696468-121.4338692POINT (-126252.943 -34607.238)
31003400004.337.657549-121.8829622POINT (-165877.168 -38241.179)
41003400004.137.697081-121.7176482POINT (-151236.096 -34123.815)
........................
28410248354937.872939-122.4554464POINT (-215679.403 -13151.168)
29410248356937.856636-122.4782754POINT (-217731.552 -14910.728)
31338081872937.770840-122.3857914POINT (-209847.993 -24653.833)
32338081873337.864540-122.3139324POINT (-203274.531 -14397.269)
33338081872737.797482-122.3950254POINT (-210585.228 -21672.628)
\n", + "

1324 rows × 7 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "0 10 0 3400002 37.797908 -121.263664 \n", + "1 10 0 3400001 37.957058 -121.278948 \n", + "2 10 0 3400003 37.696468 -121.433869 \n", + "3 10 0 3400004.3 37.657549 -121.882962 \n", + "4 10 0 3400004.1 37.697081 -121.717648 \n", + ".. ... ... ... ... ... \n", + "28 41 0 2483549 37.872939 -122.455446 \n", + "29 41 0 2483569 37.856636 -122.478275 \n", + "31 338 0 818729 37.770840 -122.385791 \n", + "32 338 0 818733 37.864540 -122.313932 \n", + "33 338 0 818727 37.797482 -122.395025 \n", + "\n", + " route_type geometry \n", + "0 2 POINT (-111116.950 -23544.700) \n", + "1 2 POINT (-112222.169 -5836.078) \n", + "2 2 POINT (-126252.943 -34607.238) \n", + "3 2 POINT (-165877.168 -38241.179) \n", + "4 2 POINT (-151236.096 -34123.815) \n", + ".. ... ... \n", + "28 4 POINT (-215679.403 -13151.168) \n", + "29 4 POINT (-217731.552 -14910.728) \n", + "31 4 POINT (-209847.993 -24653.833) \n", + "32 4 POINT (-203274.531 -14397.269) \n", + "33 4 POINT (-210585.228 -21672.628) \n", + "\n", + "[1324 rows x 7 columns]" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "rail_brt_ferry" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", "metadata": {}, "outputs": [], @@ -434,7 +624,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "b4d279ae-5283-47e6-b503-f01738f7672a", "metadata": {}, "outputs": [], @@ -445,7 +635,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "id": "c76728cc-b293-4f57-8002-3efa845a1dad", "metadata": { "tags": [] @@ -457,7 +647,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "id": "0174ddab-347c-47d2-b824-98e360719b94", "metadata": {}, "outputs": [], @@ -465,12 +655,12 @@ "## after this cell displays output the notebook refuses to save...\n", "## File Save Error for rail_ferry_brt.ipynb\n", "## Invalid response: 413 Request Entity Too Large\n", - "ca_shape['geometry'].iloc[0]" + "# ca_shape['geometry'].iloc[0]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "id": "8b7beb5f-2128-4482-9648-abdfcc8e0001", "metadata": {}, "outputs": [], @@ -480,7 +670,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "id": "fa029d00-acac-4242-9048-d8024e70f914", "metadata": {}, "outputs": [], @@ -490,10 +680,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], "source": [ "geoparquet_gcs_export(rail_brt_ferry, 'rail_brt_ferry')" ] From e4c1c27022aabe53fb9ef944ae46efeb42a63053 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Thu, 9 Dec 2021 00:50:07 +0000 Subject: [PATCH 12/24] more lbt investigation --- .../bus_corridors.ipynb | 1216 ++++++++++++++++- 1 file changed, 1181 insertions(+), 35 deletions(-) diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 21a0736e3..cf7bf6411 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -330,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 61, "id": "0d3207be-d38f-4f17-a97f-0f84cae25d77", "metadata": {}, "outputs": [], @@ -447,6 +447,7 @@ " segment_peak_service['next_seg_hqta'] = segment_peak_service['hq_transit_corr'].shift(-1)\n", " \n", " ## consider segment not HQTA if both the prior and next segements are not HQTAs\n", + " debug_dict[f'{shape_id}_sps'] = segments_with_max_stop >> inner_join(_, segment_peak_service, on = 'hqta_segment_id')\n", " segment_peak_service['hq_transit_corr'] = segment_peak_service.apply(\n", " lambda x: False if x.hq_transit_corr == False else x.last_seg_hqta or x.next_seg_hqta, axis = 1)\n", " segment_peak_service['hq_transit_corr'] = segment_peak_service['hq_transit_corr'].fillna(True)\n", @@ -513,12 +514,12 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 47, "id": "e9d94df4-21cd-46d6-a8ab-fe4d4c01d728", "metadata": {}, "outputs": [], "source": [ - "debug_ids = ['940143']" + "debug_ids = ['940143', '1730123']" ] }, { @@ -547,9 +548,13 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 62, "id": "f6c92a46-4a65-4a0f-9bbc-a9d9050417d0", "metadata": { + "collapsed": true, + "jupyter": { + "outputs_hidden": true + }, "tags": [] }, "outputs": [ @@ -571,6 +576,7 @@ "calculating for shape_id 1920161\n", "calculating for shape_id 1920167\n", "calculating for shape_id 1730123\n", + "***debug shape*** 1730123\n", "calculating for shape_id 1910292\n", "calculating for shape_id 1910295\n", "calculating for shape_id 1730122\n", @@ -723,7 +729,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 63, "id": "2ab838e9-ba14-4057-a0ab-9e6401e83f16", "metadata": {}, "outputs": [ @@ -940,7 +946,7 @@ "[383 rows x 9 columns]" ] }, - "execution_count": 33, + "execution_count": 63, "metadata": {}, "output_type": "execute_result" } @@ -951,7 +957,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 64, "id": "c5fcee96-a46e-4d56-afe3-717d7841945d", "metadata": {}, "outputs": [ @@ -1015,7 +1021,7 @@ "3 6 True " ] }, - "execution_count": 36, + "execution_count": 64, "metadata": {}, "output_type": "execute_result" } @@ -1026,7 +1032,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 65, "id": "1d258bdf-1164-4036-a16f-c7f942711c3f", "metadata": {}, "outputs": [ @@ -1059,7 +1065,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 66, "id": "8c170b28-4de1-4ac1-b265-920ec3a976b4", "metadata": {}, "outputs": [ @@ -1077,7 +1083,7 @@ " dtype=object)" ] }, - "execution_count": 43, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } @@ -1088,39 +1094,24 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 67, "id": "f03f090c-2508-46a4-b705-18df2c015186", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "5cc25219c19c41b6b83610ca0d0397f2", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[33.77270983724983, -118.1893899136652], controls=(ZoomControl(options=['position', 'zoom_in_text',…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "map_hqta(lbt_hqta, 'hqta_segment_id')" + "# map_hqta(lbt_hqta, 'hqta_segment_id')" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 68, "id": "c19aba0b-b265-4cfe-8e76-0fca0447acda", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "e9ed295d930b409c8063ff3abea43ad6", + "model_id": "9d4124fffa3849d38d4e43275c918518", "version_major": 2, "version_minor": 0 }, @@ -1133,12 +1124,12 @@ } ], "source": [ - "map_hqta(lbt_hqta >> filter(_.shape_id == '1730123'))" + "map_hqta(lbt_hqta >> filter(_.shape_id == '1730123'), 'stop_id')" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 69, "id": "4e62a18b-a65f-4027-87f2-7da1227a4d3b", "metadata": {}, "outputs": [], @@ -1148,7 +1139,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 70, "id": "970b2cb6-7511-44be-bfb1-4d1c1d1bfe2b", "metadata": {}, "outputs": [ @@ -1557,7 +1548,7 @@ "23 10 False " ] }, - "execution_count": 45, + "execution_count": 70, "metadata": {}, "output_type": "execute_result" } @@ -1566,6 +1557,1161 @@ "lbt_hqta >> filter(_.shape_id == '1730123')" ] }, + { + "cell_type": "code", + "execution_count": 72, + "id": "144e0093-693f-4fa3-b1f4-849f763a9f28", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexcalitp_itp_idshape_idcalitp_extracted_atgeometrysegment_sequencehqta_segment_idstop_idn_tripsam_max_tripspm_max_tripshq_transit_corrlast_seg_hqtanext_seg_hqta
0017017301232021-10-06POLYGON ((175350.451 -454051.814, 175349.213 -...0263163155141136955TrueFalseTrue
1017017301232021-10-06POLYGON ((175836.936 -454587.721, 175836.959 -...1395710928941163532FalseTrueFalse
2017017301232021-10-06POLYGON ((175798.075 -455972.107, 175798.083 -...2192662005141193532FalseFalseTrue
3017017301232021-10-06POLYGON ((175827.602 -457076.012, 175827.610 -...39770266130333532FalseTrueTrue
4017017301232021-10-06POLYGON ((175854.103 -458921.667, 175854.135 -...4261241411841243532FalseTrueTrue
5017017301232021-10-06POLYGON ((176737.013 -460049.998, 176737.342 -...5397105310419093433FalseFalseNaN
6017017301232021-10-06POLYGON ((177991.832 -460007.766, 178010.111 -...6197500301819023122FalseTrueTrue
7017017301232021-10-06POLYGON ((178396.327 -461576.519, 178395.927 -...74607772415693233FalseNaNTrue
8017017301232021-10-06POLYGON ((178429.971 -462989.509, 178430.591 -...8244947623718027255TrueFalseFalse
9017017301232021-10-06POLYGON ((178152.046 -463095.761, 178090.699 -...9384245609112724943FalseTrueTrue
10017017301232021-10-06POLYGON ((175975.412 -463280.594, 175977.308 -...10306201292719724943FalseFalseTrue
11017017301232021-10-06POLYGON ((175919.561 -463405.079, 175916.534 -...11324676285717953122FalseTrueFalse
12017017301232021-10-06POLYGON ((176053.775 -464584.739, 176053.777 -...12148563425917923122FalseFalseFalse
13017017301232021-10-06POLYGON ((176068.527 -465823.921, 176068.537 -...1379769043717883122FalseTrueFalse
14017017301232021-10-06POLYGON ((175997.767 -467784.889, 175997.533 -...14298525488605293122FalseTrueFalse
15017017301232021-10-06POLYGON ((175564.080 -467890.219, 175563.606 -...15333712164805273122FalseFalseTrue
16017017301232021-10-06POLYGON ((173784.416 -467841.455, 173785.048 -...16160859719417793122FalseFalseFalse
17017017301232021-10-06POLYGON ((171789.381 -467743.362, 171793.498 -...17686165596134611077TrueFalseFalse
18017017301232021-10-06POLYGON ((171187.739 -467856.064, 171187.546 -...183092845517167211077TrueFalseFalse
19017017301232021-10-06POLYGON ((169935.539 -467879.393, 169923.522 -...193479053147166711077TrueFalseFalse
20017017301232021-10-06POLYGON ((168696.051 -467903.956, 168680.399 -...202645542972166311077TrueTrueFalse
21017017301232021-10-06POLYGON ((168037.524 -467916.250, 168037.372 -...213936942250166211077TrueFalseFalse
22017017301232021-10-06POLYGON ((167357.829 -467928.625, 167358.227 -...221939974416005411078TrueFalseFalse
23017017301232021-10-06POLYGON ((167281.629 -469235.162, 167281.182 -...237802714203601521010TrueFalseFalse
\n", + "
" + ], + "text/plain": [ + " index calitp_itp_id shape_id calitp_extracted_at \\\n", + "0 0 170 1730123 2021-10-06 \n", + "1 0 170 1730123 2021-10-06 \n", + "2 0 170 1730123 2021-10-06 \n", + "3 0 170 1730123 2021-10-06 \n", + "4 0 170 1730123 2021-10-06 \n", + "5 0 170 1730123 2021-10-06 \n", + "6 0 170 1730123 2021-10-06 \n", + "7 0 170 1730123 2021-10-06 \n", + "8 0 170 1730123 2021-10-06 \n", + "9 0 170 1730123 2021-10-06 \n", + "10 0 170 1730123 2021-10-06 \n", + "11 0 170 1730123 2021-10-06 \n", + "12 0 170 1730123 2021-10-06 \n", + "13 0 170 1730123 2021-10-06 \n", + "14 0 170 1730123 2021-10-06 \n", + "15 0 170 1730123 2021-10-06 \n", + "16 0 170 1730123 2021-10-06 \n", + "17 0 170 1730123 2021-10-06 \n", + "18 0 170 1730123 2021-10-06 \n", + "19 0 170 1730123 2021-10-06 \n", + "20 0 170 1730123 2021-10-06 \n", + "21 0 170 1730123 2021-10-06 \n", + "22 0 170 1730123 2021-10-06 \n", + "23 0 170 1730123 2021-10-06 \n", + "\n", + " geometry segment_sequence \\\n", + "0 POLYGON ((175350.451 -454051.814, 175349.213 -... 0 \n", + "1 POLYGON ((175836.936 -454587.721, 175836.959 -... 1 \n", + "2 POLYGON ((175798.075 -455972.107, 175798.083 -... 2 \n", + "3 POLYGON ((175827.602 -457076.012, 175827.610 -... 3 \n", + "4 POLYGON ((175854.103 -458921.667, 175854.135 -... 4 \n", + "5 POLYGON ((176737.013 -460049.998, 176737.342 -... 5 \n", + "6 POLYGON ((177991.832 -460007.766, 178010.111 -... 6 \n", + "7 POLYGON ((178396.327 -461576.519, 178395.927 -... 7 \n", + "8 POLYGON ((178429.971 -462989.509, 178430.591 -... 8 \n", + "9 POLYGON ((178152.046 -463095.761, 178090.699 -... 9 \n", + "10 POLYGON ((175975.412 -463280.594, 175977.308 -... 10 \n", + "11 POLYGON ((175919.561 -463405.079, 175916.534 -... 11 \n", + "12 POLYGON ((176053.775 -464584.739, 176053.777 -... 12 \n", + "13 POLYGON ((176068.527 -465823.921, 176068.537 -... 13 \n", + "14 POLYGON ((175997.767 -467784.889, 175997.533 -... 14 \n", + "15 POLYGON ((175564.080 -467890.219, 175563.606 -... 15 \n", + "16 POLYGON ((173784.416 -467841.455, 173785.048 -... 16 \n", + "17 POLYGON ((171789.381 -467743.362, 171793.498 -... 17 \n", + "18 POLYGON ((171187.739 -467856.064, 171187.546 -... 18 \n", + "19 POLYGON ((169935.539 -467879.393, 169923.522 -... 19 \n", + "20 POLYGON ((168696.051 -467903.956, 168680.399 -... 20 \n", + "21 POLYGON ((168037.524 -467916.250, 168037.372 -... 21 \n", + "22 POLYGON ((167357.829 -467928.625, 167358.227 -... 22 \n", + "23 POLYGON ((167281.629 -469235.162, 167281.182 -... 23 \n", + "\n", + " hqta_segment_id stop_id n_trips am_max_trips pm_max_trips \\\n", + "0 2631631551 4113 69 5 5 \n", + "1 3957109289 4116 35 3 2 \n", + "2 1926620051 4119 35 3 2 \n", + "3 97702661 3033 35 3 2 \n", + "4 2612414118 4124 35 3 2 \n", + "5 3971053104 1909 34 3 3 \n", + "6 1975003018 1902 31 2 2 \n", + "7 46077724 1569 32 3 3 \n", + "8 2449476237 1802 72 5 5 \n", + "9 3842456091 1272 49 4 3 \n", + "10 3062012927 1972 49 4 3 \n", + "11 3246762857 1795 31 2 2 \n", + "12 1485634259 1792 31 2 2 \n", + "13 797690437 1788 31 2 2 \n", + "14 2985254886 0529 31 2 2 \n", + "15 3337121648 0527 31 2 2 \n", + "16 1608597194 1779 31 2 2 \n", + "17 686165596 1346 110 7 7 \n", + "18 3092845517 1672 110 7 7 \n", + "19 3479053147 1667 110 7 7 \n", + "20 2645542972 1663 110 7 7 \n", + "21 3936942250 1662 110 7 7 \n", + "22 1939974416 0054 110 7 8 \n", + "23 78027142 0360 152 10 10 \n", + "\n", + " hq_transit_corr last_seg_hqta next_seg_hqta \n", + "0 True False True \n", + "1 False True False \n", + "2 False False True \n", + "3 False True True \n", + "4 False True True \n", + "5 False False NaN \n", + "6 False True True \n", + "7 False NaN True \n", + "8 True False False \n", + "9 False True True \n", + "10 False False True \n", + "11 False True False \n", + "12 False False False \n", + "13 False True False \n", + "14 False True False \n", + "15 False False True \n", + "16 False False False \n", + "17 True False False \n", + "18 True False False \n", + "19 True False False \n", + "20 True True False \n", + "21 True False False \n", + "22 True False False \n", + "23 True False False " + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sps = debug_dict['1730123_sps']\n", + "sps" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "id": "aa772241-9e43-47eb-b2a2-5e9c727cc46c", + "metadata": {}, + "outputs": [], + "source": [ + "sps['hq_transit_corr'] = sps.apply(\n", + " lambda x: False if x.hq_transit_corr == False else x.last_seg_hqta or x.next_seg_hqta, axis = 1)\n", + "sps['hq_transit_corr'] = sps['hq_transit_corr'].fillna(True)" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "id": "efbd4c3b-77f8-4385-b00d-993beb00057f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexcalitp_itp_idshape_idcalitp_extracted_atgeometrysegment_sequencehqta_segment_idstop_idn_tripsam_max_tripspm_max_tripshq_transit_corrlast_seg_hqtanext_seg_hqta
0017017301232021-10-06POLYGON ((175350.451 -454051.814, 175349.213 -...0263163155141136955TrueFalseTrue
1017017301232021-10-06POLYGON ((175836.936 -454587.721, 175836.959 -...1395710928941163532FalseTrueFalse
2017017301232021-10-06POLYGON ((175798.075 -455972.107, 175798.083 -...2192662005141193532FalseFalseTrue
3017017301232021-10-06POLYGON ((175827.602 -457076.012, 175827.610 -...39770266130333532FalseTrueTrue
4017017301232021-10-06POLYGON ((175854.103 -458921.667, 175854.135 -...4261241411841243532FalseTrueTrue
5017017301232021-10-06POLYGON ((176737.013 -460049.998, 176737.342 -...5397105310419093433FalseFalseNaN
6017017301232021-10-06POLYGON ((177991.832 -460007.766, 178010.111 -...6197500301819023122FalseTrueTrue
7017017301232021-10-06POLYGON ((178396.327 -461576.519, 178395.927 -...74607772415693233FalseNaNTrue
8017017301232021-10-06POLYGON ((178429.971 -462989.509, 178430.591 -...8244947623718027255FalseFalseFalse
9017017301232021-10-06POLYGON ((178152.046 -463095.761, 178090.699 -...9384245609112724943FalseTrueTrue
10017017301232021-10-06POLYGON ((175975.412 -463280.594, 175977.308 -...10306201292719724943FalseFalseTrue
11017017301232021-10-06POLYGON ((175919.561 -463405.079, 175916.534 -...11324676285717953122FalseTrueFalse
12017017301232021-10-06POLYGON ((176053.775 -464584.739, 176053.777 -...12148563425917923122FalseFalseFalse
13017017301232021-10-06POLYGON ((176068.527 -465823.921, 176068.537 -...1379769043717883122FalseTrueFalse
14017017301232021-10-06POLYGON ((175997.767 -467784.889, 175997.533 -...14298525488605293122FalseTrueFalse
15017017301232021-10-06POLYGON ((175564.080 -467890.219, 175563.606 -...15333712164805273122FalseFalseTrue
16017017301232021-10-06POLYGON ((173784.416 -467841.455, 173785.048 -...16160859719417793122FalseFalseFalse
17017017301232021-10-06POLYGON ((171789.381 -467743.362, 171793.498 -...17686165596134611077FalseFalseFalse
18017017301232021-10-06POLYGON ((171187.739 -467856.064, 171187.546 -...183092845517167211077FalseFalseFalse
19017017301232021-10-06POLYGON ((169935.539 -467879.393, 169923.522 -...193479053147166711077FalseFalseFalse
20017017301232021-10-06POLYGON ((168696.051 -467903.956, 168680.399 -...202645542972166311077TrueTrueFalse
21017017301232021-10-06POLYGON ((168037.524 -467916.250, 168037.372 -...213936942250166211077FalseFalseFalse
22017017301232021-10-06POLYGON ((167357.829 -467928.625, 167358.227 -...221939974416005411078FalseFalseFalse
23017017301232021-10-06POLYGON ((167281.629 -469235.162, 167281.182 -...237802714203601521010FalseFalseFalse
\n", + "
" + ], + "text/plain": [ + " index calitp_itp_id shape_id calitp_extracted_at \\\n", + "0 0 170 1730123 2021-10-06 \n", + "1 0 170 1730123 2021-10-06 \n", + "2 0 170 1730123 2021-10-06 \n", + "3 0 170 1730123 2021-10-06 \n", + "4 0 170 1730123 2021-10-06 \n", + "5 0 170 1730123 2021-10-06 \n", + "6 0 170 1730123 2021-10-06 \n", + "7 0 170 1730123 2021-10-06 \n", + "8 0 170 1730123 2021-10-06 \n", + "9 0 170 1730123 2021-10-06 \n", + "10 0 170 1730123 2021-10-06 \n", + "11 0 170 1730123 2021-10-06 \n", + "12 0 170 1730123 2021-10-06 \n", + "13 0 170 1730123 2021-10-06 \n", + "14 0 170 1730123 2021-10-06 \n", + "15 0 170 1730123 2021-10-06 \n", + "16 0 170 1730123 2021-10-06 \n", + "17 0 170 1730123 2021-10-06 \n", + "18 0 170 1730123 2021-10-06 \n", + "19 0 170 1730123 2021-10-06 \n", + "20 0 170 1730123 2021-10-06 \n", + "21 0 170 1730123 2021-10-06 \n", + "22 0 170 1730123 2021-10-06 \n", + "23 0 170 1730123 2021-10-06 \n", + "\n", + " geometry segment_sequence \\\n", + "0 POLYGON ((175350.451 -454051.814, 175349.213 -... 0 \n", + "1 POLYGON ((175836.936 -454587.721, 175836.959 -... 1 \n", + "2 POLYGON ((175798.075 -455972.107, 175798.083 -... 2 \n", + "3 POLYGON ((175827.602 -457076.012, 175827.610 -... 3 \n", + "4 POLYGON ((175854.103 -458921.667, 175854.135 -... 4 \n", + "5 POLYGON ((176737.013 -460049.998, 176737.342 -... 5 \n", + "6 POLYGON ((177991.832 -460007.766, 178010.111 -... 6 \n", + "7 POLYGON ((178396.327 -461576.519, 178395.927 -... 7 \n", + "8 POLYGON ((178429.971 -462989.509, 178430.591 -... 8 \n", + "9 POLYGON ((178152.046 -463095.761, 178090.699 -... 9 \n", + "10 POLYGON ((175975.412 -463280.594, 175977.308 -... 10 \n", + "11 POLYGON ((175919.561 -463405.079, 175916.534 -... 11 \n", + "12 POLYGON ((176053.775 -464584.739, 176053.777 -... 12 \n", + "13 POLYGON ((176068.527 -465823.921, 176068.537 -... 13 \n", + "14 POLYGON ((175997.767 -467784.889, 175997.533 -... 14 \n", + "15 POLYGON ((175564.080 -467890.219, 175563.606 -... 15 \n", + "16 POLYGON ((173784.416 -467841.455, 173785.048 -... 16 \n", + "17 POLYGON ((171789.381 -467743.362, 171793.498 -... 17 \n", + "18 POLYGON ((171187.739 -467856.064, 171187.546 -... 18 \n", + "19 POLYGON ((169935.539 -467879.393, 169923.522 -... 19 \n", + "20 POLYGON ((168696.051 -467903.956, 168680.399 -... 20 \n", + "21 POLYGON ((168037.524 -467916.250, 168037.372 -... 21 \n", + "22 POLYGON ((167357.829 -467928.625, 167358.227 -... 22 \n", + "23 POLYGON ((167281.629 -469235.162, 167281.182 -... 23 \n", + "\n", + " hqta_segment_id stop_id n_trips am_max_trips pm_max_trips \\\n", + "0 2631631551 4113 69 5 5 \n", + "1 3957109289 4116 35 3 2 \n", + "2 1926620051 4119 35 3 2 \n", + "3 97702661 3033 35 3 2 \n", + "4 2612414118 4124 35 3 2 \n", + "5 3971053104 1909 34 3 3 \n", + "6 1975003018 1902 31 2 2 \n", + "7 46077724 1569 32 3 3 \n", + "8 2449476237 1802 72 5 5 \n", + "9 3842456091 1272 49 4 3 \n", + "10 3062012927 1972 49 4 3 \n", + "11 3246762857 1795 31 2 2 \n", + "12 1485634259 1792 31 2 2 \n", + "13 797690437 1788 31 2 2 \n", + "14 2985254886 0529 31 2 2 \n", + "15 3337121648 0527 31 2 2 \n", + "16 1608597194 1779 31 2 2 \n", + "17 686165596 1346 110 7 7 \n", + "18 3092845517 1672 110 7 7 \n", + "19 3479053147 1667 110 7 7 \n", + "20 2645542972 1663 110 7 7 \n", + "21 3936942250 1662 110 7 7 \n", + "22 1939974416 0054 110 7 8 \n", + "23 78027142 0360 152 10 10 \n", + "\n", + " hq_transit_corr last_seg_hqta next_seg_hqta \n", + "0 True False True \n", + "1 False True False \n", + "2 False False True \n", + "3 False True True \n", + "4 False True True \n", + "5 False False NaN \n", + "6 False True True \n", + "7 False NaN True \n", + "8 False False False \n", + "9 False True True \n", + "10 False False True \n", + "11 False True False \n", + "12 False False False \n", + "13 False True False \n", + "14 False True False \n", + "15 False False True \n", + "16 False False False \n", + "17 False False False \n", + "18 False False False \n", + "19 False False False \n", + "20 True True False \n", + "21 False False False \n", + "22 False False False \n", + "23 False False False " + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sps" + ] + }, { "cell_type": "markdown", "id": "b37c7411-8ea1-48c2-b42a-b437cdef7eaa", From 4c31e21e83e2446bc8385d7ace05bb13a4f5a1bc Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Fri, 10 Dec 2021 00:16:17 +0000 Subject: [PATCH 13/24] interim export for opr --- .../combine_and_visualize.ipynb | 2125 +++++++++++++---- 1 file changed, 1671 insertions(+), 454 deletions(-) diff --git a/high_quality_transit_areas/combine_and_visualize.ipynb b/high_quality_transit_areas/combine_and_visualize.ipynb index 19ba79e8b..28abca3d7 100644 --- a/high_quality_transit_areas/combine_and_visualize.ipynb +++ b/high_quality_transit_areas/combine_and_visualize.ipynb @@ -2,110 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "7f9e615b-d071-4728-b774-1d02f509c332", "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", - "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", - "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", - "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", - "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", - "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", - "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", - "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", - "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", - "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", - "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", - "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", - "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", - "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", - "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", - "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", - "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", - "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", - "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", - "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", - "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", - "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" - ] - } - ], + "outputs": [], "source": [ - "!pip install -r requirements.txt" + "# !pip install -r requirements.txt" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 162, "id": "4d53c57e-0777-4c0d-9dc6-4954c95ed307", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -125,19 +37,20 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 163, "id": "e31ad027-1acc-44f8-bdd6-31f1b9b36a77", "metadata": {}, "outputs": [], "source": [ "bus_hqtc = gpd.read_parquet(f'{GCS_FILE_PATH}shape_hqta_dissolve.parquet')\n", "bus_hqtc = bus_hqtc[bus_hqtc['hq_transit_corr']]\n", - "bus_hqtc['hqta_type'] = 'hq_transit_corr'" + "bus_hqtc['hqta_type'] = 'hq_transit_corr'\n", + "bus_hqtc['route_type'] = '3'" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 164, "id": "bcbea24e-ab7e-400a-8813-6a477471c1d6", "metadata": {}, "outputs": [], @@ -148,23 +61,19 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 165, "id": "6aec4721-0827-40f3-be60-0790916b0385", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Index(['stop_id', 'calitp_itp_id', 'stop_lat', 'stop_lon', 'itp_id_stop_id',\n", - " 'itp_id_trip_id', 'route_id', 'itp_id_route_id', 'trip_id', 'geometry',\n", - " 'calitp_url_number', 'route_type', 'agency_id', 'route_short_name',\n", - " 'route_long_name', 'route_desc', 'route_url', 'route_color',\n", - " 'route_text_color', 'route_sort_order', 'continuous_pickup',\n", - " 'continuous_drop_off', 'calitp_extracted_at', 'hqta_type'],\n", + "Index(['calitp_itp_id', 'calitp_url_number', 'stop_id', 'stop_lat', 'stop_lon',\n", + " 'route_type', 'geometry', 'hqta_type'],\n", " dtype='object')" ] }, - "execution_count": 7, + "execution_count": 165, "metadata": {}, "output_type": "execute_result" } @@ -175,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 166, "id": "0e807584-dfb2-4385-b274-7276b0bc38d0", "metadata": { "tags": [] @@ -187,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 167, "id": "3b9a9f5e-6371-4367-978c-c0be0e6d979f", "metadata": { "tags": [] @@ -237,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 168, "id": "441de95c-34c4-46bd-a95c-bfa0fd0338ea", "metadata": {}, "outputs": [ @@ -272,6 +181,7 @@ " am_max_trips\n", " pm_max_trips\n", " hqta_type\n", + " route_type\n", " \n", " \n", " \n", @@ -287,6 +197,7 @@ " 7.0\n", " 8.0\n", " hq_transit_corr\n", + " 3\n", " \n", " \n", " 2257\n", @@ -300,6 +211,7 @@ " 5.0\n", " 7.0\n", " hq_transit_corr\n", + " 3\n", " \n", " \n", " 2258\n", @@ -313,6 +225,7 @@ " 5.0\n", " 6.0\n", " hq_transit_corr\n", + " 3\n", " \n", " \n", "\n", @@ -334,13 +247,13 @@ "2257 4126984225 1 4654 \n", "2258 1555422069 0 6679 \n", "\n", - " am_max_trips pm_max_trips hqta_type \n", - "2256 7.0 8.0 hq_transit_corr \n", - "2257 5.0 7.0 hq_transit_corr \n", - "2258 5.0 6.0 hq_transit_corr " + " am_max_trips pm_max_trips hqta_type route_type \n", + "2256 7.0 8.0 hq_transit_corr 3 \n", + "2257 5.0 7.0 hq_transit_corr 3 \n", + "2258 5.0 6.0 hq_transit_corr 3 " ] }, - "execution_count": 8, + "execution_count": 168, "metadata": {}, "output_type": "execute_result" } @@ -351,7 +264,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 169, "id": "f104e680-a949-4e07-a4dd-19950207c66f", "metadata": {}, "outputs": [], @@ -373,7 +286,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 170, "id": "96caf70f-e497-4df4-9b1a-20b54f7b7f83", "metadata": {}, "outputs": [], @@ -383,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 171, "id": "cdb9023e-8397-4eed-b829-0ab22ee26580", "metadata": {}, "outputs": [], @@ -393,7 +306,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 172, "id": "a54925c8-cb64-452f-b8ac-18407ed3f9d6", "metadata": {}, "outputs": [], @@ -403,17 +316,17 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 173, "id": "c3f748fa-861d-4d7c-b005-480d6ecc30a2", "metadata": {}, "outputs": [], "source": [ - "major_bus = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops_working.parquet')" + "# major_bus = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops_working.parquet')" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 174, "id": "ca09eb4e-97b4-48b6-ba21-542ac35c8ceb", "metadata": {}, "outputs": [], @@ -432,17 +345,17 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 175, "id": "82e5d819-63dc-4ba3-a9f9-c314f5a4ca33", "metadata": {}, "outputs": [], "source": [ - "major_bus['geometry'] = major_bus.geometry.apply(drop_big_areas)" + "# major_bus['geometry'] = major_bus.geometry.apply(drop_big_areas)" ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 176, "id": "6273ed98-b5a2-4e83-bfac-9f487f8c6142", "metadata": {}, "outputs": [], @@ -463,21 +376,59 @@ }, { "cell_type": "code", - "execution_count": 29, - "id": "c35ed21e-d6e0-42cf-8bd5-e4792d5d3c14", + "execution_count": 177, + "id": "280f79d2-ed38-419d-be89-653167b1efec", "metadata": {}, "outputs": [], "source": [ - "major_bus = major_bus.dropna(subset=['geometry'])" + "# major_bus = major_bus.dropna(subset=['geometry'])\n", + "\n", + "# major_bus.apply(explode_geoms, axis=1)\n", + "\n", + "# row_per_stop = row_per_stop.reset_index(drop=True)\n", + "\n", + "# row_per_stop = row_per_stop[['calitp_itp_id', 'stop_id', 'geometry']]\n", + "\n", + "# row_per_stop['hqta_type'] = 'major_transit_stop'\n", + "\n", + "# row_per_stop = row_per_stop.set_crs('EPSG:6414')" ] }, { "cell_type": "code", - "execution_count": 30, - "id": "2df43e17-9ca0-4c46-b6a1-92d77ec98d3a", - "metadata": { - "tags": [] - }, + "execution_count": 178, + "id": "d01200cc-cda2-4635-af68-3b8448e70b5a", + "metadata": {}, + "outputs": [], + "source": [ + "# row_per_stop.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 179, + "id": "5bbfaa07-f16c-46a9-ae5e-338a5b7f5d8b", + "metadata": {}, + "outputs": [], + "source": [ + "# geoparquet_gcs_export(row_per_stop, 'major_bus_stops')" + ] + }, + { + "cell_type": "code", + "execution_count": 180, + "id": "87dbcdc7-79f0-48e4-91d4-647cdb087cf5", + "metadata": {}, + "outputs": [], + "source": [ + "major_bus_stops = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 181, + "id": "e3e8c306-a89f-438f-8f0e-5e165e257cb6", + "metadata": {}, "outputs": [ { "data": { @@ -500,287 +451,88 @@ " \n", " \n", " \n", - " hq_transit_corr\n", - " shape_id\n", - " geometry\n", - " level_0\n", " calitp_itp_id\n", - " hqta_segment_id\n", - " n_trips\n", - " segment_sequence\n", " stop_id\n", - " am_peak\n", - " pm_peak\n", + " geometry\n", " hqta_type\n", " \n", " \n", " \n", " \n", - " 2464\n", - " True\n", - " 0500\n", - " POINT (193061.249 -465491.440)\n", - " 0\n", + " 0\n", " 142\n", - " 2197551287\n", - " 134.0\n", - " 0\n", " 3977\n", - " 9.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2467\n", - " True\n", - " 100706_SEPT21\n", - " POINT (149243.534 -435856.085)\n", - " 0\n", - " 182\n", - " 2368710740\n", - " 120.0\n", - " 1\n", - " 16374\n", - " 6.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2468\n", - " True\n", - " 100708_SEPT21\n", - " POINT (159441.767 -444289.585)\n", - " 3\n", - " 182\n", - " 2883785450\n", - " 72.0\n", - " 3\n", - " 9785\n", - " 4.7\n", - " 4.7\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2471\n", - " True\n", - " 1020067_SEPT21\n", - " POINT (150511.825 -447354.169)\n", - " 3\n", - " 182\n", - " 2238923216\n", - " 115.0\n", - " 4\n", - " 11283\n", - " 8.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2475\n", - " True\n", - " 103717\n", - " POINT (-178950.630 -71003.248)\n", - " 1\n", - " 294\n", - " 2280977661\n", - " 136.0\n", - " 3\n", - " 480\n", - " 7.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " \n", - " \n", - " 3231\n", - " True\n", - " shp-73-01\n", - " POINT (-194726.607 -31504.765)\n", - " 0\n", - " 4\n", - " 1652690359\n", - " 220.0\n", - " 0\n", - " 3708\n", - " 9.3\n", - " 11.7\n", - " hq_transit_corr\n", - " \n", - " \n", - " 3232\n", - " True\n", - " shp-73-51\n", - " POINT (-194726.607 -31504.765)\n", - " 0\n", - " 4\n", - " 1682558812\n", - " 238.0\n", - " 0\n", - " 2712\n", - " 13.3\n", - " 10.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 3236\n", - " True\n", - " shp-88-07\n", - " POINT (-200443.266 -13810.682)\n", - " 1\n", - " 4\n", - " 3310950755\n", - " 83.0\n", - " 1\n", - " 2026\n", - " 4.7\n", - " 5.0\n", - " hq_transit_corr\n", + " POINT (199058.382 -471125.032)\n", + " major_transit_stop\n", " \n", " \n", - " 3238\n", - " True\n", - " shp-97-57\n", - " POINT (-187275.985 -33268.849)\n", - " 0\n", - " 4\n", - " 4254707562\n", - " 80.0\n", - " 0\n", - " 4320\n", - " 4.3\n", - " 4.7\n", - " hq_transit_corr\n", + " 1\n", + " 142\n", + " 3977\n", + " POINT (198531.592 -471368.189)\n", + " major_transit_stop\n", " \n", " \n", - " 3239\n", - " True\n", - " shp-99-08\n", - " POINT (-178261.436 -45851.507)\n", - " 0\n", - " 4\n", - " 3287994159\n", - " 142.0\n", - " 0\n", - " 6243\n", - " 7.7\n", - " 8.0\n", - " hq_transit_corr\n", + " 2\n", + " 142\n", + " 3977\n", + " POINT (193068.693 -465847.391)\n", + " major_transit_stop\n", " \n", " \n", "\n", - "

349 rows × 12 columns

\n", "" ], "text/plain": [ - " hq_transit_corr shape_id geometry \\\n", - "2464 True 0500 POINT (193061.249 -465491.440) \n", - "2467 True 100706_SEPT21 POINT (149243.534 -435856.085) \n", - "2468 True 100708_SEPT21 POINT (159441.767 -444289.585) \n", - "2471 True 1020067_SEPT21 POINT (150511.825 -447354.169) \n", - "2475 True 103717 POINT (-178950.630 -71003.248) \n", - "... ... ... ... \n", - "3231 True shp-73-01 POINT (-194726.607 -31504.765) \n", - "3232 True shp-73-51 POINT (-194726.607 -31504.765) \n", - "3236 True shp-88-07 POINT (-200443.266 -13810.682) \n", - "3238 True shp-97-57 POINT (-187275.985 -33268.849) \n", - "3239 True shp-99-08 POINT (-178261.436 -45851.507) \n", - "\n", - " level_0 calitp_itp_id hqta_segment_id n_trips segment_sequence \\\n", - "2464 0 142 2197551287 134.0 0 \n", - "2467 0 182 2368710740 120.0 1 \n", - "2468 3 182 2883785450 72.0 3 \n", - "2471 3 182 2238923216 115.0 4 \n", - "2475 1 294 2280977661 136.0 3 \n", - "... ... ... ... ... ... \n", - "3231 0 4 1652690359 220.0 0 \n", - "3232 0 4 1682558812 238.0 0 \n", - "3236 1 4 3310950755 83.0 1 \n", - "3238 0 4 4254707562 80.0 0 \n", - "3239 0 4 3287994159 142.0 0 \n", - "\n", - " stop_id am_peak pm_peak hqta_type \n", - "2464 3977 9.0 8.0 hq_transit_corr \n", - "2467 16374 6.0 8.0 hq_transit_corr \n", - "2468 9785 4.7 4.7 hq_transit_corr \n", - "2471 11283 8.0 8.0 hq_transit_corr \n", - "2475 480 7.0 8.0 hq_transit_corr \n", - "... ... ... ... ... \n", - "3231 3708 9.3 11.7 hq_transit_corr \n", - "3232 2712 13.3 10.0 hq_transit_corr \n", - "3236 2026 4.7 5.0 hq_transit_corr \n", - "3238 4320 4.3 4.7 hq_transit_corr \n", - "3239 6243 7.7 8.0 hq_transit_corr \n", - "\n", - "[349 rows x 12 columns]" + " calitp_itp_id stop_id geometry hqta_type\n", + "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop\n", + "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop\n", + "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop" ] }, - "execution_count": 30, + "execution_count": 181, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "major_bus.apply(explode_geoms, axis=1)" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "id": "6ab04e63-f673-48d4-bf1a-d01d203f5b33", - "metadata": {}, - "outputs": [], - "source": [ - "row_per_stop = row_per_stop.reset_index(drop=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "id": "92d2df98-49d9-4786-bd53-df2ddc107354", - "metadata": {}, - "outputs": [], - "source": [ - "row_per_stop = row_per_stop[['calitp_itp_id', 'stop_id', 'geometry']]" + "major_bus_stops.head(3)" ] }, { "cell_type": "code", - "execution_count": 33, - "id": "faaa147d-ae1e-4b9b-a7a2-ff462a3c66fd", + "execution_count": 182, + "id": "24daf28c-943a-4a9f-871c-e11b5d761595", "metadata": {}, "outputs": [], "source": [ - "row_per_stop['hqta_type'] = 'major_transit_stop'" + "tbl_stops = (tbl.views.gtfs_schedule_fact_daily_feed_stops()\n", + " >> filter(_.date == '2021-12-01')\n", + " >> filter(_.calitp_extracted_at < '2021-12-01')\n", + " >> filter(_.calitp_deleted_at > '2021-12-01')\n", + " >> select(_.stop_key)\n", + " >> inner_join(_, tbl.views.gtfs_schedule_dim_stops(), on = 'stop_key')\n", + " >> select(_.stop_id, _.stop_lat, _.stop_lon, _.calitp_itp_id)\n", + " >> collect()\n", + ")" ] }, { "cell_type": "code", - "execution_count": 34, - "id": "3e574e12-8017-4867-9230-8fa891e914bb", + "execution_count": 183, + "id": "cddf70f5-cca1-4896-9f52-1ea5004278e5", "metadata": {}, "outputs": [], "source": [ - "row_per_stop = row_per_stop.set_crs('EPSG:6414')" + "tbl_stops = gpd.GeoDataFrame(tbl_stops,\n", + " geometry = gpd.points_from_xy(tbl_stops.stop_lon, tbl_stops.stop_lat),\n", + " crs = 'EPSG:4326').to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)" ] }, { "cell_type": "code", - "execution_count": 35, - "id": "d01200cc-cda2-4635-af68-3b8448e70b5a", + "execution_count": 184, + "id": "27ec75fc-e017-4f98-96f8-94d8d6ca479e", "metadata": {}, "outputs": [ { @@ -804,141 +556,1606 @@ " \n", " \n", " \n", - " calitp_itp_id\n", " stop_id\n", + " stop_lat\n", + " stop_lon\n", + " calitp_itp_id\n", " geometry\n", - " hqta_type\n", " \n", " \n", " \n", " \n", " 0\n", - " 142\n", - " 3977\n", - " POINT (199058.382 -471125.032)\n", - " major_transit_stop\n", + " 5090\n", + " 36.080261\n", + " -119.021684\n", + " 256\n", + " POINT (87996.619 -214744.271)\n", " \n", " \n", " 1\n", - " 142\n", - " 3977\n", - " POINT (198531.592 -471368.189)\n", - " major_transit_stop\n", + " 8050\n", + " 36.061094\n", + " -118.994880\n", + " 256\n", + " POINT (90430.048 -216848.624)\n", " \n", " \n", " 2\n", - " 142\n", - " 3977\n", - " POINT (193068.693 -465847.391)\n", - " major_transit_stop\n", + " 1100\n", + " 36.073048\n", + " -119.020918\n", + " 256\n", + " POINT (88073.792 -215544.973)\n", " \n", " \n", "\n", "" ], "text/plain": [ - " calitp_itp_id stop_id geometry hqta_type\n", - "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop\n", - "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop\n", - "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop" + " stop_id stop_lat stop_lon calitp_itp_id geometry\n", + "0 5090 36.080261 -119.021684 256 POINT (87996.619 -214744.271)\n", + "1 8050 36.061094 -118.994880 256 POINT (90430.048 -216848.624)\n", + "2 1100 36.073048 -119.020918 256 POINT (88073.792 -215544.973)" ] }, - "execution_count": 35, + "execution_count": 184, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "row_per_stop.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "id": "5bbfaa07-f16c-46a9-ae5e-338a5b7f5d8b", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], - "source": [ - "geoparquet_gcs_export(row_per_stop, 'major_bus_stops')" + "tbl_stops.head(3)" ] }, { "cell_type": "code", - "execution_count": 24, - "id": "dcccae17-5f35-4fc4-a5dc-0e5cf45e2f25", + "execution_count": 185, + "id": "d5a65203-2245-4ea4-94d3-71685a00c929", "metadata": {}, "outputs": [], "source": [ - "# major_bus_operators = [int(x) for x in list(major_bus.calitp_itp_id.astype(int).unique())]" + "to_join = major_bus_stops[['calitp_itp_id']].astype({'calitp_itp_id': 'int64'})" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 186, "id": "19f9b7dd-1b2b-4c7a-9ba9-3e1e1e9b46be", "metadata": { "tags": [] }, "outputs": [], "source": [ - "# tbl_stops = (tbl.gtfs_schedule.stops() \n", - "# >> filter(_.calitp_itp_id.isin(major_bus_operators))\n", - "# >> select(_.stop_id, _.stop_lat, _.stop_lon, _.calitp_itp_id)\n", - "# >> collect()\n", - "# )\n", - "# tbl_stops = gpd.GeoDataFrame(tbl_stops,\n", - "# geometry = gpd.points_from_xy(tbl_stops.stop_lon, tbl_stops.stop_lat),\n", - "# crs = 'EPSG:4326').to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "7d959fef-e315-4985-b3fd-72192096a691", - "metadata": {}, - "outputs": [], - "source": [ - "# def join_stops(df):\n", - "# stops_filtered = tbl_stops >> filter(_.calitp_itp_id == int(df.calitp_itp_id.iloc[0]))\n", - "# df = row_per_stop.sjoin(stops_filtered, how='inner', predicate='contains')\n", - "# return df" + "tbl_stops_major = (tbl_stops\n", + " >> inner_join(_, to_join, on=['calitp_itp_id'])\n", + " >> distinct(_.calitp_itp_id, _.stop_id, _keep_all=True)\n", + " )\n" ] }, { "cell_type": "code", - "execution_count": 27, - "id": "909f1b0f-0d99-4713-90e5-cf86e7bcab1e", - "metadata": {}, - "outputs": [], - "source": [ - "# join_to_stop = row_per_stop.groupby('calitp_itp_id').apply(join_stops)" - ] - }, - { - "cell_type": "markdown", - "id": "f1ac0f78-6b99-4079-8c26-ca875367f6a8", + "execution_count": 187, + "id": "5410b54c-930f-4d88-982a-4275a90334d4", "metadata": {}, - "source": [ - "#### Definitions and Output:\n", - "\n", - "* hqta_type: major_transit_stop\n", - "* stop_id: one stop id... (not ideal, but oh well)\n", - "* geometry: .buffer(700)?\n", - "* _can alway pull more info spatially_" + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
0397137.976371-122.3196634POINT (-203473.763 -1956.750)
1205037.789595-122.2458004POINT (-197487.747 -22870.228)
2344537.767420-122.1963754POINT (-193199.376 -25436.510)
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id \\\n", + "0 3971 37.976371 -122.319663 4 \n", + "1 2050 37.789595 -122.245800 4 \n", + "2 3445 37.767420 -122.196375 4 \n", + "\n", + " geometry \n", + "0 POINT (-203473.763 -1956.750) \n", + "1 POINT (-197487.747 -22870.228) \n", + "2 POINT (-193199.376 -25436.510) " + ] + }, + "execution_count": 187, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tbl_stops_major.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 188, + "id": "9a9987a0-74c2-4018-99d6-bc68ecbb292a", + "metadata": {}, + "outputs": [], + "source": [ + "tbl_stops_major.geometry = tbl_stops_major.buffer(100)" + ] + }, + { + "cell_type": "code", + "execution_count": 189, + "id": "ee7ff27d-6ffc-4458-bd95-5aa5c8a9a57e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
0397137.976371-122.3196634POLYGON ((-203373.763 -1956.750, -203374.244 -...
1205037.789595-122.2458004POLYGON ((-197387.747 -22870.228, -197388.229 ...
2344537.767420-122.1963754POLYGON ((-193099.376 -25436.510, -193099.857 ...
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id \\\n", + "0 3971 37.976371 -122.319663 4 \n", + "1 2050 37.789595 -122.245800 4 \n", + "2 3445 37.767420 -122.196375 4 \n", + "\n", + " geometry \n", + "0 POLYGON ((-203373.763 -1956.750, -203374.244 -... \n", + "1 POLYGON ((-197387.747 -22870.228, -197388.229 ... \n", + "2 POLYGON ((-193099.376 -25436.510, -193099.857 ... " + ] + }, + "execution_count": 189, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tbl_stops_major.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 190, + "id": "1ac15d0a-1aeb-48c4-9acf-92b7642b6fcd", + "metadata": {}, + "outputs": [], + "source": [ + "drop_id = major_bus_stops.drop(columns=['stop_id'])" + ] + }, + { + "cell_type": "code", + "execution_count": 191, + "id": "e1d0d729-4931-4020-bfd6-4c15818caff0", + "metadata": {}, + "outputs": [], + "source": [ + "spatial_stops_major = tbl_stops_major.sjoin(drop_id, how='inner', predicate='contains')" + ] + }, + { + "cell_type": "code", + "execution_count": 192, + "id": "b593d95a-308f-4635-9ce5-f24bbdd164e6", + "metadata": {}, + "outputs": [], + "source": [ + "new_major_stops = spatial_stops_major.drop_duplicates(subset=['stop_id', 'calitp_itp_id_left', 'calitp_itp_id_right'])" + ] + }, + { + "cell_type": "code", + "execution_count": 193, + "id": "46241013-0529-40c7-a8d9-3002637a4240", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/geodataframe.py:1351: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " super().__setitem__(key, value)\n" + ] + } + ], + "source": [ + "new_major_stops.geometry = new_major_stops.centroid" + ] + }, + { + "cell_type": "code", + "execution_count": 194, + "id": "ed5c5734-7ede-4211-a61b-f22eec81686a", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(new_major_stops)" + ] + }, + { + "cell_type": "markdown", + "id": "99a33ab8-c664-4671-89ef-54cdff7462f2", + "metadata": {}, + "source": [ + "### Bus Corridors to Stops Along Corridor" + ] + }, + { + "cell_type": "code", + "execution_count": 195, + "id": "6943606a-d815-49c6-aa43-a7ab27285939", + "metadata": {}, + "outputs": [], + "source": [ + "tbl_stops_corridors = tbl_stops" + ] + }, + { + "cell_type": "code", + "execution_count": 196, + "id": "bf2f1177-b087-416c-8ae4-3f3f3569da55", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
0509036.080261-119.021684256POINT (87996.619 -214744.271)
1805036.061094-118.994880256POINT (90430.048 -216848.624)
2110036.073048-119.020918256POINT (88073.792 -215544.973)
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id geometry\n", + "0 5090 36.080261 -119.021684 256 POINT (87996.619 -214744.271)\n", + "1 8050 36.061094 -118.994880 256 POINT (90430.048 -216848.624)\n", + "2 1100 36.073048 -119.020918 256 POINT (88073.792 -215544.973)" + ] + }, + "execution_count": 196, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tbl_stops_corridors.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 197, + "id": "eda55a78-d4c5-47cc-8012-ac2d1fa4a92f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idhqta_typegeometry
22564812f4ecb6-c161-480e-8ec2-d7e3b63c7e38hq_corridor_busPOLYGON ((-133311.510 166655.910, -133353.419 ...
22571424654hq_corridor_busPOLYGON ((212373.929 -486798.063, 212402.264 -...
22581426679hq_corridor_busMULTIPOLYGON (((200815.723 -472198.343, 200811...
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id hqta_type \\\n", + "2256 48 12f4ecb6-c161-480e-8ec2-d7e3b63c7e38 hq_corridor_bus \n", + "2257 142 4654 hq_corridor_bus \n", + "2258 142 6679 hq_corridor_bus \n", + "\n", + " geometry \n", + "2256 POLYGON ((-133311.510 166655.910, -133353.419 ... \n", + "2257 POLYGON ((212373.929 -486798.063, 212402.264 -... \n", + "2258 MULTIPOLYGON (((200815.723 -472198.343, 200811... " + ] + }, + "execution_count": 197, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bus_hqtc_extract.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 198, + "id": "c161a6c5-bd29-4f0e-aaa2-f83731af42d4", + "metadata": {}, + "outputs": [], + "source": [ + "stops_in_corridor = tbl_stops_corridors.clip(bus_hqtc_extract)" + ] + }, + { + "cell_type": "code", + "execution_count": 199, + "id": "83da99fb-4d2c-438b-bf24-65ce726fba0a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 32894 entries, 26531 to 121250\n", + "Data columns (total 5 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 stop_id 32894 non-null object \n", + " 1 stop_lat 32894 non-null float64 \n", + " 2 stop_lon 32894 non-null float64 \n", + " 3 calitp_itp_id 32894 non-null int64 \n", + " 4 geometry 32894 non-null geometry\n", + "dtypes: float64(2), geometry(1), int64(1), object(1)\n", + "memory usage: 1.5+ MB\n" + ] + } + ], + "source": [ + "stops_in_corridor.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 200, + "id": "82657639-7ad8-43e2-9050-7b49b0da0799", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 32009 entries, 26531 to 121250\n", + "Data columns (total 5 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 stop_id 32009 non-null object \n", + " 1 stop_lat 32009 non-null float64 \n", + " 2 stop_lon 32009 non-null float64 \n", + " 3 calitp_itp_id 32009 non-null int64 \n", + " 4 geometry 32009 non-null geometry\n", + "dtypes: float64(2), geometry(1), int64(1), object(1)\n", + "memory usage: 1.5+ MB\n" + ] + } + ], + "source": [ + "stops_in_corridor.drop_duplicates(subset = ['stop_id', 'calitp_itp_id']).info()" + ] + }, + { + "cell_type": "code", + "execution_count": 201, + "id": "7fbca026-79dc-4249-a6fb-9ee436a422cc", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(bus_hqtc_extract)" + ] + }, + { + "cell_type": "code", + "execution_count": 202, + "id": "d10d08e6-2166-4d74-9b21-40181da5f19e", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(stops_in_corridor)" + ] + }, + { + "cell_type": "markdown", + "id": "f1ac0f78-6b99-4079-8c26-ca875367f6a8", + "metadata": {}, + "source": [ + "#### Definitions and Output:\n", + "\n", + "* hqta_type: major_transit_stop\n", + "* stop_id: one stop id... (not ideal, but oh well)\n", + "* geometry: .buffer(700)?\n", + "* _can alway pull more info spatially_" + ] + }, + { + "cell_type": "markdown", + "id": "03d81f0e-da43-4116-ae9b-b094b1466f2b", + "metadata": {}, + "source": [ + "## Unbuffered Export" + ] + }, + { + "cell_type": "markdown", + "id": "403c2790-2f47-4b3f-9740-443020721a0b", + "metadata": {}, + "source": [ + "Thank you for this data. It would be useful for us to get the HQTC stops as a point data file, not a polygon. Also, if you could differentiate between train, bus, BRT, and ferry stop that would be immensely helpful.\n", + "\n", + "Let me know if it is possible to get the data in this format. " + ] + }, + { + "cell_type": "markdown", + "id": "baa2a7f4-5212-4911-9e6e-1e9bfc2f1d59", + "metadata": {}, + "source": [ + "#### Major Transit Stops (bus intersections)" + ] + }, + { + "cell_type": "code", + "execution_count": 203, + "id": "a4188f4e-5b5f-44d6-b3be-e8ed70fd8e64", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_id_leftgeometryindex_rightcalitp_itp_id_righthqta_type
1205037.789595-122.2458004POINT (-197487.747 -22870.228)18734major_transit_stop
661616037.789312-122.2457844POINT (-197487.086 -22901.713)18734major_transit_stop
868604437.789646-122.2461174POINT (-197515.484 -22863.900)18734major_transit_stop
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id_left \\\n", + "1 2050 37.789595 -122.245800 4 \n", + "661 6160 37.789312 -122.245784 4 \n", + "868 6044 37.789646 -122.246117 4 \n", + "\n", + " geometry index_right calitp_itp_id_right \\\n", + "1 POINT (-197487.747 -22870.228) 1873 4 \n", + "661 POINT (-197487.086 -22901.713) 1873 4 \n", + "868 POINT (-197515.484 -22863.900) 1873 4 \n", + "\n", + " hqta_type \n", + "1 major_transit_stop \n", + "661 major_transit_stop \n", + "868 major_transit_stop " + ] + }, + "execution_count": 203, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_major_stops.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 204, + "id": "c5a8d5cb-fd72-4dbf-85bb-a76996d567eb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idcalitp_itp_id_2hqta_typegeometry
1420504major_stop_busPOINT (-197487.747 -22870.228)
661461604major_stop_busPOINT (-197487.086 -22901.713)
868460444major_stop_busPOINT (-197515.484 -22863.900)
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id calitp_itp_id_2 hqta_type \\\n", + "1 4 2050 4 major_stop_bus \n", + "661 4 6160 4 major_stop_bus \n", + "868 4 6044 4 major_stop_bus \n", + "\n", + " geometry \n", + "1 POINT (-197487.747 -22870.228) \n", + "661 POINT (-197487.086 -22901.713) \n", + "868 POINT (-197515.484 -22863.900) " + ] + }, + "execution_count": 204, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_major_bus_extract = new_major_stops >> select(_.calitp_itp_id == _.calitp_itp_id_left, _.stop_id,\n", + " _.calitp_itp_id_2 == _.calitp_itp_id_right, _.hqta_type, _.geometry\n", + " )\n", + "new_major_bus_extract['hqta_type'] = 'major_stop_bus'\n", + "new_major_bus_extract.head(3)" + ] + }, + { + "cell_type": "markdown", + "id": "e9a0e81f-b16b-4fab-82e6-f7eb84999ee9", + "metadata": {}, + "source": [ + "#### Stops Along HQ Transit Corridors (bus)" + ] + }, + { + "cell_type": "code", + "execution_count": 205, + "id": "644055ed-ab86-4e07-80fb-0c17a457b8f4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
2653126234.420949-119.703600293POINT (27236.798 -399421.201)
66308S8034.421013-119.703516169POINT (27244.495 -399414.075)
2677611334.420955-119.670648293POINT (30264.810 -399410.543)
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id \\\n", + "26531 262 34.420949 -119.703600 293 \n", + "66308 S80 34.421013 -119.703516 169 \n", + "26776 113 34.420955 -119.670648 293 \n", + "\n", + " geometry \n", + "26531 POINT (27236.798 -399421.201) \n", + "66308 POINT (27244.495 -399414.075) \n", + "26776 POINT (30264.810 -399410.543) " + ] + }, + "execution_count": 205, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "stops_in_corridor.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 206, + "id": "e3fe89fe-f38c-4209-80da-b1a7ec950933", + "metadata": {}, + "outputs": [], + "source": [ + "stops_extract = stops_in_corridor >> select(_.calitp_itp_id, _.stop_id, _.geometry)" + ] + }, + { + "cell_type": "code", + "execution_count": 207, + "id": "62591143-ce91-408a-86a7-67d993a64205", + "metadata": {}, + "outputs": [], + "source": [ + "stops_extract['hqta_type'] = 'hq_corridor_bus'" + ] + }, + { + "cell_type": "code", + "execution_count": 208, + "id": "283ddc23-5a5f-4606-ab30-72341ee890cb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idgeometryhqta_type
26531293262POINT (27236.798 -399421.201)hq_corridor_bus
66308169S80POINT (27244.495 -399414.075)hq_corridor_bus
26776293113POINT (30264.810 -399410.543)hq_corridor_bus
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id geometry hqta_type\n", + "26531 293 262 POINT (27236.798 -399421.201) hq_corridor_bus\n", + "66308 169 S80 POINT (27244.495 -399414.075) hq_corridor_bus\n", + "26776 293 113 POINT (30264.810 -399410.543) hq_corridor_bus" + ] + }, + "execution_count": 208, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "stops_extract.head(3)" + ] + }, + { + "cell_type": "markdown", + "id": "3d90eef5-3b4d-4c6a-96c9-e40a2855a260", + "metadata": {}, + "source": [ + "#### Major Transit Stops (rail/ferry/brt)" + ] + }, + { + "cell_type": "code", + "execution_count": 209, + "id": "5138b1e6-4c99-4ff1-b672-89d5f5a484e2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometryhqta_type
106618218010133.768071-118.1929210POINT (167426.752 -470294.073)major_transit_stop
107818218015333.768740-118.1893620POINT (167755.039 -470213.608)major_transit_stop
107618218010233.772258-118.1937000POINT (167345.741 -469831.223)major_transit_stop
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "1066 182 1 80101 33.768071 -118.192921 \n", + "1078 182 1 80153 33.768740 -118.189362 \n", + "1076 182 1 80102 33.772258 -118.193700 \n", + "\n", + " route_type geometry hqta_type \n", + "1066 0 POINT (167426.752 -470294.073) major_transit_stop \n", + "1078 0 POINT (167755.039 -470213.608) major_transit_stop \n", + "1076 0 POINT (167345.741 -469831.223) major_transit_stop " + ] + }, + "execution_count": 209, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 210, + "id": "8a269cf5-fb38-467f-b31d-8c98c2aed684", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_extract = rail_ferry_brt_stops >> select(_.calitp_itp_id == _.calitp_itp_id, _.stop_id,\n", + " _.hqta_type, _.route_type, _.geometry\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": 211, + "id": "154b935a-5c1b-48d9-a44b-d276ade8b4ae", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_extract = (rail_ferry_brt_extract\n", + " >> mutate(\n", + " hqta_type = case_when({\n", + " _.route_type.isin(['0', '1', '2']): 'major_stop_rail',\n", + " _.route_type == '3': 'major_stop_brt',\n", + " _.route_type == '4': 'major_stop_ferry'\n", + " })\n", + " )\n", + " >> select(-_.route_type)\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 212, + "id": "795f12d4-f881-4d72-adf2-69a4276084e9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idhqta_typegeometry
106618280101major_stop_railPOINT (167426.752 -470294.073)
107818280153major_stop_railPOINT (167755.039 -470213.608)
107618280102major_stop_railPOINT (167345.741 -469831.223)
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id hqta_type geometry\n", + "1066 182 80101 major_stop_rail POINT (167426.752 -470294.073)\n", + "1078 182 80153 major_stop_rail POINT (167755.039 -470213.608)\n", + "1076 182 80102 major_stop_rail POINT (167345.741 -469831.223)" + ] + }, + "execution_count": 212, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_extract.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 213, + "id": "45f7684d-af37-4e66-bfec-e5e5d4b1d2c4", + "metadata": {}, + "outputs": [], + "source": [ + "points_combined = new_major_bus_extract.append(stops_extract).append(rail_ferry_brt_extract)" + ] + }, + { + "cell_type": "code", + "execution_count": 214, + "id": "f74db8b5-c1c2-4f68-88d8-89964d2a7179", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "calitp_itp_id int64\n", + "stop_id object\n", + "calitp_itp_id_2 object\n", + "hqta_type object\n", + "geometry geometry\n", + "dtype: object" + ] + }, + "execution_count": 214, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "points_combined.dtypes" + ] + }, + { + "cell_type": "code", + "execution_count": 215, + "id": "c767a0e4-e8c5-4967-b223-c982717de70c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idcalitp_itp_id_2hqta_typegeometry
1420504major_stop_busPOINT (-197487.747 -22870.228)
661461604major_stop_busPOINT (-197487.086 -22901.713)
868460444major_stop_busPOINT (-197515.484 -22863.900)
4378461614major_stop_busPOINT (-197544.479 -22958.955)
6453074major_stop_busPOINT (-189006.213 -28181.062)
..................
42328295NaNmajor_stop_brtPOINT (246407.338 -422724.364)
172328288NaNmajor_stop_brtPOINT (243453.358 -421760.464)
996323165NaNmajor_stop_railPOINT (172732.681 -389214.320)
34213VRVNaNmajor_stop_railPOINT (248354.060 -383016.649)
994323163NaNmajor_stop_railPOINT (172437.092 -378906.434)
\n", + "

37473 rows × 5 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id calitp_itp_id_2 hqta_type \\\n", + "1 4 2050 4 major_stop_bus \n", + "661 4 6160 4 major_stop_bus \n", + "868 4 6044 4 major_stop_bus \n", + "4378 4 6161 4 major_stop_bus \n", + "6 4 5307 4 major_stop_bus \n", + "... ... ... ... ... \n", + "4 232 8295 NaN major_stop_brt \n", + "17 232 8288 NaN major_stop_brt \n", + "996 323 165 NaN major_stop_rail \n", + "342 13 VRV NaN major_stop_rail \n", + "994 323 163 NaN major_stop_rail \n", + "\n", + " geometry \n", + "1 POINT (-197487.747 -22870.228) \n", + "661 POINT (-197487.086 -22901.713) \n", + "868 POINT (-197515.484 -22863.900) \n", + "4378 POINT (-197544.479 -22958.955) \n", + "6 POINT (-189006.213 -28181.062) \n", + "... ... \n", + "4 POINT (246407.338 -422724.364) \n", + "17 POINT (243453.358 -421760.464) \n", + "996 POINT (172732.681 -389214.320) \n", + "342 POINT (248354.060 -383016.649) \n", + "994 POINT (172437.092 -378906.434) \n", + "\n", + "[37473 rows x 5 columns]" + ] + }, + "execution_count": 215, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "points_combined" + ] + }, + { + "cell_type": "code", + "execution_count": 161, + "id": "1eaa13fb-88d9-4f5f-ac07-5a5711f974db", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(points_combined)" + ] + }, + { + "cell_type": "code", + "execution_count": 224, + "id": "f7d2d824-f02a-450c-a18f-baa4f4b4c8b3", + "metadata": {}, + "outputs": [], + "source": [ + "names = tbl.views.gtfs_agency_names() >> select(_.calitp_itp_id, _.agency_name) >> collect()\n", + "with_names = points_combined >> inner_join(_, names, on = 'calitp_itp_id')" + ] + }, + { + "cell_type": "code", + "execution_count": 231, + "id": "f5597551-8553-446b-9f1d-4c9996be932c", + "metadata": {}, + "outputs": [], + "source": [ + "with_names = with_names.drop_duplicates(subset=['calitp_itp_id', 'hqta_type', 'stop_id'])\n", + "with_names = with_names.drop(columns=['calitp_itp_id_2'])" + ] + }, + { + "cell_type": "code", + "execution_count": 233, + "id": "8babf759-70b5-43ca-913b-f3a4f594c30f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idhqta_typegeometryagency_name
042050major_stop_busPOINT (-197487.747 -22870.228)AC Transit
146160major_stop_busPOINT (-197487.086 -22901.713)AC Transit
246044major_stop_busPOINT (-197515.484 -22863.900)AC Transit
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id hqta_type geometry \\\n", + "0 4 2050 major_stop_bus POINT (-197487.747 -22870.228) \n", + "1 4 6160 major_stop_bus POINT (-197487.086 -22901.713) \n", + "2 4 6044 major_stop_bus POINT (-197515.484 -22863.900) \n", + "\n", + " agency_name \n", + "0 AC Transit \n", + "1 AC Transit \n", + "2 AC Transit " + ] + }, + "execution_count": 233, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "with_names.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 234, + "id": "136b178e-edc6-4492-a8d9-1a97080f48f2", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], + "source": [ + "geoparquet_gcs_export(with_names, 'ca_high_quality_transit_points')" + ] + }, + { + "cell_type": "code", + "execution_count": 235, + "id": "b7cc3286-aa84-4b66-acba-4935481e1650", + "metadata": {}, + "outputs": [], + "source": [ + "with_names.to_file('./ca_high_quality_transit_point.geojson', driver='GeoJSON')" + ] + }, + { + "cell_type": "code", + "execution_count": 236, + "id": "abd4b07a-6804-4f80-9377-ca34208b5e78", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/tmp/ipykernel_44/2615873071.py:1: UserWarning: Column names longer than 10 characters will be truncated when saved to ESRI Shapefile.\n", + " with_names.to_file('./ca_high_quality_transit/ca_high_quality_transit_point.shp')\n" + ] + } + ], + "source": [ + "with_names.to_file('./ca_high_quality_transit/ca_high_quality_transit_point.shp')" + ] + }, + { + "cell_type": "code", + "execution_count": 237, + "id": "62bf6074-7796-4fee-9ea7-9a4d67f438a1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['major_stop_bus', 'hq_corridor_bus', 'major_stop_brt',\n", + " 'major_stop_rail', 'major_stop_ferry'], dtype=object)" + ] + }, + "execution_count": 237, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "with_names['hqta_type'].unique()" ] }, { From 6eaf1ac9d2791a307ee76eea18922b7d9f1dc023 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Tue, 7 Dec 2021 01:07:05 +0000 Subject: [PATCH 14/24] start hqta revisions, siuba query error --- .../bus_corridors.ipynb | 299 +++++++-- .../combine_and_visualize.ipynb | 380 +++++------ .../point_exports_opr.ipynb | 606 ++++++++++++++++++ .../rail_ferry_brt.ipynb | 67 +- 4 files changed, 1101 insertions(+), 251 deletions(-) create mode 100644 high_quality_transit_areas/point_exports_opr.ipynb diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index c060d0d90..87bf082cb 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -17,72 +17,79 @@ "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.11.1)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.14.0)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.2.1)\n", + "Collecting pygeos\n", + " Using cached pygeos-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB)\n", + "Collecting ipyleaflet\n", + " Using cached ipyleaflet-0.15.0-py2.py3-none-any.whl (3.3 MB)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", + "Collecting xyzservices>=2021.8.1\n", + " Using cached xyzservices-2021.11.0-py3-none-any.whl (34 kB)\n", + "Collecting traittypes<3,>=0.2.1\n", + " Using cached traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB)\n", "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", + "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", + "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (58.3.0)\n", + "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", + "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.2)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.4.1)\n", "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", + "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.21)\n", - "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.2)\n", + "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.17.3)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", - "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", + "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", - "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.2.0)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.2)\n", + "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", + "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", + "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.14.6)\n", + "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.4)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.20)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", + "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", + "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", + "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" + "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n", + "Installing collected packages: xyzservices, traittypes, pygeos, ipyleaflet\n", + "Successfully installed ipyleaflet-0.15.0 pygeos-0.12.0 traittypes-0.2.1 xyzservices-2021.11.0\n" ] } ], @@ -92,10 +99,19 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -152,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -164,7 +180,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -176,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], @@ -201,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "e3d9fa0d-35b0-4a9c-8e45-c5114e5c09a1", "metadata": {}, "outputs": [], @@ -231,7 +247,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 12, "id": "65c74fbd-059f-4df8-a3a1-e6c1361489b7", "metadata": {}, "outputs": [], @@ -249,12 +265,13 @@ " >> filter(_.calitp_itp_id == int(itp_id)) >> collect())\n", " wednesday = wednesday >> arrange(-_.service_date)\n", " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.weekday() == 2)]\n", - " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.month < 12)]\n", - " wednesday = wednesday[wednesday['service_date'] == wednesday['service_date'].iloc[0]] ## pick most recent Wednesday from Nov or earlier\n", + " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.month == 12)] ## December\n", + " wednesday = wednesday[wednesday['service_date'] == wednesday['service_date'].iloc[0]] ## pick most recent Wednesday from Dec or earlier\n", " \n", " bus_routes = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " >> filter(_.route_type.isin(['3', '11'])) ## bus and trolleybus\n", + " # >> filter(_.route_type.isin(['3', '11'])) ## bus and trolleybus\n", + " >> filter(_.route_type == '3')\n", " >> select(_.route_id) >> collect())\n", " print('loaded bus routes')\n", " \n", @@ -292,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "id": "1049eee5-d4d9-43a1-9a84-c3bd3687f6d3", "metadata": {}, "outputs": [], @@ -313,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "id": "0d3207be-d38f-4f17-a97f-0f84cae25d77", "metadata": {}, "outputs": [], @@ -446,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "id": "9483141f-c197-4fc8-80f0-4efa8d2b44c4", "metadata": {}, "outputs": [], @@ -496,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 25, "id": "e9d94df4-21cd-46d6-a8ab-fe4d4c01d728", "metadata": {}, "outputs": [], @@ -506,24 +523,143 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 13, "id": "b1089592-7a20-4c3b-a27f-5eb6193213de", - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "loaded shapes\n", - "loaded bus routes\n", - "loaded trips\n", - "loaded stop times\n", - "loaded stops\n" + "loaded bus routes\n" + ] + }, + { + "ename": "AssertionError", + "evalue": "Unexpected param: (__[POSTCOMPILE_service_id_1])", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/tmp/ipykernel_44/1117417450.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlbt_views\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_operator_views\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m170\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", + "\u001b[0;32m/tmp/ipykernel_44/4270395868.py\u001b[0m in \u001b[0;36mget_operator_views\u001b[0;34m(itp_id)\u001b[0m\n\u001b[1;32m 29\u001b[0m >> collect())\n\u001b[1;32m 30\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 31\u001b[0;31m trips = (tbl.gtfs_schedule.trips()\n\u001b[0m\u001b[1;32m 32\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitp_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 33\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwednesday\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3505\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[0;32m-> 3507\u001b[0;31m [\n\u001b[0m\u001b[1;32m 3508\u001b[0m f._compiler_dispatch(\n\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[1;32m 3507\u001b[0m [\n\u001b[0;32m-> 3508\u001b[0;31m f._compiler_dispatch(\n\u001b[0m\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3510\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_subquery\u001b[0;34m(self, subquery, **kw)\u001b[0m\n\u001b[1;32m 2875\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_subquery\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2876\u001b[0m \u001b[0mkw\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"subquery\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvisit_alias\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2879\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_lateral\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_alias\u001b[0;34m(self, alias, asfrom, ashint, iscrud, fromhints, subquery, lateral, enclosing_alias, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 2834\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfroms\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0malias\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0malias_name\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2835\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2836\u001b[0;31m inner = alias.element._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2837\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlateral\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2838\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_service_id_1])" ] } ], "source": [ - "bbb_views = get_operator_views(300)" + "lbt_views = get_operator_views(170)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "908af6e2-bef2-4458-8125-67cd28454493", + "metadata": {}, + "outputs": [], + "source": [ + "bus_routes" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "a04ec0e7-df45-4d2f-b477-1f0cb2c6c6ca", + "metadata": {}, + "outputs": [], + "source": [ + "bus_routes = (tbl.gtfs_schedule.routes()\n", + " >> filter(_.calitp_itp_id == 170)\n", + " >> filter(_.route_type == '3', _.route_type == '11') ## bus and trolleybus\n", + " >> select(_.route_id) >> collect())" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "e7912a98-883b-4c6b-aedf-95533d9497c5", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
route_id
\n", + "
" + ], + "text/plain": [ + "Empty DataFrame\n", + "Columns: [route_id]\n", + "Index: []" + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bus_routes" ] }, { @@ -564,7 +700,7 @@ } ], "source": [ - "bbb_hqta = single_operator_hqta(300)" + "lbt_hqta = single_operator_hqta(300)" ] }, { @@ -628,7 +764,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 3, "id": "7968cab1-fb27-43b7-ad4c-4b84e03cee81", "metadata": {}, "outputs": [], @@ -1452,7 +1588,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 4, "id": "dd0aada1-9341-4837-978b-0e4c01bec26a", "metadata": {}, "outputs": [], @@ -1462,7 +1598,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 5, "id": "007242a3-d4d2-4acd-8bff-169fc513ad2b", "metadata": {}, "outputs": [], @@ -1472,7 +1608,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 6, "id": "e85121b8-8052-4bd2-9270-fc7462700a58", "metadata": {}, "outputs": [], @@ -1482,7 +1618,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "id": "baaa3b22-d2dd-4afb-a081-e666a0037e8e", "metadata": {}, "outputs": [], @@ -1492,7 +1628,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 8, "id": "090dd0b2-4de3-47b0-abed-9d16356bbf2c", "metadata": {}, "outputs": [], @@ -1500,6 +1636,41 @@ "dissolved = dissolved[dissolved['geometry'].area > 50*3000] ##50m width * 3000m shape min" ] }, + { + "cell_type": "code", + "execution_count": 37, + "id": "ca18f616-9719-458d-beb6-e3aa7492fd32", + "metadata": {}, + "outputs": [], + "source": [ + "dissolved = gpd.read_parquet(f'{GCS_FILE_PATH}shape_hqta_dissolve.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "id": "b340161b-cd68-4cef-90ba-7f9f83fe30b0", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "4affcd4b579e4b049b95f07f8e24a36f", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[33.596015707487744, -117.87571863402819], controls=(ZoomControl(options=['position', 'zoom_in_text…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "map_hqta(dissolved)" + ] + }, { "cell_type": "code", "execution_count": 14, diff --git a/high_quality_transit_areas/combine_and_visualize.ipynb b/high_quality_transit_areas/combine_and_visualize.ipynb index a8ac4cfd1..19ba79e8b 100644 --- a/high_quality_transit_areas/combine_and_visualize.ipynb +++ b/high_quality_transit_areas/combine_and_visualize.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 6, + "execution_count": 1, "id": "7f9e615b-d071-4728-b774-1d02f509c332", "metadata": { "collapsed": true, @@ -17,71 +17,72 @@ "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.11.1)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.14.0)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.2.1)\n", + "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", + "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", + "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", - "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (58.3.0)\n", + "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", + "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", + "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", + "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", + "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.2)\n", - "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", + "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.4.1)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.21)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", + "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.2)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.17.3)\n", - "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", - "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", + "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", + "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.2)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.2.0)\n", + "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", + "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.14.6)\n", + "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.4)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", + "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", + "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.20)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", + "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" ] } @@ -100,7 +101,7 @@ "name": "stderr", "output_type": "stream", "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.0-CAPI-1.16.0). Conversions between both will be slow.\n", + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", " warnings.warn(\n" ] } @@ -124,7 +125,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 3, "id": "e31ad027-1acc-44f8-bdd6-31f1b9b36a77", "metadata": {}, "outputs": [], @@ -136,7 +137,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 4, "id": "bcbea24e-ab7e-400a-8813-6a477471c1d6", "metadata": {}, "outputs": [], @@ -147,62 +148,53 @@ }, { "cell_type": "code", - "execution_count": 5, - "id": "0e807584-dfb2-4385-b274-7276b0bc38d0", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, - "tags": [] - }, + "execution_count": 7, + "id": "6aec4721-0827-40f3-be60-0790916b0385", + "metadata": {}, "outputs": [ { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] + "data": { + "text/plain": [ + "Index(['stop_id', 'calitp_itp_id', 'stop_lat', 'stop_lon', 'itp_id_stop_id',\n", + " 'itp_id_trip_id', 'route_id', 'itp_id_route_id', 'trip_id', 'geometry',\n", + " 'calitp_url_number', 'route_type', 'agency_id', 'route_short_name',\n", + " 'route_long_name', 'route_desc', 'route_url', 'route_color',\n", + " 'route_text_color', 'route_sort_order', 'continuous_pickup',\n", + " 'continuous_drop_off', 'calitp_extracted_at', 'hqta_type'],\n", + " dtype='object')" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "geoparquet_gcs_export(bus_hqtc, 'bus_hqtc')" + "rail_ferry_brt_stops.columns" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 10, + "id": "0e807584-dfb2-4385-b274-7276b0bc38d0", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# geoparquet_gcs_export(bus_hqtc, 'bus_hqtc')" + ] + }, + { + "cell_type": "code", + "execution_count": 11, "id": "3b9a9f5e-6371-4367-978c-c0be0e6d979f", "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, "tags": [] }, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], + "outputs": [], "source": [ - "geoparquet_gcs_export(rail_ferry_brt_stops, 'rail_ferry_brt_stops')" + "# geoparquet_gcs_export(rail_ferry_brt_stops, 'rail_ferry_brt_stops')" ] }, { @@ -245,7 +237,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "441de95c-34c4-46bd-a95c-bfa0fd0338ea", "metadata": {}, "outputs": [ @@ -273,61 +265,53 @@ " hq_transit_corr\n", " shape_id\n", " geometry\n", - " level_0\n", " calitp_itp_id\n", " hqta_segment_id\n", - " n_trips\n", " segment_sequence\n", " stop_id\n", - " am_peak\n", - " pm_peak\n", + " am_max_trips\n", + " pm_max_trips\n", " hqta_type\n", " \n", " \n", " \n", " \n", - " 2464\n", + " 2256\n", " True\n", - " 0500\n", - " MULTIPOLYGON (((193308.696 -465893.120, 193308...\n", - " 0\n", - " 142\n", - " 2197551287\n", - " 134.0\n", + " 01582b61-5a02-4e6c-bd37-bad46bb036a9\n", + " POLYGON ((-133311.510 166655.910, -133353.419 ...\n", + " 48\n", + " 1937384376\n", " 0\n", - " 3977\n", - " 9.0\n", + " 12f4ecb6-c161-480e-8ec2-d7e3b63c7e38\n", + " 7.0\n", " 8.0\n", " hq_transit_corr\n", " \n", " \n", - " 2466\n", + " 2257\n", " True\n", - " 10\n", - " MULTIPOLYGON (((170627.569 -429628.875, 170627...\n", + " 0500\n", + " POLYGON ((212373.929 -486798.063, 212402.264 -...\n", + " 142\n", + " 4126984225\n", " 1\n", - " 243\n", - " 2088216280\n", - " 64.0\n", - " 2\n", - " 604\n", - " 4.7\n", + " 4654\n", " 5.0\n", + " 7.0\n", " hq_transit_corr\n", " \n", " \n", - " 2467\n", + " 2258\n", " True\n", - " 100706_SEPT21\n", - " MULTIPOLYGON (((149722.349 -435846.031, 149624...\n", + " 0843\n", + " MULTIPOLYGON (((200815.723 -472198.343, 200811...\n", + " 142\n", + " 1555422069\n", " 0\n", - " 182\n", - " 2368710740\n", - " 120.0\n", - " 1\n", - " 16374\n", + " 6679\n", + " 5.0\n", " 6.0\n", - " 8.0\n", " hq_transit_corr\n", " \n", " \n", @@ -335,28 +319,28 @@ "" ], "text/plain": [ - " hq_transit_corr shape_id \\\n", - "2464 True 0500 \n", - "2466 True 10 \n", - "2467 True 100706_SEPT21 \n", + " hq_transit_corr shape_id \\\n", + "2256 True 01582b61-5a02-4e6c-bd37-bad46bb036a9 \n", + "2257 True 0500 \n", + "2258 True 0843 \n", "\n", - " geometry level_0 \\\n", - "2464 MULTIPOLYGON (((193308.696 -465893.120, 193308... 0 \n", - "2466 MULTIPOLYGON (((170627.569 -429628.875, 170627... 1 \n", - "2467 MULTIPOLYGON (((149722.349 -435846.031, 149624... 0 \n", + " geometry calitp_itp_id \\\n", + "2256 POLYGON ((-133311.510 166655.910, -133353.419 ... 48 \n", + "2257 POLYGON ((212373.929 -486798.063, 212402.264 -... 142 \n", + "2258 MULTIPOLYGON (((200815.723 -472198.343, 200811... 142 \n", "\n", - " calitp_itp_id hqta_segment_id n_trips segment_sequence stop_id \\\n", - "2464 142 2197551287 134.0 0 3977 \n", - "2466 243 2088216280 64.0 2 604 \n", - "2467 182 2368710740 120.0 1 16374 \n", + " hqta_segment_id segment_sequence stop_id \\\n", + "2256 1937384376 0 12f4ecb6-c161-480e-8ec2-d7e3b63c7e38 \n", + "2257 4126984225 1 4654 \n", + "2258 1555422069 0 6679 \n", "\n", - " am_peak pm_peak hqta_type \n", - "2464 9.0 8.0 hq_transit_corr \n", - "2466 4.7 5.0 hq_transit_corr \n", - "2467 6.0 8.0 hq_transit_corr " + " am_max_trips pm_max_trips hqta_type \n", + "2256 7.0 8.0 hq_transit_corr \n", + "2257 5.0 7.0 hq_transit_corr \n", + "2258 5.0 6.0 hq_transit_corr " ] }, - "execution_count": 9, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -367,7 +351,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "f104e680-a949-4e07-a4dd-19950207c66f", "metadata": {}, "outputs": [], @@ -389,7 +373,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "96caf70f-e497-4df4-9b1a-20b54f7b7f83", "metadata": {}, "outputs": [], @@ -399,7 +383,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 11, "id": "cdb9023e-8397-4eed-b829-0ab22ee26580", "metadata": {}, "outputs": [], @@ -409,7 +393,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 12, "id": "a54925c8-cb64-452f-b8ac-18407ed3f9d6", "metadata": {}, "outputs": [], @@ -419,7 +403,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 10, "id": "c3f748fa-861d-4d7c-b005-480d6ecc30a2", "metadata": {}, "outputs": [], @@ -429,7 +413,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 11, "id": "ca09eb4e-97b4-48b6-ba21-542ac35c8ceb", "metadata": {}, "outputs": [], @@ -448,7 +432,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 12, "id": "82e5d819-63dc-4ba3-a9f9-c314f5a4ca33", "metadata": {}, "outputs": [], @@ -458,7 +442,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": 28, "id": "6273ed98-b5a2-4e83-bfac-9f487f8c6142", "metadata": {}, "outputs": [], @@ -479,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 29, "id": "c35ed21e-d6e0-42cf-8bd5-e4792d5d3c14", "metadata": {}, "outputs": [], @@ -489,7 +473,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 30, "id": "2df43e17-9ca0-4c46-b6a1-92d77ec98d3a", "metadata": { "tags": [] @@ -744,7 +728,7 @@ "[349 rows x 12 columns]" ] }, - "execution_count": 41, + "execution_count": 30, "metadata": {}, "output_type": "execute_result" } @@ -755,7 +739,7 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": 31, "id": "6ab04e63-f673-48d4-bf1a-d01d203f5b33", "metadata": {}, "outputs": [], @@ -765,17 +749,17 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 32, "id": "92d2df98-49d9-4786-bd53-df2ddc107354", "metadata": {}, "outputs": [], "source": [ - "row_per_stop = row_per_stop[['calitp_itp_id', 'geometry']]" + "row_per_stop = row_per_stop[['calitp_itp_id', 'stop_id', 'geometry']]" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 33, "id": "faaa147d-ae1e-4b9b-a7a2-ff462a3c66fd", "metadata": {}, "outputs": [], @@ -785,7 +769,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 34, "id": "3e574e12-8017-4867-9230-8fa891e914bb", "metadata": {}, "outputs": [], @@ -795,7 +779,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": 35, "id": "d01200cc-cda2-4635-af68-3b8448e70b5a", "metadata": {}, "outputs": [ @@ -821,6 +805,7 @@ " \n", " \n", " calitp_itp_id\n", + " stop_id\n", " geometry\n", " hqta_type\n", " \n", @@ -829,18 +814,21 @@ " \n", " 0\n", " 142\n", + " 3977\n", " POINT (199058.382 -471125.032)\n", " major_transit_stop\n", " \n", " \n", " 1\n", " 142\n", + " 3977\n", " POINT (198531.592 -471368.189)\n", " major_transit_stop\n", " \n", " \n", " 2\n", " 142\n", + " 3977\n", " POINT (193068.693 -465847.391)\n", " major_transit_stop\n", " \n", @@ -849,13 +837,13 @@ "" ], "text/plain": [ - " calitp_itp_id geometry hqta_type\n", - "0 142 POINT (199058.382 -471125.032) major_transit_stop\n", - "1 142 POINT (198531.592 -471368.189) major_transit_stop\n", - "2 142 POINT (193068.693 -465847.391) major_transit_stop" + " calitp_itp_id stop_id geometry hqta_type\n", + "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop\n", + "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop\n", + "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop" ] }, - "execution_count": 46, + "execution_count": 35, "metadata": {}, "output_type": "execute_result" } @@ -866,7 +854,31 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": 36, + "id": "5bbfaa07-f16c-46a9-ae5e-338a5b7f5d8b", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], + "source": [ + "geoparquet_gcs_export(row_per_stop, 'major_bus_stops')" + ] + }, + { + "cell_type": "code", + "execution_count": 24, "id": "dcccae17-5f35-4fc4-a5dc-0e5cf45e2f25", "metadata": {}, "outputs": [], @@ -876,7 +888,7 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": 25, "id": "19f9b7dd-1b2b-4c7a-9ba9-3e1e1e9b46be", "metadata": { "tags": [] @@ -895,7 +907,7 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": 26, "id": "7d959fef-e315-4985-b3fd-72192096a691", "metadata": {}, "outputs": [], @@ -908,7 +920,7 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": 27, "id": "909f1b0f-0d99-4713-90e5-cf86e7bcab1e", "metadata": {}, "outputs": [], @@ -942,7 +954,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": 28, "id": "e13cb57b-0905-4b8c-9f8f-d6d87c09c533", "metadata": {}, "outputs": [], @@ -954,7 +966,7 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": 29, "id": "da513fe3-7893-48a1-b33b-de36e5c97443", "metadata": {}, "outputs": [], @@ -968,7 +980,7 @@ }, { "cell_type": "code", - "execution_count": 53, + "execution_count": 30, "id": "96ea1b81-97d2-4d9f-986b-cb82fcb1d481", "metadata": {}, "outputs": [], @@ -988,7 +1000,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": 31, "id": "e25ad411-6ea1-4232-bb47-6df3bb1f4167", "metadata": {}, "outputs": [], @@ -1001,7 +1013,7 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": 32, "id": "fe2aeb20-1714-4543-ba8b-8d655ea1efa4", "metadata": {}, "outputs": [], @@ -1011,19 +1023,41 @@ }, { "cell_type": "code", - "execution_count": 190, + "execution_count": 6, + "id": "92d5b4c7-6723-471f-bafa-dada933393f7", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "all_hqta = gpd.read_parquet(f'{GCS_FILE_PATH}ca_high_quality_transit.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "be750b0a-11e8-4905-bc62-6d2b7462a11a", + "metadata": {}, + "outputs": [], + "source": [ + "metro = bus_hqtc >> filter(_.calitp_itp_id == '182')" + ] + }, + { + "cell_type": "code", + "execution_count": 18, "id": "a3adc41e-90f1-4117-8e49-938c4c838a8d", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "4c92e1550b174cb0abb9a992ac7f0e41", + "model_id": "4399525e0c1b47be87a271b99c3093b7", "version_major": 2, "version_minor": 0 }, "text/plain": [ - "Map(center=[33.741232185414454, -117.84488376191148], controls=(ZoomControl(options=['position', 'zoom_in_text…" + "Map(center=[34.078792878404975, -118.30956119336547], controls=(ZoomControl(options=['position', 'zoom_in_text…" ] }, "metadata": {}, @@ -1031,31 +1065,15 @@ } ], "source": [ - "map_hqta(all_hqta, 'hqta_type')" + "map_hqta(metro, 'pm_max_trips')" ] }, { "cell_type": "code", - "execution_count": 191, + "execution_count": null, "id": "f614dc84-c6c1-482e-a6eb-d621ccb3af67", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/tmp/ipykernel_46/4200137629.py:1: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " all_hqta.to_parquet('./data/combined/ca_high_quality_transit.parquet')\n", - "/tmp/ipykernel_46/4200137629.py:3: UserWarning: Column names longer than 10 characters will be truncated when saved to ESRI Shapefile.\n", - " all_hqta.to_file('./data/combined/ca_high_quality_transit/ca_high_quality_transit.shp')\n" - ] - } - ], + "outputs": [], "source": [ "geoparquet_gcs_export(all_hqta, 'ca_high_quality_transit')\n", "# all_hqta.to_file('./ca_high_quality_transit.geojson', driver='GeoJSON')\n", diff --git a/high_quality_transit_areas/point_exports_opr.ipynb b/high_quality_transit_areas/point_exports_opr.ipynb new file mode 100644 index 000000000..6a08e38d9 --- /dev/null +++ b/high_quality_transit_areas/point_exports_opr.ipynb @@ -0,0 +1,606 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "4a93602d-4289-4d8f-b037-28f244972772", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], + "source": [ + "import calitp\n", + "from calitp.tables import tbl\n", + "from siuba import *\n", + "\n", + "import pandas as pd\n", + "import numpy as np\n", + "import geopandas as gpd\n", + "import fiona\n", + "import shapely\n", + "\n", + "from ipyleaflet import Map, GeoJSON, projections, basemaps, GeoData, LayersControl, WidgetControl, GeoJSON\n", + "from ipywidgets import Text, HTML\n", + "\n", + "from utilities import *" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "id": "e497dcce-0705-4b97-9968-47119cdf386e", + "metadata": {}, + "outputs": [], + "source": [ + "major_bus = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops.parquet')\n", + "major_bus['mode'] = 'bus'" + ] + }, + { + "cell_type": "code", + "execution_count": 42, + "id": "12d40de1-7beb-4126-b9ee-14ba288d347f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idgeometryhqta_typemode
01423977POINT (199058.382 -471125.032)major_transit_stopbus
11423977POINT (198531.592 -471368.189)major_transit_stopbus
21423977POINT (193068.693 -465847.391)major_transit_stopbus
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id geometry hqta_type \\\n", + "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop \n", + "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop \n", + "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop \n", + "\n", + " mode \n", + "0 bus \n", + "1 bus \n", + "2 bus " + ] + }, + "execution_count": 42, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "major_bus.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "d3bda835-a20f-4ad7-9279-0b9f10f36a93", + "metadata": {}, + "outputs": [], + "source": [ + "## rail/ferry/brt explicitly by mode" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "id": "774a2131-9fdc-4386-a003-6310d9ef8c9b", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_stops = gpd.read_parquet(f'{GCS_FILE_PATH}rail_brt_ferry.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "29a747be-1fe6-4d83-b65d-da06a1378cf0", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Index(['stop_id', 'calitp_itp_id', 'stop_lat', 'stop_lon', 'itp_id_stop_id',\n", + " 'itp_id_trip_id', 'route_id', 'itp_id_route_id', 'trip_id', 'geometry',\n", + " 'calitp_url_number', 'route_type', 'agency_id', 'route_short_name',\n", + " 'route_long_name', 'route_desc', 'route_url', 'route_color',\n", + " 'route_text_color', 'route_sort_order', 'continuous_pickup',\n", + " 'continuous_drop_off', 'calitp_extracted_at'],\n", + " dtype='object')" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops.columns" + ] + }, + { + "cell_type": "code", + "execution_count": 46, + "id": "956999cb-3445-48d1-9aa3-5c0e3ae32dbc", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_stops['route_type'] = rail_ferry_brt_stops['route_type'].fillna('99')" + ] + }, + { + "cell_type": "code", + "execution_count": 47, + "id": "f43e3337-4026-406d-85cc-fcd11d8e1661", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idroute_typen
02414
14367
2109910
31399523
41545
54145
6569918
712744
8182355
91829995
10200419
1120099546
122269931
13232329
142469960
1527399104
1627843
1727899121
182799950
19280424
202819910
2128299265
2229499120
233159912
243239962
2533843
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id route_type n\n", + "0 2 4 14\n", + "1 4 3 67\n", + "2 10 99 10\n", + "3 13 99 523\n", + "4 15 4 5\n", + "5 41 4 5\n", + "6 56 99 18\n", + "7 127 4 4\n", + "8 182 3 55\n", + "9 182 99 95\n", + "10 200 4 19\n", + "11 200 99 546\n", + "12 226 99 31\n", + "13 232 3 29\n", + "14 246 99 60\n", + "15 273 99 104\n", + "16 278 4 3\n", + "17 278 99 121\n", + "18 279 99 50\n", + "19 280 4 24\n", + "20 281 99 10\n", + "21 282 99 265\n", + "22 294 99 120\n", + "23 315 99 12\n", + "24 323 99 62\n", + "25 338 4 3" + ] + }, + "execution_count": 47, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops >> count(_.calitp_itp_id, _.route_type)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "71a2646b-0a53-48e4-ac35-586b2dda3dd3", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idcalitp_itp_idroute_type
0CRN13None
1MKA13None
2OKJ13None
3PLO13None
4QCY13None
............
742483569414
77GF:430002004
78GF:430032004
79GF:430042004
80GF:430072004
\n", + "

2255 rows × 3 columns

\n", + "
" + ], + "text/plain": [ + " stop_id calitp_itp_id route_type\n", + "0 CRN 13 None\n", + "1 MKA 13 None\n", + "2 OKJ 13 None\n", + "3 PLO 13 None\n", + "4 QCY 13 None\n", + ".. ... ... ...\n", + "74 2483569 41 4\n", + "77 GF:43000 200 4\n", + "78 GF:43003 200 4\n", + "79 GF:43004 200 4\n", + "80 GF:43007 200 4\n", + "\n", + "[2255 rows x 3 columns]" + ] + }, + "execution_count": 44, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops[['stop_id', 'calitp_itp_id', 'route_type']]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "b2511687-caf3-4984-91a4-6c0cdeceedd0", + "metadata": {}, + "outputs": [], + "source": [ + "## other stops within hq bus corridor (mode=bus)" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "34662e06-2545-48bd-a75d-4f63e2639cb7", + "metadata": {}, + "outputs": [], + "source": [ + "bus_hqtc = gpd.read_parquet(f'{GCS_FILE_PATH}shape_hqta_dissolve.parquet')\n", + "bus_hqtc = bus_hqtc[bus_hqtc['hq_transit_corr']]\n", + "bus_hqtc['hqta_type'] = 'hq_transit_corr'" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "1b71b26f-71ef-449a-a520-7b2a1c8929e3", + "metadata": {}, + "outputs": [], + "source": [ + "all_stops = tbl.gtfs_schedule.stops() >> collect()\n", + "all_stops = gpd.GeoDataFrame(all_stops,\n", + " geometry = gpd.points_from_xy(all_stops.stop_lon, all_stops.stop_lat),\n", + " crs = 'EPSG:4326')" + ] + } + ], + "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.9.7" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 2ce4cf7e8..67dcf8776 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,10 +2,19 @@ "cells": [ { "cell_type": "code", - "execution_count": 26, + "execution_count": 1, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -54,14 +63,60 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", - "metadata": {}, - "outputs": [], + "metadata": { + "collapsed": true, + "jupyter": { + "outputs_hidden": true + }, + "tags": [] + }, + "outputs": [ + { + "ename": "AssertionError", + "evalue": "Unexpected param: (__[POSTCOMPILE_route_type_1])", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", + "\u001b[0;32m/tmp/ipykernel_281/2695592209.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m rail_routes = (tbl.gtfs_schedule.routes()\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'0'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m >> collect())\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", + "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_route_type_1])" + ] + } + ], "source": [ "rail_routes = (tbl.gtfs_schedule.routes()\n", " >> filter(_.route_type.isin(['0', '1', '2']))\n", - " >> select(_.calitp_itp_id, _.route_id)\n", + " >> select(_.calitp_itp_id, _.route_id, _.route_type)\n", " >> collect())" ] }, From 0da8087b8750b3c57d886bc426342540e2253277 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 8 Dec 2021 19:10:29 +0000 Subject: [PATCH 15/24] fix+refactor rail_ferry_brt --- .../rail_ferry_brt.ipynb | 836 ++++++++---------- 1 file changed, 382 insertions(+), 454 deletions(-) diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 67dcf8776..55fc7534c 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -3,6 +3,93 @@ { "cell_type": "code", "execution_count": 1, + "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", + "metadata": { + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", + "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", + "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", + "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", + "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", + "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", + "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", + "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", + "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", + "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", + "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", + "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", + "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", + "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", + "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", + "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", + "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", + "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", + "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", + "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", + "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", + "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", + "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", + "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", + "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", + "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", + "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", + "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", + "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", + "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", + "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", + "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", + "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", + "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", + "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", + "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", + "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", + "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", + "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", + "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", + "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", + "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", + "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", + "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", + "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", + "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" + ] + } + ], + "source": [ + "!pip install -r requirements.txt" + ] + }, + { + "cell_type": "code", + "execution_count": 2, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, "outputs": [ @@ -58,121 +145,137 @@ "id": "6ddca2c1-c222-4a1c-9eeb-5fcbfd4c903f", "metadata": {}, "source": [ - "### Rail Service" + "### Rail Service\n", + "\n", + "* temporary workaround with dim tables, should use tbl.gtfs schedule but LA Metro rail not in" ] }, { "cell_type": "code", - "execution_count": 2, - "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, - "tags": [] - }, - "outputs": [ - { - "ename": "AssertionError", - "evalue": "Unexpected param: (__[POSTCOMPILE_route_type_1])", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_281/2695592209.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m rail_routes = (tbl.gtfs_schedule.routes()\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'0'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'1'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'2'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_id\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mroute_type\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m >> collect())\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_route_type_1])" - ] - } - ], + "execution_count": 3, + "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", + "metadata": {}, + "outputs": [], "source": [ - "rail_routes = (tbl.gtfs_schedule.routes()\n", - " >> filter(_.route_type.isin(['0', '1', '2']))\n", - " >> select(_.calitp_itp_id, _.route_id, _.route_type)\n", - " >> collect())" + "rail_routes = (tbl.views.gtfs_schedule_dim_routes()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " >> filter(_.calitp_itp_id != 200) # avoid MTC feed in favor of individual operator feeds\n", + " >> filter((_.route_type == '0') |\n", + " (_.route_type == '1') |\n", + " (_.route_type == '2'))\n", + " # >> filter(_.calitp_itp_id == 182)\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type)\n", + " )" ] }, { "cell_type": "code", "execution_count": 4, - "id": "dbcf2c67-44e3-446a-94f3-9a1bb9b04fc6", + "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], "source": [ - "def routes_to_stops(df_routes):\n", - " df_routes['itp_id_route_id'] = df_routes.calitp_itp_id.astype(str) + df_routes.route_id\n", - " \n", - " df_trips = (tbl.gtfs_schedule.trips()\n", - " >> filter(_.calitp_itp_id.isin(df_routes.calitp_itp_id))\n", - " >> collect()\n", - " >> select(_.calitp_itp_id, _.route_id, _.trip_id)\n", - " >> filter(_.route_id.isin(df_routes.route_id)))\n", + "def routes_to_stops(routes_tbl):\n", " \n", - " df_trips['itp_id_route_id'] = df_trips.calitp_itp_id.astype(str) + df_trips.route_id\n", - " df_trips.drop(columns=['calitp_itp_id', 'route_id'], inplace=True)\n", - " \n", - " df_trips = df_routes >> inner_join(_, df_trips, on='itp_id_route_id')\n", - " df_trips['itp_id_trip_id'] = df_trips.calitp_itp_id.astype(str) + df_trips.trip_id\n", - " df_operators = [int(str(x)) for x in list(df_trips.calitp_itp_id.unique())]\n", - " \n", - " df_stop_times = (tbl.gtfs_schedule.stop_times()\n", - " >> filter(_.calitp_itp_id.isin(df_operators))\n", - " >> select(_.calitp_itp_id, _.stop_id, _.trip_id)\n", + " tbl_trips = (tbl.views.gtfs_schedule_dim_trips()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.trip_id)\n", + " # >> filter(_.calitp_itp_id == 182) ## LA Metro\n", + " # >> filter(_.route_id == '801') ## Metro A Line (Blue) LRT\n", + " >> inner_join(_, routes_tbl, on=['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type, _.trip_id)\n", + " # >> collect()\n", + " )\n", + "\n", + " tbl_st_times = (tbl.views.gtfs_schedule_dim_stop_times()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " # >> filter(_.calitp_itp_id.isin(df_operators))\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.trip_id)\n", + " >> inner_join(_, tbl_trips, on=['calitp_itp_id', 'calitp_url_number', 'trip_id'])\n", + " >> distinct(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.route_type)\n", + " )\n", + "\n", + " stops = (tbl.views.gtfs_schedule_dim_stops()\n", + " >> filter(_.calitp_extracted_at < '2021-11-01')\n", + " >> filter(_.calitp_deleted_at > '2021-11-01')\n", + " >> select(_.calitp_itp_id, _.calitp_url_number,\n", + " _.stop_id, _.stop_lat, _.stop_lon)\n", + " >> inner_join(_, tbl_st_times,\n", + " on = ['calitp_itp_id', 'calitp_url_number', 'stop_id'])\n", " >> collect()\n", - " )\n", - " df_stop_times['itp_id_trip_id'] = df_stop_times.calitp_itp_id.astype(str) + df_stop_times.trip_id\n", - " df_stop_times.drop(columns=['calitp_itp_id', 'trip_id'], inplace=True)\n", - " df_stop_times = df_stop_times >> inner_join(_, df_trips, on='itp_id_trip_id')\n", - " df_stop_times = df_stop_times.drop_duplicates(subset=['stop_id', 'calitp_itp_id'])\n", - " df_stop_times['itp_id_stop_id'] = df_stop_times.calitp_itp_id.astype(str) + df_stop_times.stop_id\n", - " \n", - " df_stops = (tbl.gtfs_schedule.stops()\n", - " >> select(_.stop_id, _.calitp_itp_id, _.stop_lat, _.stop_lon)\n", - " >> filter(_.calitp_itp_id.isin(df_stop_times.calitp_itp_id))\n", - " >> collect()\n", - " )\n", - " \n", - " df_stops['itp_id_stop_id'] = df_stops.calitp_itp_id.astype(str) + df_stops.stop_id\n", - " df_stop_times.drop(columns=['calitp_itp_id', 'stop_id'], inplace=True)\n", - " df_stops = df_stops >> inner_join(_, df_stop_times, on='itp_id_stop_id')\n", - " df_stops = gpd.GeoDataFrame(df_stops,\n", - " geometry = gpd.points_from_xy(df_stops.stop_lon, df_stops.stop_lat),\n", - " crs = 'EPSG:4326')\n", - " return df_stops.to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)" + " )\n", + " stops = gpd.GeoDataFrame(stops,\n", + " geometry = gpd.points_from_xy(stops.stop_lon, stops.stop_lat),\n", + " crs = 'EPSG:4326').to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)\n", + " return stops" ] }, { "cell_type": "code", "execution_count": 5, - "id": "32b0a3a0-cb47-4b38-a5ef-ec4da9b94d3d", + "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "# rail_routes = (tbl.gtfs_schedule.routes()\n", + "# >> filter((_.route_type == '0') |\n", + "# (_.route_type == '1') |\n", + "# (_.route_type == '2'))\n", + "# >> filter(_.calitp_itp_id == 182)\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type)\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", + "metadata": {}, + "outputs": [], + "source": [ + "# tbl_trips = (tbl.gtfs_schedule.trips() \n", + "# >> inner_join(_, rail_routes, on=['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id, _.route_type, _.trip_id)\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", + "metadata": {}, + "outputs": [], + "source": [ + "# tbl_st_times = (tbl.gtfs_schedule.stop_times()\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.trip_id)\n", + "# >> inner_join(_, tbl_trips, on=['calitp_itp_id', 'calitp_url_number', 'trip_id'])\n", + "# >> distinct(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.route_type)\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", + "metadata": {}, + "outputs": [], + "source": [ + "# rail_stops = (tbl.gtfs_schedule.stops()\n", + "# >> select(_.calitp_itp_id, _.calitp_url_number, _.stop_id, _.stop_lat, _.stop_lon)\n", + "# >> inner_join(_, tbl_st_times, on = ['calitp_itp_id', 'calitp_url_number', 'stop_id'])\n", + "# >> collect()\n", + "# )" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], "source": [ @@ -181,12 +284,27 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 10, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6dd08c23eb034e769c8317c27148dccf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[37.79790800531397, -121.26366399999999], controls=(ZoomControl(options=['position', 'zoom_in_text'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ - "# map_hqta(rail_stops)" + "map_hqta(rail_stops, 'route_type')" ] }, { @@ -203,20 +321,21 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 11, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], "source": [ "metro_brt = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == 182)\n", - " >> filter(_.route_id.isin(['901-13149', '910-13149']))\n", - " >> collect())" + " >> filter((_.route_id == '901-13149') |\n", + " (_.route_id =='910-13149'))\n", + " )" ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 12, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -226,7 +345,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 13, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -243,7 +362,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 14, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -253,7 +372,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 15, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -263,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 16, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -271,12 +390,12 @@ "act_brt = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == 4)\n", " >> filter(_.route_id == '1T')\n", - " >> collect())" + " )" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 17, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -286,7 +405,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 18, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -296,7 +415,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 19, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -304,12 +423,12 @@ "omni_brt = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == 232)\n", " >> filter(_.route_id == '9648')\n", - " >> collect())" + " )" ] }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 20, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -319,7 +438,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 21, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -337,7 +456,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 22, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -345,12 +464,12 @@ "ferry = (tbl.gtfs_schedule.routes()\n", " >> filter(_.route_type == '4')\n", " # >> filter(_.route_id == '9648')\n", - " >> collect())" + " )" ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 23, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -362,7 +481,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 24, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -380,7 +499,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 25, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -394,7 +513,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 26, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, "outputs": [ @@ -419,149 +538,65 @@ " \n", " \n", " \n", - " stop_id\n", " calitp_itp_id\n", + " calitp_url_number\n", + " stop_id\n", " stop_lat\n", " stop_lon\n", - " itp_id_stop_id\n", - " itp_id_trip_id\n", - " route_id\n", - " itp_id_route_id\n", - " trip_id\n", + " route_type\n", " geometry\n", - " ...\n", - " route_short_name\n", - " route_long_name\n", - " route_desc\n", - " route_url\n", - " route_color\n", - " route_text_color\n", - " route_sort_order\n", - " continuous_pickup\n", - " continuous_drop_off\n", - " calitp_extracted_at\n", " \n", " \n", " \n", " \n", " 0\n", - " CRN\n", - " 13\n", - " 41.056920\n", - " -94.361617\n", - " 13CRN\n", - " 1352818299\n", - " 96\n", - " 1396\n", - " 52818299\n", - " POINT (2130400.260 627641.309)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400002\n", + " 37.797908\n", + " -121.263664\n", + " 2\n", + " POINT (-111116.950 -23544.700)\n", " \n", " \n", " 1\n", - " MKA\n", - " 13\n", - " 42.940583\n", - " -87.924359\n", - " 13MKA\n", - " 133412815756\n", - " 54\n", - " 1354\n", - " 3412815756\n", - " POINT (2577583.013 986856.496)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400001\n", + " 37.957058\n", + " -121.278948\n", + " 2\n", + " POINT (-112222.169 -5836.078)\n", " \n", " \n", " 2\n", - " OKJ\n", - " 13\n", - " 37.793866\n", - " -122.271667\n", - " 13OKJ\n", - " 135452816206\n", - " 84\n", - " 1384\n", - " 5452816206\n", - " POINT (-199750.592 -22341.380)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400003\n", + " 37.696468\n", + " -121.433869\n", + " 2\n", + " POINT (-126252.943 -34607.238)\n", " \n", " \n", " 3\n", - " PLO\n", - " 13\n", - " 41.662384\n", - " -88.538272\n", - " 13PLO\n", - " 133832815187\n", - " 93\n", - " 1393\n", - " 3832815187\n", - " POINT (2576234.283 836414.716)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400004.3\n", + " 37.657549\n", + " -121.882962\n", + " 2\n", + " POINT (-165877.168 -38241.179)\n", " \n", " \n", " 4\n", - " QCY\n", - " 13\n", - " 39.957063\n", - " -91.368525\n", - " 13QCY\n", - " 133832815187\n", - " 93\n", - " 1393\n", - " 3832815187\n", - " POINT (2408238.879 582112.897)\n", - " ...\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", - " NaN\n", + " 10\n", + " 0\n", + " 3400004.1\n", + " 37.697081\n", + " -121.717648\n", + " 2\n", + " POINT (-151236.096 -34123.815)\n", " \n", " \n", " ...\n", @@ -572,242 +607,93 @@ " ...\n", " ...\n", " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", " \n", " \n", - " 74\n", - " 2483569\n", + " 28\n", " 41\n", - " 37.856636\n", - " -122.478275\n", - " 412483569\n", - " 41t_373938_b_28421_tn_0\n", - " 11643\n", - " 4111643\n", - " t_373938_b_28421_tn_0\n", - " POINT (-217731.552 -14910.728)\n", - " ...\n", - " None\n", - " Pier 41 - Sausalito - Tiburon - Angel Island\n", - " None\n", - " None\n", - " f5cb04\n", - " 000000\n", - " 3\n", - " 1\n", - " 1\n", - " 2021-05-03\n", + " 0\n", + " 2483549\n", + " 37.872939\n", + " -122.455446\n", + " 4\n", + " POINT (-215679.403 -13151.168)\n", " \n", " \n", - " 77\n", - " GF:43000\n", - " 200\n", - " 37.795869\n", - " -122.392450\n", - " 200GF:43000\n", - " 200GF:7296302\n", - " GF:SF\n", - " 200GF:SF\n", - " GF:7296302\n", - " POINT (-210363.380 -21857.544)\n", - " ...\n", - " SF\n", - " Sausalito - San Francisco Ferry\n", - " None\n", - " http://goldengateferry.org/schedules/Sausalito...\n", - " 0000FF\n", - " FFFFFF\n", + " 29\n", + " 41\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 2483569\n", + " 37.856636\n", + " -122.478275\n", + " 4\n", + " POINT (-217731.552 -14910.728)\n", " \n", " \n", - " 78\n", - " GF:43003\n", - " 200\n", - " 37.856401\n", - " -122.478251\n", - " 200GF:43003\n", - " 200GF:7296302\n", - " GF:SF\n", - " 200GF:SF\n", - " GF:7296302\n", - " POINT (-217730.126 -14936.899)\n", - " ...\n", - " SF\n", - " Sausalito - San Francisco Ferry\n", - " None\n", - " http://goldengateferry.org/schedules/Sausalito...\n", - " 0000FF\n", - " FFFFFF\n", + " 31\n", + " 338\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 818729\n", + " 37.770840\n", + " -122.385791\n", + " 4\n", + " POINT (-209847.993 -24653.833)\n", " \n", " \n", - " 79\n", - " GF:43004\n", - " 200\n", - " 37.945316\n", - " -122.508735\n", - " 200GF:43004\n", - " 200GF:7296280\n", - " GF:LF\n", - " 200GF:LF\n", - " GF:7296280\n", - " POINT (-220146.197 -4985.515)\n", - " ...\n", - " LF\n", - " Larkspur - San Francisco Ferry\n", - " None\n", - " http://goldengateferry.org/schedules/Larkspur.php\n", - " 0000FF\n", - " FFFFFF\n", + " 32\n", + " 338\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 818733\n", + " 37.864540\n", + " -122.313932\n", + " 4\n", + " POINT (-203274.531 -14397.269)\n", " \n", " \n", - " 80\n", - " GF:43007\n", - " 200\n", - " 37.872770\n", - " -122.455928\n", - " 200GF:43007\n", - " 200GF:7309934\n", - " GF:TF\n", - " 200GF:TF\n", - " GF:7309934\n", - " POINT (-215722.217 -13168.852)\n", - " ...\n", - " TF\n", - " Tiburon - San Francisco Ferry\n", - " None\n", - " None\n", - " 0000FF\n", - " FFFFFF\n", + " 33\n", + " 338\n", " 0\n", - " None\n", - " None\n", - " 2021-11-07\n", + " 818727\n", + " 37.797482\n", + " -122.395025\n", + " 4\n", + " POINT (-210585.228 -21672.628)\n", " \n", " \n", "\n", - "

2255 rows × 23 columns

\n", + "

1324 rows × 7 columns

\n", "" ], "text/plain": [ - " stop_id calitp_itp_id stop_lat stop_lon itp_id_stop_id \\\n", - "0 CRN 13 41.056920 -94.361617 13CRN \n", - "1 MKA 13 42.940583 -87.924359 13MKA \n", - "2 OKJ 13 37.793866 -122.271667 13OKJ \n", - "3 PLO 13 41.662384 -88.538272 13PLO \n", - "4 QCY 13 39.957063 -91.368525 13QCY \n", - ".. ... ... ... ... ... \n", - "74 2483569 41 37.856636 -122.478275 412483569 \n", - "77 GF:43000 200 37.795869 -122.392450 200GF:43000 \n", - "78 GF:43003 200 37.856401 -122.478251 200GF:43003 \n", - "79 GF:43004 200 37.945316 -122.508735 200GF:43004 \n", - "80 GF:43007 200 37.872770 -122.455928 200GF:43007 \n", - "\n", - " itp_id_trip_id route_id itp_id_route_id trip_id \\\n", - "0 1352818299 96 1396 52818299 \n", - "1 133412815756 54 1354 3412815756 \n", - "2 135452816206 84 1384 5452816206 \n", - "3 133832815187 93 1393 3832815187 \n", - "4 133832815187 93 1393 3832815187 \n", - ".. ... ... ... ... \n", - "74 41t_373938_b_28421_tn_0 11643 4111643 t_373938_b_28421_tn_0 \n", - "77 200GF:7296302 GF:SF 200GF:SF GF:7296302 \n", - "78 200GF:7296302 GF:SF 200GF:SF GF:7296302 \n", - "79 200GF:7296280 GF:LF 200GF:LF GF:7296280 \n", - "80 200GF:7309934 GF:TF 200GF:TF GF:7309934 \n", + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "0 10 0 3400002 37.797908 -121.263664 \n", + "1 10 0 3400001 37.957058 -121.278948 \n", + "2 10 0 3400003 37.696468 -121.433869 \n", + "3 10 0 3400004.3 37.657549 -121.882962 \n", + "4 10 0 3400004.1 37.697081 -121.717648 \n", + ".. ... ... ... ... ... \n", + "28 41 0 2483549 37.872939 -122.455446 \n", + "29 41 0 2483569 37.856636 -122.478275 \n", + "31 338 0 818729 37.770840 -122.385791 \n", + "32 338 0 818733 37.864540 -122.313932 \n", + "33 338 0 818727 37.797482 -122.395025 \n", "\n", - " geometry ... route_short_name \\\n", - "0 POINT (2130400.260 627641.309) ... NaN \n", - "1 POINT (2577583.013 986856.496) ... NaN \n", - "2 POINT (-199750.592 -22341.380) ... NaN \n", - "3 POINT (2576234.283 836414.716) ... NaN \n", - "4 POINT (2408238.879 582112.897) ... NaN \n", - ".. ... ... ... \n", - "74 POINT (-217731.552 -14910.728) ... None \n", - "77 POINT (-210363.380 -21857.544) ... SF \n", - "78 POINT (-217730.126 -14936.899) ... SF \n", - "79 POINT (-220146.197 -4985.515) ... LF \n", - "80 POINT (-215722.217 -13168.852) ... TF \n", + " route_type geometry \n", + "0 2 POINT (-111116.950 -23544.700) \n", + "1 2 POINT (-112222.169 -5836.078) \n", + "2 2 POINT (-126252.943 -34607.238) \n", + "3 2 POINT (-165877.168 -38241.179) \n", + "4 2 POINT (-151236.096 -34123.815) \n", + ".. ... ... \n", + "28 4 POINT (-215679.403 -13151.168) \n", + "29 4 POINT (-217731.552 -14910.728) \n", + "31 4 POINT (-209847.993 -24653.833) \n", + "32 4 POINT (-203274.531 -14397.269) \n", + "33 4 POINT (-210585.228 -21672.628) \n", "\n", - " route_long_name route_desc \\\n", - "0 NaN NaN \n", - "1 NaN NaN \n", - "2 NaN NaN \n", - "3 NaN NaN \n", - "4 NaN NaN \n", - ".. ... ... \n", - "74 Pier 41 - Sausalito - Tiburon - Angel Island None \n", - "77 Sausalito - San Francisco Ferry None \n", - "78 Sausalito - San Francisco Ferry None \n", - "79 Larkspur - San Francisco Ferry None \n", - "80 Tiburon - San Francisco Ferry None \n", - "\n", - " route_url route_color \\\n", - "0 NaN NaN \n", - "1 NaN NaN \n", - "2 NaN NaN \n", - "3 NaN NaN \n", - "4 NaN NaN \n", - ".. ... ... \n", - "74 None f5cb04 \n", - "77 http://goldengateferry.org/schedules/Sausalito... 0000FF \n", - "78 http://goldengateferry.org/schedules/Sausalito... 0000FF \n", - "79 http://goldengateferry.org/schedules/Larkspur.php 0000FF \n", - "80 None 0000FF \n", - "\n", - " route_text_color route_sort_order continuous_pickup continuous_drop_off \\\n", - "0 NaN NaN NaN NaN \n", - "1 NaN NaN NaN NaN \n", - "2 NaN NaN NaN NaN \n", - "3 NaN NaN NaN NaN \n", - "4 NaN NaN NaN NaN \n", - ".. ... ... ... ... \n", - "74 000000 3 1 1 \n", - "77 FFFFFF 0 None None \n", - "78 FFFFFF 0 None None \n", - "79 FFFFFF 0 None None \n", - "80 FFFFFF 0 None None \n", - "\n", - " calitp_extracted_at \n", - "0 NaN \n", - "1 NaN \n", - "2 NaN \n", - "3 NaN \n", - "4 NaN \n", - ".. ... \n", - "74 2021-05-03 \n", - "77 2021-11-07 \n", - "78 2021-11-07 \n", - "79 2021-11-07 \n", - "80 2021-11-07 \n", - "\n", - "[2255 rows x 23 columns]" + "[1324 rows x 7 columns]" ] }, - "execution_count": 22, + "execution_count": 26, "metadata": {}, "output_type": "execute_result" } @@ -818,7 +704,49 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 27, + "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", + "metadata": {}, + "outputs": [], + "source": [ + "## clip to CA since we now have Amtrak national..." + ] + }, + { + "cell_type": "code", + "execution_count": 28, + "id": "b4d279ae-5283-47e6-b503-f01738f7672a", + "metadata": {}, + "outputs": [], + "source": [ + "import intake\n", + "catalog = intake.open_catalog('./catalog.yml')" + ] + }, + { + "cell_type": "code", + "execution_count": 33, + "id": "c76728cc-b293-4f57-8002-3efa845a1dad", + "metadata": {}, + "outputs": [], + "source": [ + "ca_shape = catalog.stanford_shorelines.read().to_crs('EPSG:6414') >> filter(_.STFIPS == '06')\n", + "# ca_shape['geometry'].iloc[0]" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "id": "8b7beb5f-2128-4482-9648-abdfcc8e0001", + "metadata": {}, + "outputs": [], + "source": [ + "rail_brt_ferry = rail_brt_ferry.clip(ca_shape)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, "id": "fa029d00-acac-4242-9048-d8024e70f914", "metadata": {}, "outputs": [], @@ -828,7 +756,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 32, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, "outputs": [ From dd34271ea85c791a9438d435321727dfc0341912 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 8 Dec 2021 21:04:17 +0000 Subject: [PATCH 16/24] illustrate nb save issue --- .../bus_corridors.ipynb | 8 +- high_quality_transit_areas/catalog.yml | 10 + .../rail_ferry_brt.ipynb | 400 +++--------------- 3 files changed, 74 insertions(+), 344 deletions(-) create mode 100644 high_quality_transit_areas/catalog.yml diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 87bf082cb..5c7f4f82b 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -99,7 +99,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, "outputs": [ @@ -168,7 +168,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -180,7 +180,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -192,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], diff --git a/high_quality_transit_areas/catalog.yml b/high_quality_transit_areas/catalog.yml new file mode 100644 index 000000000..58e7a59a4 --- /dev/null +++ b/high_quality_transit_areas/catalog.yml @@ -0,0 +1,10 @@ +metadata: + version: 1 +sources: + stanford_shorelines: + driver: shapefile + description: Stanford shoreline data + url: https://earthworks.stanford.edu/catalog/stanford-vt021tk4894 + args: + urlpath: gs://calitp-analytics-data/data-analyses/msd_dashboard_metric/stanford_shorelines.zip + use_fsspec: true \ No newline at end of file diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 55fc7534c..512cd65f8 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,106 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", - "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", - "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", - "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", - "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", - "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", - "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", - "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", - "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", - "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", - "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", - "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", - "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", - "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", - "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", - "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", - "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", - "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", - "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", - "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", - "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", - "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", - "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" - ] - } - ], - "source": [ - "!pip install -r requirements.txt" - ] - }, - { - "cell_type": "code", - "execution_count": 2, + "outputs": [], + "source": [ + "# !pip install -r requirements.txt" + ] + }, + { + "cell_type": "code", + "execution_count": null, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -152,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", "metadata": {}, "outputs": [], @@ -171,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], @@ -215,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", "metadata": { "tags": [] @@ -233,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", "metadata": {}, "outputs": [], @@ -246,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", "metadata": {}, "outputs": [], @@ -260,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", "metadata": {}, "outputs": [], @@ -274,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], @@ -284,27 +200,12 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "6dd08c23eb034e769c8317c27148dccf", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[37.79790800531397, -121.26366399999999], controls=(ZoomControl(options=['position', 'zoom_in_text'…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "map_hqta(rail_stops, 'route_type')" + "# map_hqta(rail_stops, 'route_type')" ] }, { @@ -321,7 +222,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], @@ -335,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -345,7 +246,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -362,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -372,7 +273,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -382,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -395,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -405,7 +306,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -415,7 +316,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -428,7 +329,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -438,7 +339,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -456,7 +357,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -469,7 +370,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -481,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -499,7 +400,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -513,198 +414,17 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometry
0100340000237.797908-121.2636642POINT (-111116.950 -23544.700)
1100340000137.957058-121.2789482POINT (-112222.169 -5836.078)
2100340000337.696468-121.4338692POINT (-126252.943 -34607.238)
31003400004.337.657549-121.8829622POINT (-165877.168 -38241.179)
41003400004.137.697081-121.7176482POINT (-151236.096 -34123.815)
........................
28410248354937.872939-122.4554464POINT (-215679.403 -13151.168)
29410248356937.856636-122.4782754POINT (-217731.552 -14910.728)
31338081872937.770840-122.3857914POINT (-209847.993 -24653.833)
32338081873337.864540-122.3139324POINT (-203274.531 -14397.269)
33338081872737.797482-122.3950254POINT (-210585.228 -21672.628)
\n", - "

1324 rows × 7 columns

\n", - "
" - ], - "text/plain": [ - " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", - "0 10 0 3400002 37.797908 -121.263664 \n", - "1 10 0 3400001 37.957058 -121.278948 \n", - "2 10 0 3400003 37.696468 -121.433869 \n", - "3 10 0 3400004.3 37.657549 -121.882962 \n", - "4 10 0 3400004.1 37.697081 -121.717648 \n", - ".. ... ... ... ... ... \n", - "28 41 0 2483549 37.872939 -122.455446 \n", - "29 41 0 2483569 37.856636 -122.478275 \n", - "31 338 0 818729 37.770840 -122.385791 \n", - "32 338 0 818733 37.864540 -122.313932 \n", - "33 338 0 818727 37.797482 -122.395025 \n", - "\n", - " route_type geometry \n", - "0 2 POINT (-111116.950 -23544.700) \n", - "1 2 POINT (-112222.169 -5836.078) \n", - "2 2 POINT (-126252.943 -34607.238) \n", - "3 2 POINT (-165877.168 -38241.179) \n", - "4 2 POINT (-151236.096 -34123.815) \n", - ".. ... ... \n", - "28 4 POINT (-215679.403 -13151.168) \n", - "29 4 POINT (-217731.552 -14910.728) \n", - "31 4 POINT (-209847.993 -24653.833) \n", - "32 4 POINT (-203274.531 -14397.269) \n", - "33 4 POINT (-210585.228 -21672.628) \n", - "\n", - "[1324 rows x 7 columns]" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "rail_brt_ferry" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", "metadata": {}, "outputs": [], @@ -714,7 +434,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "b4d279ae-5283-47e6-b503-f01738f7672a", "metadata": {}, "outputs": [], @@ -725,18 +445,32 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "c76728cc-b293-4f57-8002-3efa845a1dad", + "metadata": { + "tags": [] + }, + "outputs": [], + "source": [ + "ca_shape = catalog.stanford_shorelines.read().to_crs('EPSG:6414') >> filter(_.STFIPS == '06')" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "0174ddab-347c-47d2-b824-98e360719b94", "metadata": {}, "outputs": [], "source": [ - "ca_shape = catalog.stanford_shorelines.read().to_crs('EPSG:6414') >> filter(_.STFIPS == '06')\n", - "# ca_shape['geometry'].iloc[0]" + "## after this cell displays output the notebook refuses to save...\n", + "## File Save Error for rail_ferry_brt.ipynb\n", + "## Invalid response: 413 Request Entity Too Large\n", + "ca_shape['geometry'].iloc[0]" ] }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "8b7beb5f-2128-4482-9648-abdfcc8e0001", "metadata": {}, "outputs": [], @@ -746,7 +480,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "fa029d00-acac-4242-9048-d8024e70f914", "metadata": {}, "outputs": [], @@ -756,24 +490,10 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], + "outputs": [], "source": [ "geoparquet_gcs_export(rail_brt_ferry, 'rail_brt_ferry')" ] From 122571ba1624b6cdc06295ff12ca187fd200e20e Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Thu, 9 Dec 2021 00:09:13 +0000 Subject: [PATCH 17/24] view lbt PCH corridor pending debug --- .../bus_corridors.ipynb | 1175 ++++++++++++++--- .../rail_ferry_brt.ipynb | 278 +++- 2 files changed, 1260 insertions(+), 193 deletions(-) diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 5c7f4f82b..21a0736e3 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 18, "id": "d7bcdd2a-75f6-429b-8c2e-10263abf7ace", "metadata": { "collapsed": true, @@ -17,79 +17,73 @@ "output_type": "stream", "text": [ "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Collecting pygeos\n", - " Using cached pygeos-0.12.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB)\n", - "Collecting ipyleaflet\n", - " Using cached ipyleaflet-0.15.0-py2.py3-none-any.whl (3.3 MB)\n", + "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", + "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Collecting xyzservices>=2021.8.1\n", - " Using cached xyzservices-2021.11.0-py3-none-any.whl (34 kB)\n", - "Collecting traittypes<3,>=0.2.1\n", - " Using cached traittypes-0.2.1-py2.py3-none-any.whl (8.6 kB)\n", + "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", + "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", - "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", + "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", + "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", + "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", + "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", + "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", + "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", + "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", + "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", + "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", + "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", + "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", + "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", + "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", - "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", + "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", + "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", - "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", + "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", + "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", + "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", + "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", + "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", + "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n", - "Installing collected packages: xyzservices, traittypes, pygeos, ipyleaflet\n", - "Successfully installed ipyleaflet-0.15.0 pygeos-0.12.0 traittypes-0.2.1 xyzservices-2021.11.0\n" + "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" ] } ], @@ -99,7 +93,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, "outputs": [ @@ -168,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -180,7 +174,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -192,7 +186,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], @@ -247,7 +241,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "id": "65c74fbd-059f-4df8-a3a1-e6c1361489b7", "metadata": {}, "outputs": [], @@ -267,32 +261,38 @@ " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.weekday() == 2)]\n", " wednesday = wednesday[wednesday['service_date'].apply(lambda x: x.month == 12)] ## December\n", " wednesday = wednesday[wednesday['service_date'] == wednesday['service_date'].iloc[0]] ## pick most recent Wednesday from Dec or earlier\n", + " wednesday = wednesday >> select(_.calitp_itp_id, _.calitp_url_number, _.service_id)\n", " \n", " bus_routes = (tbl.gtfs_schedule.routes()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " # >> filter(_.route_type.isin(['3', '11'])) ## bus and trolleybus\n", - " >> filter(_.route_type == '3')\n", - " >> select(_.route_id) >> collect())\n", + " >> filter((_.route_type == '3') | (_.route_type == '11'))\n", + " >> select(_.calitp_itp_id, _.calitp_url_number, _.route_id) \n", + " # >> collect()\n", + " )\n", " print('loaded bus routes')\n", " \n", " if itp_id == 273:\n", " trips = (tbl.gtfs_schedule.trips()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " >> filter(_.service_id.isin(['1'])) ## temporary hardcode for SacRT\n", - " >> filter(_.route_id.isin(bus_routes.route_id))\n", + " >> filter(_.service_id == '1') ## temporary hardcode for SacRT\n", + " >> inner_join(_, bus_routes, on = ['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", " >> collect())\n", " else:\n", " trips = (tbl.gtfs_schedule.trips()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", - " >> filter(_.service_id.isin(wednesday.service_id))\n", - " >> filter(_.route_id.isin(bus_routes.route_id))\n", - " >> collect())\n", + " >> inner_join(_, bus_routes, on = ['calitp_itp_id', 'calitp_url_number', 'route_id'])\n", + " >> collect()\n", + " >> inner_join(_, wednesday, on = ['calitp_itp_id', 'calitp_url_number', 'service_id'])\n", + " )\n", " print('loaded trips')\n", " stop_times = (tbl.gtfs_schedule.stop_times()\n", " >> filter(_.calitp_itp_id == int(itp_id))\n", " >> collect())\n", - " stop_times = (stop_times >> filter(_.trip_id.isin(trips.trip_id))\n", - " >> select(-_.calitp_itp_id, -_.calitp_extracted_at))\n", + " stop_times = (stop_times >> inner_join(_, trips, on = ['calitp_itp_id', 'calitp_url_number', 'trip_id'])\n", + " >> select(-_.stop_headsign, -_.pickup_type, -_.drop_off_type,\n", + " -_.continuous_pickup, -_.continuous_drop_off, -_.shape_dist_travelled,\n", + " -_.timepoint)\n", + " )\n", " print('loaded stop times')\n", "\n", " stops = (tbl.gtfs_schedule.stops() \n", @@ -309,7 +309,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 13, "id": "1049eee5-d4d9-43a1-9a84-c3bd3687f6d3", "metadata": {}, "outputs": [], @@ -330,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 14, "id": "0d3207be-d38f-4f17-a97f-0f84cae25d77", "metadata": {}, "outputs": [], @@ -463,7 +463,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 31, "id": "9483141f-c197-4fc8-80f0-4efa8d2b44c4", "metadata": {}, "outputs": [], @@ -507,24 +507,24 @@ " hqta = hqta.set_crs('EPSG:6414')\n", " except:\n", " continue\n", - " \n", - " return hqta.drop(columns=['n', 'departure_hour']).reset_index(drop=True)" + " return hqta\n", + " # return hqta.drop(columns=['n', 'departure_hour']).reset_index(drop=True)" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 27, "id": "e9d94df4-21cd-46d6-a8ab-fe4d4c01d728", "metadata": {}, "outputs": [], "source": [ - "debug_ids = ['25349']" + "debug_ids = ['940143']" ] }, { "cell_type": "code", - "execution_count": 13, - "id": "b1089592-7a20-4c3b-a27f-5eb6193213de", + "execution_count": 21, + "id": "54227d0f-b539-4852-96e2-50472f40fb08", "metadata": { "tags": [] }, @@ -534,54 +534,10 @@ "output_type": "stream", "text": [ "loaded shapes\n", - "loaded bus routes\n" - ] - }, - { - "ename": "AssertionError", - "evalue": "Unexpected param: (__[POSTCOMPILE_service_id_1])", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mAssertionError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_44/1117417450.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mlbt_views\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_operator_views\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m170\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/tmp/ipykernel_44/4270395868.py\u001b[0m in \u001b[0;36mget_operator_views\u001b[0;34m(itp_id)\u001b[0m\n\u001b[1;32m 29\u001b[0m >> collect())\n\u001b[1;32m 30\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 31\u001b[0;31m trips = (tbl.gtfs_schedule.trips()\n\u001b[0m\u001b[1;32m 32\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalitp_itp_id\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mitp_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 33\u001b[0m \u001b[0;34m>>\u001b[0m \u001b[0mfilter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mwednesday\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mservice_id\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__rrshift__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 97\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mPipeable\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcalls\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m[\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 99\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 100\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 101\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__call__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 103\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mf\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcalls\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 104\u001b[0;31m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mres\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 105\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 106\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/siu.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, x)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0moperator\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetitem\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;32melif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m\"__call__\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0minst\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mrest\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;31m# in normal case, get method to call, and then call it\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/dply/verbs.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 201\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mNoArgs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 202\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 203\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch_func\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mstrip_args\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstrip_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 204\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 205\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/functools.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kw)\u001b[0m\n\u001b[1;32m 875\u001b[0m '1 positional argument')\n\u001b[1;32m 876\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__class__\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 879\u001b[0m \u001b[0mfuncname\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgetattr\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'__name__'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'singledispatch function'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/verbs.py\u001b[0m in \u001b[0;36m_collect\u001b[0;34m(__data, as_df)\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0msql_db\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mconn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 451\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 452\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0msql_db\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_sql\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 453\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 454\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mconn\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m__data\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlast_op\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/io/sql.py\u001b[0m in \u001b[0;36mread_query\u001b[0;34m(self, sql, index_col, coerce_float, parse_dates, params, chunksize, dtype)\u001b[0m\n\u001b[1;32m 1577\u001b[0m \u001b[0margs\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0m_convert_params\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msql\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1578\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1579\u001b[0;31m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1580\u001b[0m \u001b[0mcolumns\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mresult\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mkeys\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1581\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/siuba/sql/utils.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 50\u001b[0m \u001b[0;32mclass\u001b[0m \u001b[0m_FixedSqlDatabase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0m_pd_sql\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mSQLDatabase\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 51\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 52\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mconnectable\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecute\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 53\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36mexecute\u001b[0;34m(self, statement, *multiparams, **params)\u001b[0m\n\u001b[1;32m 1287\u001b[0m )\n\u001b[1;32m 1288\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1289\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0m_EMPTY_EXECUTION_OPTS\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1290\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1291\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_execute_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_execute_on_connection\u001b[0;34m(self, connection, multiparams, params, execution_options, _force)\u001b[0m\n\u001b[1;32m 323\u001b[0m ):\n\u001b[1;32m 324\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0m_force\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msupports_execution\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 325\u001b[0;31m return connection._execute_clauseelement(\n\u001b[0m\u001b[1;32m 326\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmultiparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mparams\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexecution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 327\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/engine/base.py\u001b[0m in \u001b[0;36m_execute_clauseelement\u001b[0;34m(self, elem, multiparams, params, execution_options)\u001b[0m\n\u001b[1;32m 1471\u001b[0m )\n\u001b[1;32m 1472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1473\u001b[0;31m compiled_sql, extracted_params, cache_hit = elem._compile_w_cache(\n\u001b[0m\u001b[1;32m 1474\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1475\u001b[0m \u001b[0mcompiled_cache\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcompiled_cache\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compile_w_cache\u001b[0;34m(self, dialect, compiled_cache, column_keys, for_executemany, schema_translate_map, **kw)\u001b[0m\n\u001b[1;32m 531\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 532\u001b[0m \u001b[0mextracted_params\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 533\u001b[0;31m compiled_sql = self._compiler(\n\u001b[0m\u001b[1;32m 534\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 535\u001b[0m \u001b[0mcache_key\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0melem_cache_key\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/elements.py\u001b[0m in \u001b[0;36m_compiler\u001b[0;34m(self, dialect, **kw)\u001b[0m\n\u001b[1;32m 553\u001b[0m Dialect.\"\"\"\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 555\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement_compiler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 556\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 557\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, *args, **kwargs)\u001b[0m\n\u001b[1;32m 220\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mColumn\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 221\u001b[0m \u001b[0mkwargs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"compile_kwargs\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mutil\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mimmutabledict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m\"include_table\"\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;32mFalse\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 222\u001b[0;31m \u001b[0msuper\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mBigQueryCompiler\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 223\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_insert\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0minsert_stmt\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mFalse\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, cache_key, column_keys, for_executemany, linting, **kwargs)\u001b[0m\n\u001b[1;32m 774\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtruncated_names\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 775\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 776\u001b[0;31m \u001b[0mCompiled\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdialect\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 778\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misinsert\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misupdate\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0misdelete\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dialect, statement, schema_translate_map, render_schema_translate, compile_kwargs)\u001b[0m\n\u001b[1;32m 449\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcan_execute\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 450\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexecution_options\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mstatement\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_execution_options\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 451\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstring\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mstatement\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mcompile_kwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 452\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 453\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mrender_schema_translate\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mprocess\u001b[0;34m(self, obj, **kwargs)\u001b[0m\n\u001b[1;32m 484\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 485\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mprocess\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 486\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 487\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 488\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__str__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3505\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[0;32m-> 3507\u001b[0;31m [\n\u001b[0m\u001b[1;32m 3508\u001b[0m f._compiler_dispatch(\n\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[1;32m 3506\u001b[0m text += \", \".join(\n\u001b[1;32m 3507\u001b[0m [\n\u001b[0;32m-> 3508\u001b[0;31m f._compiler_dispatch(\n\u001b[0m\u001b[1;32m 3509\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3510\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_subquery\u001b[0;34m(self, subquery, **kw)\u001b[0m\n\u001b[1;32m 2875\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_subquery\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2876\u001b[0m \u001b[0mkw\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"subquery\"\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mTrue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2877\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mvisit_alias\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0msubquery\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2878\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2879\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_lateral\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_alias\u001b[0;34m(self, alias, asfrom, ashint, iscrud, fromhints, subquery, lateral, enclosing_alias, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 2834\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfroms\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0malias\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0malias_name\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2835\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2836\u001b[0;31m inner = alias.element._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2837\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0masfrom\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlateral\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlateral\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2838\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_select\u001b[0;34m(self, select_stmt, asfrom, insert_into, fromhints, compound_index, select_wraps_for, lateral, from_linter, **kwargs)\u001b[0m\n\u001b[1;32m 3361\u001b[0m ]\n\u001b[1;32m 3362\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3363\u001b[0;31m text = self._compose_select_body(\n\u001b[0m\u001b[1;32m 3364\u001b[0m \u001b[0mtext\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3365\u001b[0m \u001b[0mselect_stmt\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_compose_select_body\u001b[0;34m(self, text, select, compile_state, inner_columns, froms, byfrom, toplevel, kwargs)\u001b[0m\n\u001b[1;32m 3519\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3520\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 3521\u001b[0;31m t = self._generate_delimited_and_list(\n\u001b[0m\u001b[1;32m 3522\u001b[0m \u001b[0mselect\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_where_criteria\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfrom_linter\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfrom_linter\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3523\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_delimited_and_list\u001b[0;34m(self, clauses, **kw)\u001b[0m\n\u001b[1;32m 1660\u001b[0m )\n\u001b[1;32m 1661\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlcc\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1662\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mclauses\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiler_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1663\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1664\u001b[0m \u001b[0mseparator\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mOPERATORS\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0moperators\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mand_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36mvisit_binary\u001b[0;34m(self, binary, override_operator, eager_grouping, from_linter, lateral_from_linter, **kw)\u001b[0m\n\u001b[1;32m 2150\u001b[0m \u001b[0mdisp\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_get_operator_dispatch\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\"binary\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2151\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2152\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mdisp\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2153\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2154\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_in_op_binary\u001b[0;34m(self, binary, operator_, **kw)\u001b[0m\n\u001b[1;32m 311\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mvisit_in_op_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0moperator_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 312\u001b[0m return self.__in_expanding_bind(\n\u001b[0;32m--> 313\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_generate_generic_binary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbinary\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m\" IN \"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 314\u001b[0m )\n\u001b[1;32m 315\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/compiler.py\u001b[0m in \u001b[0;36m_generate_generic_binary\u001b[0;34m(self, binary, opstring, eager_grouping, **kw)\u001b[0m\n\u001b[1;32m 2216\u001b[0m )\n\u001b[1;32m 2217\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mopstring\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 2218\u001b[0;31m + binary.right._compiler_dispatch(\n\u001b[0m\u001b[1;32m 2219\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0meager_grouping\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0meager_grouping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2220\u001b[0m )\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/sqlalchemy/sql/visitors.py\u001b[0m in \u001b[0;36m_compiler_dispatch\u001b[0;34m(self, visitor, **kw)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 81\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 82\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mmeth\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 83\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 84\u001b[0m cls._compiler_dispatch = (\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36mvisit_bindparam\u001b[0;34m(self, bindparam, within_columns_clause, literal_binds, skip_bind_expression, **kwargs)\u001b[0m\n\u001b[1;32m 435\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 436\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mbindparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexpanding\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 437\u001b[0;31m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__expanded_param\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mparam\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\"Unexpected param: {param}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 438\u001b[0m \u001b[0mparam\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mparam\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreplace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\")\"\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34mf\":{bq_type})\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 439\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pybigquery/sqlalchemy_bigquery.py\u001b[0m in \u001b[0;36massert_\u001b[0;34m(cond, message)\u001b[0m\n\u001b[1;32m 61\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0massert_\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcond\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmessage\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m\"Assertion failed\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# pragma: NO COVER\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mcond\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 63\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mAssertionError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mmessage\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 64\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mAssertionError\u001b[0m: Unexpected param: (__[POSTCOMPILE_service_id_1])" + "loaded bus routes\n", + "loaded trips\n", + "loaded stop times\n", + "loaded stops\n" ] } ], @@ -591,31 +547,412 @@ }, { "cell_type": "code", - "execution_count": null, - "id": "908af6e2-bef2-4458-8125-67cd28454493", - "metadata": {}, - "outputs": [], + "execution_count": 32, + "id": "f6c92a46-4a65-4a0f-9bbc-a9d9050417d0", + "metadata": { + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "there are 100 shapes total\n", + "calculating for shape_id 510066\n", + "progress: 0/100 shapes (0.0%)\n", + "calculating for shape_id 610106\n", + "calculating for shape_id 610105\n", + "calculating for shape_id 510067\n", + "calculating for shape_id 1210143\n", + "calculating for shape_id 460064\n", + "calculating for shape_id 1210138\n", + "calculating for shape_id 460067\n", + "no line for shape 460067\n", + "calculating for shape_id 1920161\n", + "calculating for shape_id 1920167\n", + "calculating for shape_id 1730123\n", + "calculating for shape_id 1910292\n", + "calculating for shape_id 1910295\n", + "calculating for shape_id 1730122\n", + "calculating for shape_id 220068\n", + "calculating for shape_id 220074\n", + "calculating for shape_id 1710168\n", + "calculating for shape_id 1710162\n", + "calculating for shape_id 1720090\n", + "calculating for shape_id 1720091\n", + "no line for shape 1720091\n", + "calculating for shape_id 10070\n", + "calculating for shape_id 20008\n", + "calculating for shape_id 40001\n", + "calculating for shape_id 40002\n", + "no line for shape 40002\n", + "calculating for shape_id 410006\n", + "calculating for shape_id 80002\n", + "progress: 25/100 shapes (25.0%)\n", + "calculating for shape_id 10069\n", + "no line for shape 10069\n", + "calculating for shape_id 80003\n", + "no line for shape 80003\n", + "calculating for shape_id 1510067\n", + "calculating for shape_id 20010\n", + "calculating for shape_id 450111\n", + "no line for shape 450111\n", + "calculating for shape_id 710048\n", + "calculating for shape_id 1750012\n", + "no line for shape 1750012\n", + "calculating for shape_id 1510064\n", + "calculating for shape_id 450110\n", + "calculating for shape_id 410007\n", + "no line for shape 410007\n", + "calculating for shape_id 710046\n", + "calculating for shape_id 1040017\n", + "calculating for shape_id 1310131\n", + "calculating for shape_id 1310132\n", + "no stops for shape 1310132\n", + "calculating for shape_id 1040018\n", + "calculating for shape_id 1750010\n", + "no stops for shape 1750010\n", + "calculating for shape_id 910129\n", + "calculating for shape_id 1010081\n", + "calculating for shape_id 1030063\n", + "calculating for shape_id 910132\n", + "calculating for shape_id 1010082\n", + "no line for shape 1010082\n", + "calculating for shape_id 1810080\n", + "calculating for shape_id 1030064\n", + "calculating for shape_id 230018\n", + "calculating for shape_id 230015\n", + "progress: 50/100 shapes (50.0%)\n", + "calculating for shape_id 1120045\n", + "calculating for shape_id 1110083\n", + "calculating for shape_id 210080\n", + "calculating for shape_id 210079\n", + "no line for shape 210079\n", + "calculating for shape_id 1820070\n", + "calculating for shape_id 1810081\n", + "calculating for shape_id 1110082\n", + "no stops for shape 1110082\n", + "calculating for shape_id 920113\n", + "calculating for shape_id 1120046\n", + "no line for shape 1120046\n", + "calculating for shape_id 1820071\n", + "no stops for shape 1820071\n", + "calculating for shape_id 930151\n", + "calculating for shape_id 920111\n", + "no stops for shape 920111\n", + "calculating for shape_id 930148\n", + "no stops for shape 930148\n", + "calculating for shape_id 930150\n", + "no line for shape 930150\n", + "calculating for shape_id 930147\n", + "no stops for shape 930147\n", + "calculating for shape_id 920115\n", + "no stops for shape 920115\n", + "calculating for shape_id 920112\n", + "no line for shape 920112\n", + "calculating for shape_id 460065\n", + "no line for shape 460065\n", + "calculating for shape_id 910131\n", + "no line for shape 910131\n", + "calculating for shape_id 910130\n", + "no stops for shape 910130\n", + "calculating for shape_id 460063\n", + "no stops for shape 460063\n", + "calculating for shape_id 460069\n", + "no line for shape 460069\n", + "calculating for shape_id 1720093\n", + "no line for shape 1720093\n", + "calculating for shape_id 1740030\n", + "no stops for shape 1740030\n", + "calculating for shape_id 1720092\n", + "progress: 75/100 shapes (75.0%)\n", + "no stops for shape 1720092\n", + "calculating for shape_id 1510066\n", + "no stops for shape 1510066\n", + "calculating for shape_id 410005\n", + "no line for shape 410005\n", + "calculating for shape_id 4050003\n", + "calculating for shape_id 910140\n", + "no line for shape 910140\n", + "calculating for shape_id 4050001\n", + "calculating for shape_id 1210141\n", + "no line for shape 1210141\n", + "calculating for shape_id 940134\n", + "no line for shape 940134\n", + "calculating for shape_id 940133\n", + "no line for shape 940133\n", + "calculating for shape_id 210078\n", + "no line for shape 210078\n", + "calculating for shape_id 460075\n", + "no line for shape 460075\n", + "calculating for shape_id 460071\n", + "no line for shape 460071\n", + "calculating for shape_id 450109\n", + "no line for shape 450109\n", + "calculating for shape_id 220073\n", + "no line for shape 220073\n", + "calculating for shape_id 210083\n", + "no line for shape 210083\n", + "calculating for shape_id 1920165\n", + "no line for shape 1920165\n", + "calculating for shape_id 1910305\n", + "no stops for shape 1910305\n", + "calculating for shape_id 1910304\n", + "no line for shape 1910304\n", + "calculating for shape_id 1910302\n", + "no stops for shape 1910302\n", + "calculating for shape_id 1910297\n", + "no stops for shape 1910297\n", + "calculating for shape_id 1910287\n", + "no line for shape 1910287\n", + "calculating for shape_id 1720096\n", + "no line for shape 1720096\n", + "calculating for shape_id 1720095\n", + "no stops for shape 1720095\n", + "calculating for shape_id 1210144\n", + "no line for shape 1210144\n", + "calculating for shape_id 940143\n", + "***debug shape*** 940143\n", + "no line for shape 940143\n" + ] + } + ], "source": [ - "bus_routes" + "lbt_hqta = single_operator_hqta(lbt_views)" ] }, { "cell_type": "code", - "execution_count": 43, - "id": "a04ec0e7-df45-4d2f-b477-1f0cb2c6c6ca", + "execution_count": 33, + "id": "2ab838e9-ba14-4057-a0ab-9e6401e83f16", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idgeometryhqta_segment_idsegment_sequenceshape_idstop_idam_max_tripspm_max_tripshq_transit_corr
0170POLYGON ((167654.764 -470242.512, 167655.638 -...1081235767051006640101616True
1170POLYGON ((167694.221 -469153.485, 167693.191 -...9304416331510066000477True
2170POLYGON ((167669.771 -467897.042, 167669.770 -...29273764112510066169877True
3170POLYGON ((167646.521 -466641.120, 167646.502 -...36487189893510066055044False
4170POLYGON ((167605.970 -464592.739, 167604.537 -...11932541904510066055544False
..............................
8170POLYGON ((167565.314 -466042.457, 167566.287 -...2433783489424050003525111False
9170POLYGON ((167563.316 -466013.754, 167563.368 -...3860309591434050003525111False
10170POLYGON ((167564.027 -466023.335, 167507.511 -...259261282454050003061054False
11170POLYGON ((167584.688 -466111.742, 167498.932 -...2524795608464050003525111False
0170POLYGON ((165145.529 -464024.944, 165145.017 -...123563336844050001013422False
\n", + "

383 rows × 9 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id geometry \\\n", + "0 170 POLYGON ((167654.764 -470242.512, 167655.638 -... \n", + "1 170 POLYGON ((167694.221 -469153.485, 167693.191 -... \n", + "2 170 POLYGON ((167669.771 -467897.042, 167669.770 -... \n", + "3 170 POLYGON ((167646.521 -466641.120, 167646.502 -... \n", + "4 170 POLYGON ((167605.970 -464592.739, 167604.537 -... \n", + ".. ... ... \n", + "8 170 POLYGON ((167565.314 -466042.457, 167566.287 -... \n", + "9 170 POLYGON ((167563.316 -466013.754, 167563.368 -... \n", + "10 170 POLYGON ((167564.027 -466023.335, 167507.511 -... \n", + "11 170 POLYGON ((167584.688 -466111.742, 167498.932 -... \n", + "0 170 POLYGON ((165145.529 -464024.944, 165145.017 -... \n", + "\n", + " hqta_segment_id segment_sequence shape_id stop_id am_max_trips \\\n", + "0 1081235767 0 510066 4010 16 \n", + "1 930441633 1 510066 0004 7 \n", + "2 2927376411 2 510066 1698 7 \n", + "3 3648718989 3 510066 0550 4 \n", + "4 1193254190 4 510066 0555 4 \n", + ".. ... ... ... ... ... \n", + "8 2433783489 42 4050003 5251 1 \n", + "9 3860309591 43 4050003 5251 1 \n", + "10 259261282 45 4050003 0610 5 \n", + "11 2524795608 46 4050003 5251 1 \n", + "0 1235633368 4 4050001 0134 2 \n", + "\n", + " pm_max_trips hq_transit_corr \n", + "0 16 True \n", + "1 7 True \n", + "2 7 True \n", + "3 4 False \n", + "4 4 False \n", + ".. ... ... \n", + "8 1 False \n", + "9 1 False \n", + "10 4 False \n", + "11 1 False \n", + "0 2 False \n", + "\n", + "[383 rows x 9 columns]" + ] + }, + "execution_count": 33, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ - "bus_routes = (tbl.gtfs_schedule.routes()\n", - " >> filter(_.calitp_itp_id == 170)\n", - " >> filter(_.route_type == '3', _.route_type == '11') ## bus and trolleybus\n", - " >> select(_.route_id) >> collect())" + "lbt_hqta" ] }, { "cell_type": "code", - "execution_count": 42, - "id": "e7912a98-883b-4c6b-aedf-95533d9497c5", + "execution_count": 36, + "id": "c5fcee96-a46e-4d56-afe3-717d7841945d", "metadata": {}, "outputs": [ { @@ -639,68 +976,594 @@ " \n", " \n", " \n", - " route_id\n", + " calitp_itp_id\n", + " geometry\n", + " hqta_segment_id\n", + " segment_sequence\n", + " shape_id\n", + " stop_id\n", + " am_max_trips\n", + " pm_max_trips\n", + " hq_transit_corr\n", " \n", " \n", " \n", + " \n", + " 3\n", + " 170\n", + " POLYGON ((170683.457 -468570.782, 170703.916 -...\n", + " 3462120608\n", + " 4\n", + " 460064\n", + " 0477\n", + " 6\n", + " 6\n", + " True\n", + " \n", " \n", "\n", "" ], "text/plain": [ - "Empty DataFrame\n", - "Columns: [route_id]\n", - "Index: []" + " calitp_itp_id geometry \\\n", + "3 170 POLYGON ((170683.457 -468570.782, 170703.916 -... \n", + "\n", + " hqta_segment_id segment_sequence shape_id stop_id am_max_trips \\\n", + "3 3462120608 4 460064 0477 6 \n", + "\n", + " pm_max_trips hq_transit_corr \n", + "3 6 True " ] }, - "execution_count": 42, + "execution_count": 36, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "bus_routes" + "lbt_hqta >> filter(_.stop_id == '0477')" ] }, { "cell_type": "code", - "execution_count": 30, - "id": "f6c92a46-4a65-4a0f-9bbc-a9d9050417d0", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, - "tags": [] - }, + "execution_count": 41, + "id": "1d258bdf-1164-4036-a16f-c7f942711c3f", + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "there are 0 shapes total\n" + "\n", + "Int64Index: 383 entries, 0 to 0\n", + "Data columns (total 9 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 calitp_itp_id 383 non-null object \n", + " 1 geometry 383 non-null geometry\n", + " 2 hqta_segment_id 383 non-null int64 \n", + " 3 segment_sequence 383 non-null object \n", + " 4 shape_id 383 non-null object \n", + " 5 stop_id 383 non-null object \n", + " 6 am_max_trips 383 non-null int64 \n", + " 7 pm_max_trips 383 non-null int64 \n", + " 8 hq_transit_corr 383 non-null bool \n", + "dtypes: bool(1), geometry(1), int64(3), object(4)\n", + "memory usage: 27.3+ KB\n" ] - }, + } + ], + "source": [ + "lbt_hqta.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 43, + "id": "8c170b28-4de1-4ac1-b265-920ec3a976b4", + "metadata": {}, + "outputs": [ { - "ename": "KeyError", - "evalue": "\"['n' 'departure_hour'] not found in axis\"", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m/tmp/ipykernel_46/1844755579.py\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mbart_hqta\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msingle_operator_hqta\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbart_views\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/tmp/ipykernel_46/483469756.py\u001b[0m in \u001b[0;36msingle_operator_hqta\u001b[0;34m(views)\u001b[0m\n\u001b[1;32m 39\u001b[0m \u001b[0;32mcontinue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 40\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 41\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mhqta\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'n'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'departure_hour'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreset_index\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/util/_decorators.py\u001b[0m in \u001b[0;36mwrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 309\u001b[0m \u001b[0mstacklevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mstacklevel\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 310\u001b[0m )\n\u001b[0;32m--> 311\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mfunc\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 312\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 313\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mwrapper\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/frame.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[1;32m 4904\u001b[0m \u001b[0mweight\u001b[0m \u001b[0;36m1.0\u001b[0m \u001b[0;36m0.8\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4905\u001b[0m \"\"\"\n\u001b[0;32m-> 4906\u001b[0;31m return super().drop(\n\u001b[0m\u001b[1;32m 4907\u001b[0m \u001b[0mlabels\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4908\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, axis, index, columns, level, inplace, errors)\u001b[0m\n\u001b[1;32m 4148\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlabels\u001b[0m \u001b[0;32min\u001b[0m \u001b[0maxes\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mitems\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4149\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mlabels\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 4150\u001b[0;31m \u001b[0mobj\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mobj\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_drop_axis\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4151\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4152\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0minplace\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/generic.py\u001b[0m in \u001b[0;36m_drop_axis\u001b[0;34m(self, labels, axis, level, errors)\u001b[0m\n\u001b[1;32m 4183\u001b[0m \u001b[0mnew_axis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlevel\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mlevel\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4184\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 4185\u001b[0;31m \u001b[0mnew_axis\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdrop\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mlabels\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0merrors\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0merrors\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 4186\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mreindex\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0maxis_name\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mnew_axis\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4187\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m/opt/conda/lib/python3.9/site-packages/pandas/core/indexes/base.py\u001b[0m in \u001b[0;36mdrop\u001b[0;34m(self, labels, errors)\u001b[0m\n\u001b[1;32m 6015\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmask\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0many\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6016\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0merrors\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;34m\"ignore\"\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 6017\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mKeyError\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"{labels[mask]} not found in axis\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6018\u001b[0m \u001b[0mindexer\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mindexer\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m~\u001b[0m\u001b[0mmask\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 6019\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdelete\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mindexer\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mKeyError\u001b[0m: \"['n' 'departure_hour'] not found in axis\"" - ] + "data": { + "text/plain": [ + "array(['510066', '610106', '610105', '510067', '1210143', '460064',\n", + " '1210138', '1920161', '1920167', '1730123', '1910292', '1910295',\n", + " '1730122', '220068', '220074', '1710168', '1710162', '1720090',\n", + " '10070', '20008', '40001', '410006', '80002', '1510067', '20010',\n", + " '710048', '1510064', '450110', '710046', '1040017', '1310131',\n", + " '1040018', '910129', '1010081', '1030063', '910132', '1810080',\n", + " '1030064', '230018', '230015', '1120045', '1110083', '210080',\n", + " '1820070', '1810081', '920113', '930151', '4050003', '4050001'],\n", + " dtype=object)" + ] + }, + "execution_count": 43, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "lbt_hqta.shape_id.unique()" + ] + }, + { + "cell_type": "code", + "execution_count": 40, + "id": "f03f090c-2508-46a4-b705-18df2c015186", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "5cc25219c19c41b6b83610ca0d0397f2", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[33.77270983724983, -118.1893899136652], controls=(ZoomControl(options=['position', 'zoom_in_text',…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "map_hqta(lbt_hqta, 'hqta_segment_id')" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "id": "c19aba0b-b265-4cfe-8e76-0fca0447acda", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e9ed295d930b409c8063ff3abea43ad6", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[33.91231602534506, -118.10067122142928], controls=(ZoomControl(options=['position', 'zoom_in_text'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "map_hqta(lbt_hqta >> filter(_.shape_id == '1730123'))" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "4e62a18b-a65f-4027-87f2-7da1227a4d3b", + "metadata": {}, + "outputs": [], + "source": [ + "## investigate PCH not being an hqta..." + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "id": "970b2cb6-7511-44be-bfb1-4d1c1d1bfe2b", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idgeometryhqta_segment_idsegment_sequenceshape_idstop_idam_max_tripspm_max_tripshq_transit_corr
0170POLYGON ((175350.451 -454051.814, 175349.213 -...263163155101730123411355True
1170POLYGON ((175836.936 -454587.721, 175836.959 -...395710928911730123411632False
2170POLYGON ((175798.075 -455972.107, 175798.083 -...192662005121730123411932False
3170POLYGON ((175827.602 -457076.012, 175827.610 -...9770266131730123303332False
4170POLYGON ((175854.103 -458921.667, 175854.135 -...261241411841730123412432False
5170POLYGON ((176737.013 -460049.998, 176737.342 -...397105310451730123190933False
6170POLYGON ((177991.832 -460007.766, 178010.111 -...197500301861730123190222False
7170POLYGON ((178396.327 -461576.519, 178395.927 -...4607772471730123156933False
8170POLYGON ((178429.971 -462989.509, 178430.591 -...244947623781730123180255False
9170POLYGON ((178152.046 -463095.761, 178090.699 -...384245609191730123127243False
10170POLYGON ((175975.412 -463280.594, 175977.308 -...3062012927101730123197243False
11170POLYGON ((175919.561 -463405.079, 175916.534 -...3246762857111730123179522False
12170POLYGON ((176053.775 -464584.739, 176053.777 -...1485634259121730123179222False
13170POLYGON ((176068.527 -465823.921, 176068.537 -...797690437131730123178822False
14170POLYGON ((175997.767 -467784.889, 175997.533 -...2985254886141730123052922False
15170POLYGON ((175564.080 -467890.219, 175563.606 -...3337121648151730123052722False
16170POLYGON ((173784.416 -467841.455, 173785.048 -...1608597194161730123177922False
17170POLYGON ((171789.381 -467743.362, 171793.498 -...686165596171730123134677False
18170POLYGON ((171187.739 -467856.064, 171187.546 -...3092845517181730123167277False
19170POLYGON ((169935.539 -467879.393, 169923.522 -...3479053147191730123166777False
20170POLYGON ((168696.051 -467903.956, 168680.399 -...2645542972201730123166377True
21170POLYGON ((168037.524 -467916.250, 168037.372 -...3936942250211730123166277False
22170POLYGON ((167357.829 -467928.625, 167358.227 -...1939974416221730123005478False
23170POLYGON ((167281.629 -469235.162, 167281.182 -...7802714223173012303601010False
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id geometry \\\n", + "0 170 POLYGON ((175350.451 -454051.814, 175349.213 -... \n", + "1 170 POLYGON ((175836.936 -454587.721, 175836.959 -... \n", + "2 170 POLYGON ((175798.075 -455972.107, 175798.083 -... \n", + "3 170 POLYGON ((175827.602 -457076.012, 175827.610 -... \n", + "4 170 POLYGON ((175854.103 -458921.667, 175854.135 -... \n", + "5 170 POLYGON ((176737.013 -460049.998, 176737.342 -... \n", + "6 170 POLYGON ((177991.832 -460007.766, 178010.111 -... \n", + "7 170 POLYGON ((178396.327 -461576.519, 178395.927 -... \n", + "8 170 POLYGON ((178429.971 -462989.509, 178430.591 -... \n", + "9 170 POLYGON ((178152.046 -463095.761, 178090.699 -... \n", + "10 170 POLYGON ((175975.412 -463280.594, 175977.308 -... \n", + "11 170 POLYGON ((175919.561 -463405.079, 175916.534 -... \n", + "12 170 POLYGON ((176053.775 -464584.739, 176053.777 -... \n", + "13 170 POLYGON ((176068.527 -465823.921, 176068.537 -... \n", + "14 170 POLYGON ((175997.767 -467784.889, 175997.533 -... \n", + "15 170 POLYGON ((175564.080 -467890.219, 175563.606 -... \n", + "16 170 POLYGON ((173784.416 -467841.455, 173785.048 -... \n", + "17 170 POLYGON ((171789.381 -467743.362, 171793.498 -... \n", + "18 170 POLYGON ((171187.739 -467856.064, 171187.546 -... \n", + "19 170 POLYGON ((169935.539 -467879.393, 169923.522 -... \n", + "20 170 POLYGON ((168696.051 -467903.956, 168680.399 -... \n", + "21 170 POLYGON ((168037.524 -467916.250, 168037.372 -... \n", + "22 170 POLYGON ((167357.829 -467928.625, 167358.227 -... \n", + "23 170 POLYGON ((167281.629 -469235.162, 167281.182 -... \n", + "\n", + " hqta_segment_id segment_sequence shape_id stop_id am_max_trips \\\n", + "0 2631631551 0 1730123 4113 5 \n", + "1 3957109289 1 1730123 4116 3 \n", + "2 1926620051 2 1730123 4119 3 \n", + "3 97702661 3 1730123 3033 3 \n", + "4 2612414118 4 1730123 4124 3 \n", + "5 3971053104 5 1730123 1909 3 \n", + "6 1975003018 6 1730123 1902 2 \n", + "7 46077724 7 1730123 1569 3 \n", + "8 2449476237 8 1730123 1802 5 \n", + "9 3842456091 9 1730123 1272 4 \n", + "10 3062012927 10 1730123 1972 4 \n", + "11 3246762857 11 1730123 1795 2 \n", + "12 1485634259 12 1730123 1792 2 \n", + "13 797690437 13 1730123 1788 2 \n", + "14 2985254886 14 1730123 0529 2 \n", + "15 3337121648 15 1730123 0527 2 \n", + "16 1608597194 16 1730123 1779 2 \n", + "17 686165596 17 1730123 1346 7 \n", + "18 3092845517 18 1730123 1672 7 \n", + "19 3479053147 19 1730123 1667 7 \n", + "20 2645542972 20 1730123 1663 7 \n", + "21 3936942250 21 1730123 1662 7 \n", + "22 1939974416 22 1730123 0054 7 \n", + "23 78027142 23 1730123 0360 10 \n", + "\n", + " pm_max_trips hq_transit_corr \n", + "0 5 True \n", + "1 2 False \n", + "2 2 False \n", + "3 2 False \n", + "4 2 False \n", + "5 3 False \n", + "6 2 False \n", + "7 3 False \n", + "8 5 False \n", + "9 3 False \n", + "10 3 False \n", + "11 2 False \n", + "12 2 False \n", + "13 2 False \n", + "14 2 False \n", + "15 2 False \n", + "16 2 False \n", + "17 7 False \n", + "18 7 False \n", + "19 7 False \n", + "20 7 True \n", + "21 7 False \n", + "22 8 False \n", + "23 10 False " + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "lbt_hqta = single_operator_hqta(300)" + "lbt_hqta >> filter(_.shape_id == '1730123')" ] }, { diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 512cd65f8..706376a07 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", "metadata": { "tags": [] @@ -14,10 +14,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -68,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", "metadata": {}, "outputs": [], @@ -87,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], @@ -131,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", "metadata": { "tags": [] @@ -149,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", "metadata": {}, "outputs": [], @@ -162,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", "metadata": {}, "outputs": [], @@ -176,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", "metadata": {}, "outputs": [], @@ -190,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], @@ -200,7 +209,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, "outputs": [], @@ -222,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], @@ -236,7 +245,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -246,7 +255,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -263,7 +272,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -273,7 +282,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -283,7 +292,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -296,7 +305,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -306,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -316,7 +325,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -329,7 +338,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -339,7 +348,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -357,7 +366,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -370,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -382,7 +391,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -400,7 +409,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -414,17 +423,198 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometry
0100340000237.797908-121.2636642POINT (-111116.950 -23544.700)
1100340000137.957058-121.2789482POINT (-112222.169 -5836.078)
2100340000337.696468-121.4338692POINT (-126252.943 -34607.238)
31003400004.337.657549-121.8829622POINT (-165877.168 -38241.179)
41003400004.137.697081-121.7176482POINT (-151236.096 -34123.815)
........................
28410248354937.872939-122.4554464POINT (-215679.403 -13151.168)
29410248356937.856636-122.4782754POINT (-217731.552 -14910.728)
31338081872937.770840-122.3857914POINT (-209847.993 -24653.833)
32338081873337.864540-122.3139324POINT (-203274.531 -14397.269)
33338081872737.797482-122.3950254POINT (-210585.228 -21672.628)
\n", + "

1324 rows × 7 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "0 10 0 3400002 37.797908 -121.263664 \n", + "1 10 0 3400001 37.957058 -121.278948 \n", + "2 10 0 3400003 37.696468 -121.433869 \n", + "3 10 0 3400004.3 37.657549 -121.882962 \n", + "4 10 0 3400004.1 37.697081 -121.717648 \n", + ".. ... ... ... ... ... \n", + "28 41 0 2483549 37.872939 -122.455446 \n", + "29 41 0 2483569 37.856636 -122.478275 \n", + "31 338 0 818729 37.770840 -122.385791 \n", + "32 338 0 818733 37.864540 -122.313932 \n", + "33 338 0 818727 37.797482 -122.395025 \n", + "\n", + " route_type geometry \n", + "0 2 POINT (-111116.950 -23544.700) \n", + "1 2 POINT (-112222.169 -5836.078) \n", + "2 2 POINT (-126252.943 -34607.238) \n", + "3 2 POINT (-165877.168 -38241.179) \n", + "4 2 POINT (-151236.096 -34123.815) \n", + ".. ... ... \n", + "28 4 POINT (-215679.403 -13151.168) \n", + "29 4 POINT (-217731.552 -14910.728) \n", + "31 4 POINT (-209847.993 -24653.833) \n", + "32 4 POINT (-203274.531 -14397.269) \n", + "33 4 POINT (-210585.228 -21672.628) \n", + "\n", + "[1324 rows x 7 columns]" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "rail_brt_ferry" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", "metadata": {}, "outputs": [], @@ -434,7 +624,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "b4d279ae-5283-47e6-b503-f01738f7672a", "metadata": {}, "outputs": [], @@ -445,7 +635,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 29, "id": "c76728cc-b293-4f57-8002-3efa845a1dad", "metadata": { "tags": [] @@ -457,7 +647,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 30, "id": "0174ddab-347c-47d2-b824-98e360719b94", "metadata": {}, "outputs": [], @@ -465,12 +655,12 @@ "## after this cell displays output the notebook refuses to save...\n", "## File Save Error for rail_ferry_brt.ipynb\n", "## Invalid response: 413 Request Entity Too Large\n", - "ca_shape['geometry'].iloc[0]" + "# ca_shape['geometry'].iloc[0]" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 31, "id": "8b7beb5f-2128-4482-9648-abdfcc8e0001", "metadata": {}, "outputs": [], @@ -480,7 +670,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 32, "id": "fa029d00-acac-4242-9048-d8024e70f914", "metadata": {}, "outputs": [], @@ -490,10 +680,24 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 33, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], "source": [ "geoparquet_gcs_export(rail_brt_ferry, 'rail_brt_ferry')" ] From 25f6b6c814bb6993680ab8bef974c5dca107d21e Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Thu, 9 Dec 2021 00:50:07 +0000 Subject: [PATCH 18/24] more lbt investigation --- .../bus_corridors.ipynb | 1216 ++++++++++++++++- 1 file changed, 1181 insertions(+), 35 deletions(-) diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 21a0736e3..cf7bf6411 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -330,7 +330,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 61, "id": "0d3207be-d38f-4f17-a97f-0f84cae25d77", "metadata": {}, "outputs": [], @@ -447,6 +447,7 @@ " segment_peak_service['next_seg_hqta'] = segment_peak_service['hq_transit_corr'].shift(-1)\n", " \n", " ## consider segment not HQTA if both the prior and next segements are not HQTAs\n", + " debug_dict[f'{shape_id}_sps'] = segments_with_max_stop >> inner_join(_, segment_peak_service, on = 'hqta_segment_id')\n", " segment_peak_service['hq_transit_corr'] = segment_peak_service.apply(\n", " lambda x: False if x.hq_transit_corr == False else x.last_seg_hqta or x.next_seg_hqta, axis = 1)\n", " segment_peak_service['hq_transit_corr'] = segment_peak_service['hq_transit_corr'].fillna(True)\n", @@ -513,12 +514,12 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 47, "id": "e9d94df4-21cd-46d6-a8ab-fe4d4c01d728", "metadata": {}, "outputs": [], "source": [ - "debug_ids = ['940143']" + "debug_ids = ['940143', '1730123']" ] }, { @@ -547,9 +548,13 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 62, "id": "f6c92a46-4a65-4a0f-9bbc-a9d9050417d0", "metadata": { + "collapsed": true, + "jupyter": { + "outputs_hidden": true + }, "tags": [] }, "outputs": [ @@ -571,6 +576,7 @@ "calculating for shape_id 1920161\n", "calculating for shape_id 1920167\n", "calculating for shape_id 1730123\n", + "***debug shape*** 1730123\n", "calculating for shape_id 1910292\n", "calculating for shape_id 1910295\n", "calculating for shape_id 1730122\n", @@ -723,7 +729,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 63, "id": "2ab838e9-ba14-4057-a0ab-9e6401e83f16", "metadata": {}, "outputs": [ @@ -940,7 +946,7 @@ "[383 rows x 9 columns]" ] }, - "execution_count": 33, + "execution_count": 63, "metadata": {}, "output_type": "execute_result" } @@ -951,7 +957,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 64, "id": "c5fcee96-a46e-4d56-afe3-717d7841945d", "metadata": {}, "outputs": [ @@ -1015,7 +1021,7 @@ "3 6 True " ] }, - "execution_count": 36, + "execution_count": 64, "metadata": {}, "output_type": "execute_result" } @@ -1026,7 +1032,7 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": 65, "id": "1d258bdf-1164-4036-a16f-c7f942711c3f", "metadata": {}, "outputs": [ @@ -1059,7 +1065,7 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": 66, "id": "8c170b28-4de1-4ac1-b265-920ec3a976b4", "metadata": {}, "outputs": [ @@ -1077,7 +1083,7 @@ " dtype=object)" ] }, - "execution_count": 43, + "execution_count": 66, "metadata": {}, "output_type": "execute_result" } @@ -1088,39 +1094,24 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 67, "id": "f03f090c-2508-46a4-b705-18df2c015186", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "5cc25219c19c41b6b83610ca0d0397f2", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[33.77270983724983, -118.1893899136652], controls=(ZoomControl(options=['position', 'zoom_in_text',…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ - "map_hqta(lbt_hqta, 'hqta_segment_id')" + "# map_hqta(lbt_hqta, 'hqta_segment_id')" ] }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 68, "id": "c19aba0b-b265-4cfe-8e76-0fca0447acda", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "e9ed295d930b409c8063ff3abea43ad6", + "model_id": "9d4124fffa3849d38d4e43275c918518", "version_major": 2, "version_minor": 0 }, @@ -1133,12 +1124,12 @@ } ], "source": [ - "map_hqta(lbt_hqta >> filter(_.shape_id == '1730123'))" + "map_hqta(lbt_hqta >> filter(_.shape_id == '1730123'), 'stop_id')" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 69, "id": "4e62a18b-a65f-4027-87f2-7da1227a4d3b", "metadata": {}, "outputs": [], @@ -1148,7 +1139,7 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": 70, "id": "970b2cb6-7511-44be-bfb1-4d1c1d1bfe2b", "metadata": {}, "outputs": [ @@ -1557,7 +1548,7 @@ "23 10 False " ] }, - "execution_count": 45, + "execution_count": 70, "metadata": {}, "output_type": "execute_result" } @@ -1566,6 +1557,1161 @@ "lbt_hqta >> filter(_.shape_id == '1730123')" ] }, + { + "cell_type": "code", + "execution_count": 72, + "id": "144e0093-693f-4fa3-b1f4-849f763a9f28", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexcalitp_itp_idshape_idcalitp_extracted_atgeometrysegment_sequencehqta_segment_idstop_idn_tripsam_max_tripspm_max_tripshq_transit_corrlast_seg_hqtanext_seg_hqta
0017017301232021-10-06POLYGON ((175350.451 -454051.814, 175349.213 -...0263163155141136955TrueFalseTrue
1017017301232021-10-06POLYGON ((175836.936 -454587.721, 175836.959 -...1395710928941163532FalseTrueFalse
2017017301232021-10-06POLYGON ((175798.075 -455972.107, 175798.083 -...2192662005141193532FalseFalseTrue
3017017301232021-10-06POLYGON ((175827.602 -457076.012, 175827.610 -...39770266130333532FalseTrueTrue
4017017301232021-10-06POLYGON ((175854.103 -458921.667, 175854.135 -...4261241411841243532FalseTrueTrue
5017017301232021-10-06POLYGON ((176737.013 -460049.998, 176737.342 -...5397105310419093433FalseFalseNaN
6017017301232021-10-06POLYGON ((177991.832 -460007.766, 178010.111 -...6197500301819023122FalseTrueTrue
7017017301232021-10-06POLYGON ((178396.327 -461576.519, 178395.927 -...74607772415693233FalseNaNTrue
8017017301232021-10-06POLYGON ((178429.971 -462989.509, 178430.591 -...8244947623718027255TrueFalseFalse
9017017301232021-10-06POLYGON ((178152.046 -463095.761, 178090.699 -...9384245609112724943FalseTrueTrue
10017017301232021-10-06POLYGON ((175975.412 -463280.594, 175977.308 -...10306201292719724943FalseFalseTrue
11017017301232021-10-06POLYGON ((175919.561 -463405.079, 175916.534 -...11324676285717953122FalseTrueFalse
12017017301232021-10-06POLYGON ((176053.775 -464584.739, 176053.777 -...12148563425917923122FalseFalseFalse
13017017301232021-10-06POLYGON ((176068.527 -465823.921, 176068.537 -...1379769043717883122FalseTrueFalse
14017017301232021-10-06POLYGON ((175997.767 -467784.889, 175997.533 -...14298525488605293122FalseTrueFalse
15017017301232021-10-06POLYGON ((175564.080 -467890.219, 175563.606 -...15333712164805273122FalseFalseTrue
16017017301232021-10-06POLYGON ((173784.416 -467841.455, 173785.048 -...16160859719417793122FalseFalseFalse
17017017301232021-10-06POLYGON ((171789.381 -467743.362, 171793.498 -...17686165596134611077TrueFalseFalse
18017017301232021-10-06POLYGON ((171187.739 -467856.064, 171187.546 -...183092845517167211077TrueFalseFalse
19017017301232021-10-06POLYGON ((169935.539 -467879.393, 169923.522 -...193479053147166711077TrueFalseFalse
20017017301232021-10-06POLYGON ((168696.051 -467903.956, 168680.399 -...202645542972166311077TrueTrueFalse
21017017301232021-10-06POLYGON ((168037.524 -467916.250, 168037.372 -...213936942250166211077TrueFalseFalse
22017017301232021-10-06POLYGON ((167357.829 -467928.625, 167358.227 -...221939974416005411078TrueFalseFalse
23017017301232021-10-06POLYGON ((167281.629 -469235.162, 167281.182 -...237802714203601521010TrueFalseFalse
\n", + "
" + ], + "text/plain": [ + " index calitp_itp_id shape_id calitp_extracted_at \\\n", + "0 0 170 1730123 2021-10-06 \n", + "1 0 170 1730123 2021-10-06 \n", + "2 0 170 1730123 2021-10-06 \n", + "3 0 170 1730123 2021-10-06 \n", + "4 0 170 1730123 2021-10-06 \n", + "5 0 170 1730123 2021-10-06 \n", + "6 0 170 1730123 2021-10-06 \n", + "7 0 170 1730123 2021-10-06 \n", + "8 0 170 1730123 2021-10-06 \n", + "9 0 170 1730123 2021-10-06 \n", + "10 0 170 1730123 2021-10-06 \n", + "11 0 170 1730123 2021-10-06 \n", + "12 0 170 1730123 2021-10-06 \n", + "13 0 170 1730123 2021-10-06 \n", + "14 0 170 1730123 2021-10-06 \n", + "15 0 170 1730123 2021-10-06 \n", + "16 0 170 1730123 2021-10-06 \n", + "17 0 170 1730123 2021-10-06 \n", + "18 0 170 1730123 2021-10-06 \n", + "19 0 170 1730123 2021-10-06 \n", + "20 0 170 1730123 2021-10-06 \n", + "21 0 170 1730123 2021-10-06 \n", + "22 0 170 1730123 2021-10-06 \n", + "23 0 170 1730123 2021-10-06 \n", + "\n", + " geometry segment_sequence \\\n", + "0 POLYGON ((175350.451 -454051.814, 175349.213 -... 0 \n", + "1 POLYGON ((175836.936 -454587.721, 175836.959 -... 1 \n", + "2 POLYGON ((175798.075 -455972.107, 175798.083 -... 2 \n", + "3 POLYGON ((175827.602 -457076.012, 175827.610 -... 3 \n", + "4 POLYGON ((175854.103 -458921.667, 175854.135 -... 4 \n", + "5 POLYGON ((176737.013 -460049.998, 176737.342 -... 5 \n", + "6 POLYGON ((177991.832 -460007.766, 178010.111 -... 6 \n", + "7 POLYGON ((178396.327 -461576.519, 178395.927 -... 7 \n", + "8 POLYGON ((178429.971 -462989.509, 178430.591 -... 8 \n", + "9 POLYGON ((178152.046 -463095.761, 178090.699 -... 9 \n", + "10 POLYGON ((175975.412 -463280.594, 175977.308 -... 10 \n", + "11 POLYGON ((175919.561 -463405.079, 175916.534 -... 11 \n", + "12 POLYGON ((176053.775 -464584.739, 176053.777 -... 12 \n", + "13 POLYGON ((176068.527 -465823.921, 176068.537 -... 13 \n", + "14 POLYGON ((175997.767 -467784.889, 175997.533 -... 14 \n", + "15 POLYGON ((175564.080 -467890.219, 175563.606 -... 15 \n", + "16 POLYGON ((173784.416 -467841.455, 173785.048 -... 16 \n", + "17 POLYGON ((171789.381 -467743.362, 171793.498 -... 17 \n", + "18 POLYGON ((171187.739 -467856.064, 171187.546 -... 18 \n", + "19 POLYGON ((169935.539 -467879.393, 169923.522 -... 19 \n", + "20 POLYGON ((168696.051 -467903.956, 168680.399 -... 20 \n", + "21 POLYGON ((168037.524 -467916.250, 168037.372 -... 21 \n", + "22 POLYGON ((167357.829 -467928.625, 167358.227 -... 22 \n", + "23 POLYGON ((167281.629 -469235.162, 167281.182 -... 23 \n", + "\n", + " hqta_segment_id stop_id n_trips am_max_trips pm_max_trips \\\n", + "0 2631631551 4113 69 5 5 \n", + "1 3957109289 4116 35 3 2 \n", + "2 1926620051 4119 35 3 2 \n", + "3 97702661 3033 35 3 2 \n", + "4 2612414118 4124 35 3 2 \n", + "5 3971053104 1909 34 3 3 \n", + "6 1975003018 1902 31 2 2 \n", + "7 46077724 1569 32 3 3 \n", + "8 2449476237 1802 72 5 5 \n", + "9 3842456091 1272 49 4 3 \n", + "10 3062012927 1972 49 4 3 \n", + "11 3246762857 1795 31 2 2 \n", + "12 1485634259 1792 31 2 2 \n", + "13 797690437 1788 31 2 2 \n", + "14 2985254886 0529 31 2 2 \n", + "15 3337121648 0527 31 2 2 \n", + "16 1608597194 1779 31 2 2 \n", + "17 686165596 1346 110 7 7 \n", + "18 3092845517 1672 110 7 7 \n", + "19 3479053147 1667 110 7 7 \n", + "20 2645542972 1663 110 7 7 \n", + "21 3936942250 1662 110 7 7 \n", + "22 1939974416 0054 110 7 8 \n", + "23 78027142 0360 152 10 10 \n", + "\n", + " hq_transit_corr last_seg_hqta next_seg_hqta \n", + "0 True False True \n", + "1 False True False \n", + "2 False False True \n", + "3 False True True \n", + "4 False True True \n", + "5 False False NaN \n", + "6 False True True \n", + "7 False NaN True \n", + "8 True False False \n", + "9 False True True \n", + "10 False False True \n", + "11 False True False \n", + "12 False False False \n", + "13 False True False \n", + "14 False True False \n", + "15 False False True \n", + "16 False False False \n", + "17 True False False \n", + "18 True False False \n", + "19 True False False \n", + "20 True True False \n", + "21 True False False \n", + "22 True False False \n", + "23 True False False " + ] + }, + "execution_count": 72, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sps = debug_dict['1730123_sps']\n", + "sps" + ] + }, + { + "cell_type": "code", + "execution_count": 73, + "id": "aa772241-9e43-47eb-b2a2-5e9c727cc46c", + "metadata": {}, + "outputs": [], + "source": [ + "sps['hq_transit_corr'] = sps.apply(\n", + " lambda x: False if x.hq_transit_corr == False else x.last_seg_hqta or x.next_seg_hqta, axis = 1)\n", + "sps['hq_transit_corr'] = sps['hq_transit_corr'].fillna(True)" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "id": "efbd4c3b-77f8-4385-b00d-993beb00057f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
indexcalitp_itp_idshape_idcalitp_extracted_atgeometrysegment_sequencehqta_segment_idstop_idn_tripsam_max_tripspm_max_tripshq_transit_corrlast_seg_hqtanext_seg_hqta
0017017301232021-10-06POLYGON ((175350.451 -454051.814, 175349.213 -...0263163155141136955TrueFalseTrue
1017017301232021-10-06POLYGON ((175836.936 -454587.721, 175836.959 -...1395710928941163532FalseTrueFalse
2017017301232021-10-06POLYGON ((175798.075 -455972.107, 175798.083 -...2192662005141193532FalseFalseTrue
3017017301232021-10-06POLYGON ((175827.602 -457076.012, 175827.610 -...39770266130333532FalseTrueTrue
4017017301232021-10-06POLYGON ((175854.103 -458921.667, 175854.135 -...4261241411841243532FalseTrueTrue
5017017301232021-10-06POLYGON ((176737.013 -460049.998, 176737.342 -...5397105310419093433FalseFalseNaN
6017017301232021-10-06POLYGON ((177991.832 -460007.766, 178010.111 -...6197500301819023122FalseTrueTrue
7017017301232021-10-06POLYGON ((178396.327 -461576.519, 178395.927 -...74607772415693233FalseNaNTrue
8017017301232021-10-06POLYGON ((178429.971 -462989.509, 178430.591 -...8244947623718027255FalseFalseFalse
9017017301232021-10-06POLYGON ((178152.046 -463095.761, 178090.699 -...9384245609112724943FalseTrueTrue
10017017301232021-10-06POLYGON ((175975.412 -463280.594, 175977.308 -...10306201292719724943FalseFalseTrue
11017017301232021-10-06POLYGON ((175919.561 -463405.079, 175916.534 -...11324676285717953122FalseTrueFalse
12017017301232021-10-06POLYGON ((176053.775 -464584.739, 176053.777 -...12148563425917923122FalseFalseFalse
13017017301232021-10-06POLYGON ((176068.527 -465823.921, 176068.537 -...1379769043717883122FalseTrueFalse
14017017301232021-10-06POLYGON ((175997.767 -467784.889, 175997.533 -...14298525488605293122FalseTrueFalse
15017017301232021-10-06POLYGON ((175564.080 -467890.219, 175563.606 -...15333712164805273122FalseFalseTrue
16017017301232021-10-06POLYGON ((173784.416 -467841.455, 173785.048 -...16160859719417793122FalseFalseFalse
17017017301232021-10-06POLYGON ((171789.381 -467743.362, 171793.498 -...17686165596134611077FalseFalseFalse
18017017301232021-10-06POLYGON ((171187.739 -467856.064, 171187.546 -...183092845517167211077FalseFalseFalse
19017017301232021-10-06POLYGON ((169935.539 -467879.393, 169923.522 -...193479053147166711077FalseFalseFalse
20017017301232021-10-06POLYGON ((168696.051 -467903.956, 168680.399 -...202645542972166311077TrueTrueFalse
21017017301232021-10-06POLYGON ((168037.524 -467916.250, 168037.372 -...213936942250166211077FalseFalseFalse
22017017301232021-10-06POLYGON ((167357.829 -467928.625, 167358.227 -...221939974416005411078FalseFalseFalse
23017017301232021-10-06POLYGON ((167281.629 -469235.162, 167281.182 -...237802714203601521010FalseFalseFalse
\n", + "
" + ], + "text/plain": [ + " index calitp_itp_id shape_id calitp_extracted_at \\\n", + "0 0 170 1730123 2021-10-06 \n", + "1 0 170 1730123 2021-10-06 \n", + "2 0 170 1730123 2021-10-06 \n", + "3 0 170 1730123 2021-10-06 \n", + "4 0 170 1730123 2021-10-06 \n", + "5 0 170 1730123 2021-10-06 \n", + "6 0 170 1730123 2021-10-06 \n", + "7 0 170 1730123 2021-10-06 \n", + "8 0 170 1730123 2021-10-06 \n", + "9 0 170 1730123 2021-10-06 \n", + "10 0 170 1730123 2021-10-06 \n", + "11 0 170 1730123 2021-10-06 \n", + "12 0 170 1730123 2021-10-06 \n", + "13 0 170 1730123 2021-10-06 \n", + "14 0 170 1730123 2021-10-06 \n", + "15 0 170 1730123 2021-10-06 \n", + "16 0 170 1730123 2021-10-06 \n", + "17 0 170 1730123 2021-10-06 \n", + "18 0 170 1730123 2021-10-06 \n", + "19 0 170 1730123 2021-10-06 \n", + "20 0 170 1730123 2021-10-06 \n", + "21 0 170 1730123 2021-10-06 \n", + "22 0 170 1730123 2021-10-06 \n", + "23 0 170 1730123 2021-10-06 \n", + "\n", + " geometry segment_sequence \\\n", + "0 POLYGON ((175350.451 -454051.814, 175349.213 -... 0 \n", + "1 POLYGON ((175836.936 -454587.721, 175836.959 -... 1 \n", + "2 POLYGON ((175798.075 -455972.107, 175798.083 -... 2 \n", + "3 POLYGON ((175827.602 -457076.012, 175827.610 -... 3 \n", + "4 POLYGON ((175854.103 -458921.667, 175854.135 -... 4 \n", + "5 POLYGON ((176737.013 -460049.998, 176737.342 -... 5 \n", + "6 POLYGON ((177991.832 -460007.766, 178010.111 -... 6 \n", + "7 POLYGON ((178396.327 -461576.519, 178395.927 -... 7 \n", + "8 POLYGON ((178429.971 -462989.509, 178430.591 -... 8 \n", + "9 POLYGON ((178152.046 -463095.761, 178090.699 -... 9 \n", + "10 POLYGON ((175975.412 -463280.594, 175977.308 -... 10 \n", + "11 POLYGON ((175919.561 -463405.079, 175916.534 -... 11 \n", + "12 POLYGON ((176053.775 -464584.739, 176053.777 -... 12 \n", + "13 POLYGON ((176068.527 -465823.921, 176068.537 -... 13 \n", + "14 POLYGON ((175997.767 -467784.889, 175997.533 -... 14 \n", + "15 POLYGON ((175564.080 -467890.219, 175563.606 -... 15 \n", + "16 POLYGON ((173784.416 -467841.455, 173785.048 -... 16 \n", + "17 POLYGON ((171789.381 -467743.362, 171793.498 -... 17 \n", + "18 POLYGON ((171187.739 -467856.064, 171187.546 -... 18 \n", + "19 POLYGON ((169935.539 -467879.393, 169923.522 -... 19 \n", + "20 POLYGON ((168696.051 -467903.956, 168680.399 -... 20 \n", + "21 POLYGON ((168037.524 -467916.250, 168037.372 -... 21 \n", + "22 POLYGON ((167357.829 -467928.625, 167358.227 -... 22 \n", + "23 POLYGON ((167281.629 -469235.162, 167281.182 -... 23 \n", + "\n", + " hqta_segment_id stop_id n_trips am_max_trips pm_max_trips \\\n", + "0 2631631551 4113 69 5 5 \n", + "1 3957109289 4116 35 3 2 \n", + "2 1926620051 4119 35 3 2 \n", + "3 97702661 3033 35 3 2 \n", + "4 2612414118 4124 35 3 2 \n", + "5 3971053104 1909 34 3 3 \n", + "6 1975003018 1902 31 2 2 \n", + "7 46077724 1569 32 3 3 \n", + "8 2449476237 1802 72 5 5 \n", + "9 3842456091 1272 49 4 3 \n", + "10 3062012927 1972 49 4 3 \n", + "11 3246762857 1795 31 2 2 \n", + "12 1485634259 1792 31 2 2 \n", + "13 797690437 1788 31 2 2 \n", + "14 2985254886 0529 31 2 2 \n", + "15 3337121648 0527 31 2 2 \n", + "16 1608597194 1779 31 2 2 \n", + "17 686165596 1346 110 7 7 \n", + "18 3092845517 1672 110 7 7 \n", + "19 3479053147 1667 110 7 7 \n", + "20 2645542972 1663 110 7 7 \n", + "21 3936942250 1662 110 7 7 \n", + "22 1939974416 0054 110 7 8 \n", + "23 78027142 0360 152 10 10 \n", + "\n", + " hq_transit_corr last_seg_hqta next_seg_hqta \n", + "0 True False True \n", + "1 False True False \n", + "2 False False True \n", + "3 False True True \n", + "4 False True True \n", + "5 False False NaN \n", + "6 False True True \n", + "7 False NaN True \n", + "8 False False False \n", + "9 False True True \n", + "10 False False True \n", + "11 False True False \n", + "12 False False False \n", + "13 False True False \n", + "14 False True False \n", + "15 False False True \n", + "16 False False False \n", + "17 False False False \n", + "18 False False False \n", + "19 False False False \n", + "20 True True False \n", + "21 False False False \n", + "22 False False False \n", + "23 False False False " + ] + }, + "execution_count": 74, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "sps" + ] + }, { "cell_type": "markdown", "id": "b37c7411-8ea1-48c2-b42a-b437cdef7eaa", From 17853c02a8a25f807dd805a9698a8ee8d7d39f46 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Fri, 10 Dec 2021 00:16:17 +0000 Subject: [PATCH 19/24] interim export for opr --- .../combine_and_visualize.ipynb | 2125 +++++++++++++---- 1 file changed, 1671 insertions(+), 454 deletions(-) diff --git a/high_quality_transit_areas/combine_and_visualize.ipynb b/high_quality_transit_areas/combine_and_visualize.ipynb index 19ba79e8b..28abca3d7 100644 --- a/high_quality_transit_areas/combine_and_visualize.ipynb +++ b/high_quality_transit_areas/combine_and_visualize.ipynb @@ -2,110 +2,22 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "7f9e615b-d071-4728-b774-1d02f509c332", "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - }, "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Requirement already satisfied: geopandas in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 1)) (0.10.2)\n", - "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", - "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", - "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", - "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", - "Requirement already satisfied: numpy>=1.13 in /opt/conda/lib/python3.9/site-packages (from pygeos->-r requirements.txt (line 2)) (1.20.3)\n", - "Requirement already satisfied: traittypes<3,>=0.2.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (0.2.1)\n", - "Requirement already satisfied: xyzservices>=2021.8.1 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (2021.11.0)\n", - "Requirement already satisfied: ipywidgets<8,>=7.6.0 in /opt/conda/lib/python3.9/site-packages (from ipyleaflet->-r requirements.txt (line 3)) (7.6.5)\n", - "Requirement already satisfied: click-plugins>=1.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.1.1)\n", - "Requirement already satisfied: six>=1.7 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (1.16.0)\n", - "Requirement already satisfied: certifi in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2021.10.8)\n", - "Requirement already satisfied: setuptools in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (59.1.1)\n", - "Requirement already satisfied: munch in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (2.5.0)\n", - "Requirement already satisfied: attrs>=17 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (21.2.0)\n", - "Requirement already satisfied: click>=4.0 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (8.0.3)\n", - "Requirement already satisfied: cligj>=0.5 in /opt/conda/lib/python3.9/site-packages (from fiona>=1.8->geopandas->-r requirements.txt (line 1)) (0.7.2)\n", - "Requirement already satisfied: widgetsnbextension~=3.5.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.5.2)\n", - "Requirement already satisfied: ipython-genutils~=0.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: ipython>=4.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.29.0)\n", - "Requirement already satisfied: traitlets>=4.3.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.1)\n", - "Requirement already satisfied: ipykernel>=4.5.1 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.5.0)\n", - "Requirement already satisfied: jupyterlab-widgets>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.0.2)\n", - "Requirement already satisfied: nbformat>=4.2.0 in /opt/conda/lib/python3.9/site-packages (from ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.3)\n", - "Requirement already satisfied: python-dateutil>=2.7.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2.8.2)\n", - "Requirement already satisfied: pytz>=2017.3 in /opt/conda/lib/python3.9/site-packages (from pandas>=0.25.0->geopandas->-r requirements.txt (line 1)) (2021.3)\n", - "Requirement already satisfied: jupyter-client<8.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (7.0.6)\n", - "Requirement already satisfied: tornado<7.0,>=4.2 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.1)\n", - "Requirement already satisfied: matplotlib-inline<0.2.0,>=0.1.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.3)\n", - "Requirement already satisfied: debugpy<2.0,>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: pickleshare in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.5)\n", - "Requirement already satisfied: decorator in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (5.1.0)\n", - "Requirement already satisfied: pexpect>4.3 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.8.0)\n", - "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", - "Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.22)\n", - "Requirement already satisfied: jedi>=0.16 in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: pygments in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.10.0)\n", - "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", - "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", - "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", - "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", - "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", - "Requirement already satisfied: nest-asyncio>=1.5 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.1)\n", - "Requirement already satisfied: pyzmq>=13 in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (22.3.0)\n", - "Requirement already satisfied: entrypoints in /opt/conda/lib/python3.9/site-packages (from jupyter-client<8.0->ipykernel>=4.5.1->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.3)\n", - "Requirement already satisfied: jinja2 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (3.0.3)\n", - "Requirement already satisfied: terminado>=0.8.3 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.1)\n", - "Requirement already satisfied: nbconvert in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.3.0)\n", - "Requirement already satisfied: prometheus-client in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.12.0)\n", - "Requirement already satisfied: Send2Trash>=1.5.0 in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.8.0)\n", - "Requirement already satisfied: argon2-cffi in /opt/conda/lib/python3.9/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.1.0)\n", - "Requirement already satisfied: ptyprocess>=0.5 in /opt/conda/lib/python3.9/site-packages (from pexpect>4.3->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.0)\n", - "Requirement already satisfied: wcwidth in /opt/conda/lib/python3.9/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.5)\n", - "Requirement already satisfied: cffi>=1.0.0 in /opt/conda/lib/python3.9/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.15.0)\n", - "Requirement already satisfied: MarkupSafe>=2.0 in /opt/conda/lib/python3.9/site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.0.1)\n", - "Requirement already satisfied: testpath in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.0)\n", - "Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.8)\n", - "Requirement already satisfied: mistune<2,>=0.8.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.4)\n", - "Requirement already satisfied: jupyterlab-pygments in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.1.2)\n", - "Requirement already satisfied: bleach in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.1.0)\n", - "Requirement already satisfied: defusedxml in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.7.1)\n", - "Requirement already satisfied: pandocfilters>=1.4.1 in /opt/conda/lib/python3.9/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (1.5.0)\n", - "Requirement already satisfied: pycparser in /opt/conda/lib/python3.9/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.21)\n", - "Requirement already satisfied: packaging in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (21.2)\n", - "Requirement already satisfied: webencodings in /opt/conda/lib/python3.9/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.5.1)\n", - "Requirement already satisfied: pyparsing<3,>=2.0.2 in /opt/conda/lib/python3.9/site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (2.4.7)\n" - ] - } - ], + "outputs": [], "source": [ - "!pip install -r requirements.txt" + "# !pip install -r requirements.txt" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 162, "id": "4d53c57e-0777-4c0d-9dc6-4954c95ed307", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -125,19 +37,20 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 163, "id": "e31ad027-1acc-44f8-bdd6-31f1b9b36a77", "metadata": {}, "outputs": [], "source": [ "bus_hqtc = gpd.read_parquet(f'{GCS_FILE_PATH}shape_hqta_dissolve.parquet')\n", "bus_hqtc = bus_hqtc[bus_hqtc['hq_transit_corr']]\n", - "bus_hqtc['hqta_type'] = 'hq_transit_corr'" + "bus_hqtc['hqta_type'] = 'hq_transit_corr'\n", + "bus_hqtc['route_type'] = '3'" ] }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 164, "id": "bcbea24e-ab7e-400a-8813-6a477471c1d6", "metadata": {}, "outputs": [], @@ -148,23 +61,19 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 165, "id": "6aec4721-0827-40f3-be60-0790916b0385", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "Index(['stop_id', 'calitp_itp_id', 'stop_lat', 'stop_lon', 'itp_id_stop_id',\n", - " 'itp_id_trip_id', 'route_id', 'itp_id_route_id', 'trip_id', 'geometry',\n", - " 'calitp_url_number', 'route_type', 'agency_id', 'route_short_name',\n", - " 'route_long_name', 'route_desc', 'route_url', 'route_color',\n", - " 'route_text_color', 'route_sort_order', 'continuous_pickup',\n", - " 'continuous_drop_off', 'calitp_extracted_at', 'hqta_type'],\n", + "Index(['calitp_itp_id', 'calitp_url_number', 'stop_id', 'stop_lat', 'stop_lon',\n", + " 'route_type', 'geometry', 'hqta_type'],\n", " dtype='object')" ] }, - "execution_count": 7, + "execution_count": 165, "metadata": {}, "output_type": "execute_result" } @@ -175,7 +84,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 166, "id": "0e807584-dfb2-4385-b274-7276b0bc38d0", "metadata": { "tags": [] @@ -187,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 167, "id": "3b9a9f5e-6371-4367-978c-c0be0e6d979f", "metadata": { "tags": [] @@ -237,7 +146,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 168, "id": "441de95c-34c4-46bd-a95c-bfa0fd0338ea", "metadata": {}, "outputs": [ @@ -272,6 +181,7 @@ " am_max_trips\n", " pm_max_trips\n", " hqta_type\n", + " route_type\n", " \n", " \n", " \n", @@ -287,6 +197,7 @@ " 7.0\n", " 8.0\n", " hq_transit_corr\n", + " 3\n", " \n", " \n", " 2257\n", @@ -300,6 +211,7 @@ " 5.0\n", " 7.0\n", " hq_transit_corr\n", + " 3\n", " \n", " \n", " 2258\n", @@ -313,6 +225,7 @@ " 5.0\n", " 6.0\n", " hq_transit_corr\n", + " 3\n", " \n", " \n", "\n", @@ -334,13 +247,13 @@ "2257 4126984225 1 4654 \n", "2258 1555422069 0 6679 \n", "\n", - " am_max_trips pm_max_trips hqta_type \n", - "2256 7.0 8.0 hq_transit_corr \n", - "2257 5.0 7.0 hq_transit_corr \n", - "2258 5.0 6.0 hq_transit_corr " + " am_max_trips pm_max_trips hqta_type route_type \n", + "2256 7.0 8.0 hq_transit_corr 3 \n", + "2257 5.0 7.0 hq_transit_corr 3 \n", + "2258 5.0 6.0 hq_transit_corr 3 " ] }, - "execution_count": 8, + "execution_count": 168, "metadata": {}, "output_type": "execute_result" } @@ -351,7 +264,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 169, "id": "f104e680-a949-4e07-a4dd-19950207c66f", "metadata": {}, "outputs": [], @@ -373,7 +286,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 170, "id": "96caf70f-e497-4df4-9b1a-20b54f7b7f83", "metadata": {}, "outputs": [], @@ -383,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 171, "id": "cdb9023e-8397-4eed-b829-0ab22ee26580", "metadata": {}, "outputs": [], @@ -393,7 +306,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 172, "id": "a54925c8-cb64-452f-b8ac-18407ed3f9d6", "metadata": {}, "outputs": [], @@ -403,17 +316,17 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 173, "id": "c3f748fa-861d-4d7c-b005-480d6ecc30a2", "metadata": {}, "outputs": [], "source": [ - "major_bus = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops_working.parquet')" + "# major_bus = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops_working.parquet')" ] }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 174, "id": "ca09eb4e-97b4-48b6-ba21-542ac35c8ceb", "metadata": {}, "outputs": [], @@ -432,17 +345,17 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 175, "id": "82e5d819-63dc-4ba3-a9f9-c314f5a4ca33", "metadata": {}, "outputs": [], "source": [ - "major_bus['geometry'] = major_bus.geometry.apply(drop_big_areas)" + "# major_bus['geometry'] = major_bus.geometry.apply(drop_big_areas)" ] }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 176, "id": "6273ed98-b5a2-4e83-bfac-9f487f8c6142", "metadata": {}, "outputs": [], @@ -463,21 +376,59 @@ }, { "cell_type": "code", - "execution_count": 29, - "id": "c35ed21e-d6e0-42cf-8bd5-e4792d5d3c14", + "execution_count": 177, + "id": "280f79d2-ed38-419d-be89-653167b1efec", "metadata": {}, "outputs": [], "source": [ - "major_bus = major_bus.dropna(subset=['geometry'])" + "# major_bus = major_bus.dropna(subset=['geometry'])\n", + "\n", + "# major_bus.apply(explode_geoms, axis=1)\n", + "\n", + "# row_per_stop = row_per_stop.reset_index(drop=True)\n", + "\n", + "# row_per_stop = row_per_stop[['calitp_itp_id', 'stop_id', 'geometry']]\n", + "\n", + "# row_per_stop['hqta_type'] = 'major_transit_stop'\n", + "\n", + "# row_per_stop = row_per_stop.set_crs('EPSG:6414')" ] }, { "cell_type": "code", - "execution_count": 30, - "id": "2df43e17-9ca0-4c46-b6a1-92d77ec98d3a", - "metadata": { - "tags": [] - }, + "execution_count": 178, + "id": "d01200cc-cda2-4635-af68-3b8448e70b5a", + "metadata": {}, + "outputs": [], + "source": [ + "# row_per_stop.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 179, + "id": "5bbfaa07-f16c-46a9-ae5e-338a5b7f5d8b", + "metadata": {}, + "outputs": [], + "source": [ + "# geoparquet_gcs_export(row_per_stop, 'major_bus_stops')" + ] + }, + { + "cell_type": "code", + "execution_count": 180, + "id": "87dbcdc7-79f0-48e4-91d4-647cdb087cf5", + "metadata": {}, + "outputs": [], + "source": [ + "major_bus_stops = gpd.read_parquet(f'{GCS_FILE_PATH}major_bus_stops.parquet')" + ] + }, + { + "cell_type": "code", + "execution_count": 181, + "id": "e3e8c306-a89f-438f-8f0e-5e165e257cb6", + "metadata": {}, "outputs": [ { "data": { @@ -500,287 +451,88 @@ " \n", " \n", " \n", - " hq_transit_corr\n", - " shape_id\n", - " geometry\n", - " level_0\n", " calitp_itp_id\n", - " hqta_segment_id\n", - " n_trips\n", - " segment_sequence\n", " stop_id\n", - " am_peak\n", - " pm_peak\n", + " geometry\n", " hqta_type\n", " \n", " \n", " \n", " \n", - " 2464\n", - " True\n", - " 0500\n", - " POINT (193061.249 -465491.440)\n", - " 0\n", + " 0\n", " 142\n", - " 2197551287\n", - " 134.0\n", - " 0\n", " 3977\n", - " 9.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2467\n", - " True\n", - " 100706_SEPT21\n", - " POINT (149243.534 -435856.085)\n", - " 0\n", - " 182\n", - " 2368710740\n", - " 120.0\n", - " 1\n", - " 16374\n", - " 6.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2468\n", - " True\n", - " 100708_SEPT21\n", - " POINT (159441.767 -444289.585)\n", - " 3\n", - " 182\n", - " 2883785450\n", - " 72.0\n", - " 3\n", - " 9785\n", - " 4.7\n", - " 4.7\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2471\n", - " True\n", - " 1020067_SEPT21\n", - " POINT (150511.825 -447354.169)\n", - " 3\n", - " 182\n", - " 2238923216\n", - " 115.0\n", - " 4\n", - " 11283\n", - " 8.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 2475\n", - " True\n", - " 103717\n", - " POINT (-178950.630 -71003.248)\n", - " 1\n", - " 294\n", - " 2280977661\n", - " 136.0\n", - " 3\n", - " 480\n", - " 7.0\n", - " 8.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " \n", - " \n", - " 3231\n", - " True\n", - " shp-73-01\n", - " POINT (-194726.607 -31504.765)\n", - " 0\n", - " 4\n", - " 1652690359\n", - " 220.0\n", - " 0\n", - " 3708\n", - " 9.3\n", - " 11.7\n", - " hq_transit_corr\n", - " \n", - " \n", - " 3232\n", - " True\n", - " shp-73-51\n", - " POINT (-194726.607 -31504.765)\n", - " 0\n", - " 4\n", - " 1682558812\n", - " 238.0\n", - " 0\n", - " 2712\n", - " 13.3\n", - " 10.0\n", - " hq_transit_corr\n", - " \n", - " \n", - " 3236\n", - " True\n", - " shp-88-07\n", - " POINT (-200443.266 -13810.682)\n", - " 1\n", - " 4\n", - " 3310950755\n", - " 83.0\n", - " 1\n", - " 2026\n", - " 4.7\n", - " 5.0\n", - " hq_transit_corr\n", + " POINT (199058.382 -471125.032)\n", + " major_transit_stop\n", " \n", " \n", - " 3238\n", - " True\n", - " shp-97-57\n", - " POINT (-187275.985 -33268.849)\n", - " 0\n", - " 4\n", - " 4254707562\n", - " 80.0\n", - " 0\n", - " 4320\n", - " 4.3\n", - " 4.7\n", - " hq_transit_corr\n", + " 1\n", + " 142\n", + " 3977\n", + " POINT (198531.592 -471368.189)\n", + " major_transit_stop\n", " \n", " \n", - " 3239\n", - " True\n", - " shp-99-08\n", - " POINT (-178261.436 -45851.507)\n", - " 0\n", - " 4\n", - " 3287994159\n", - " 142.0\n", - " 0\n", - " 6243\n", - " 7.7\n", - " 8.0\n", - " hq_transit_corr\n", + " 2\n", + " 142\n", + " 3977\n", + " POINT (193068.693 -465847.391)\n", + " major_transit_stop\n", " \n", " \n", "\n", - "

349 rows × 12 columns

\n", "" ], "text/plain": [ - " hq_transit_corr shape_id geometry \\\n", - "2464 True 0500 POINT (193061.249 -465491.440) \n", - "2467 True 100706_SEPT21 POINT (149243.534 -435856.085) \n", - "2468 True 100708_SEPT21 POINT (159441.767 -444289.585) \n", - "2471 True 1020067_SEPT21 POINT (150511.825 -447354.169) \n", - "2475 True 103717 POINT (-178950.630 -71003.248) \n", - "... ... ... ... \n", - "3231 True shp-73-01 POINT (-194726.607 -31504.765) \n", - "3232 True shp-73-51 POINT (-194726.607 -31504.765) \n", - "3236 True shp-88-07 POINT (-200443.266 -13810.682) \n", - "3238 True shp-97-57 POINT (-187275.985 -33268.849) \n", - "3239 True shp-99-08 POINT (-178261.436 -45851.507) \n", - "\n", - " level_0 calitp_itp_id hqta_segment_id n_trips segment_sequence \\\n", - "2464 0 142 2197551287 134.0 0 \n", - "2467 0 182 2368710740 120.0 1 \n", - "2468 3 182 2883785450 72.0 3 \n", - "2471 3 182 2238923216 115.0 4 \n", - "2475 1 294 2280977661 136.0 3 \n", - "... ... ... ... ... ... \n", - "3231 0 4 1652690359 220.0 0 \n", - "3232 0 4 1682558812 238.0 0 \n", - "3236 1 4 3310950755 83.0 1 \n", - "3238 0 4 4254707562 80.0 0 \n", - "3239 0 4 3287994159 142.0 0 \n", - "\n", - " stop_id am_peak pm_peak hqta_type \n", - "2464 3977 9.0 8.0 hq_transit_corr \n", - "2467 16374 6.0 8.0 hq_transit_corr \n", - "2468 9785 4.7 4.7 hq_transit_corr \n", - "2471 11283 8.0 8.0 hq_transit_corr \n", - "2475 480 7.0 8.0 hq_transit_corr \n", - "... ... ... ... ... \n", - "3231 3708 9.3 11.7 hq_transit_corr \n", - "3232 2712 13.3 10.0 hq_transit_corr \n", - "3236 2026 4.7 5.0 hq_transit_corr \n", - "3238 4320 4.3 4.7 hq_transit_corr \n", - "3239 6243 7.7 8.0 hq_transit_corr \n", - "\n", - "[349 rows x 12 columns]" + " calitp_itp_id stop_id geometry hqta_type\n", + "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop\n", + "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop\n", + "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop" ] }, - "execution_count": 30, + "execution_count": 181, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "major_bus.apply(explode_geoms, axis=1)" - ] - }, - { - "cell_type": "code", - "execution_count": 31, - "id": "6ab04e63-f673-48d4-bf1a-d01d203f5b33", - "metadata": {}, - "outputs": [], - "source": [ - "row_per_stop = row_per_stop.reset_index(drop=True)" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "id": "92d2df98-49d9-4786-bd53-df2ddc107354", - "metadata": {}, - "outputs": [], - "source": [ - "row_per_stop = row_per_stop[['calitp_itp_id', 'stop_id', 'geometry']]" + "major_bus_stops.head(3)" ] }, { "cell_type": "code", - "execution_count": 33, - "id": "faaa147d-ae1e-4b9b-a7a2-ff462a3c66fd", + "execution_count": 182, + "id": "24daf28c-943a-4a9f-871c-e11b5d761595", "metadata": {}, "outputs": [], "source": [ - "row_per_stop['hqta_type'] = 'major_transit_stop'" + "tbl_stops = (tbl.views.gtfs_schedule_fact_daily_feed_stops()\n", + " >> filter(_.date == '2021-12-01')\n", + " >> filter(_.calitp_extracted_at < '2021-12-01')\n", + " >> filter(_.calitp_deleted_at > '2021-12-01')\n", + " >> select(_.stop_key)\n", + " >> inner_join(_, tbl.views.gtfs_schedule_dim_stops(), on = 'stop_key')\n", + " >> select(_.stop_id, _.stop_lat, _.stop_lon, _.calitp_itp_id)\n", + " >> collect()\n", + ")" ] }, { "cell_type": "code", - "execution_count": 34, - "id": "3e574e12-8017-4867-9230-8fa891e914bb", + "execution_count": 183, + "id": "cddf70f5-cca1-4896-9f52-1ea5004278e5", "metadata": {}, "outputs": [], "source": [ - "row_per_stop = row_per_stop.set_crs('EPSG:6414')" + "tbl_stops = gpd.GeoDataFrame(tbl_stops,\n", + " geometry = gpd.points_from_xy(tbl_stops.stop_lon, tbl_stops.stop_lat),\n", + " crs = 'EPSG:4326').to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)" ] }, { "cell_type": "code", - "execution_count": 35, - "id": "d01200cc-cda2-4635-af68-3b8448e70b5a", + "execution_count": 184, + "id": "27ec75fc-e017-4f98-96f8-94d8d6ca479e", "metadata": {}, "outputs": [ { @@ -804,141 +556,1606 @@ " \n", " \n", " \n", - " calitp_itp_id\n", " stop_id\n", + " stop_lat\n", + " stop_lon\n", + " calitp_itp_id\n", " geometry\n", - " hqta_type\n", " \n", " \n", " \n", " \n", " 0\n", - " 142\n", - " 3977\n", - " POINT (199058.382 -471125.032)\n", - " major_transit_stop\n", + " 5090\n", + " 36.080261\n", + " -119.021684\n", + " 256\n", + " POINT (87996.619 -214744.271)\n", " \n", " \n", " 1\n", - " 142\n", - " 3977\n", - " POINT (198531.592 -471368.189)\n", - " major_transit_stop\n", + " 8050\n", + " 36.061094\n", + " -118.994880\n", + " 256\n", + " POINT (90430.048 -216848.624)\n", " \n", " \n", " 2\n", - " 142\n", - " 3977\n", - " POINT (193068.693 -465847.391)\n", - " major_transit_stop\n", + " 1100\n", + " 36.073048\n", + " -119.020918\n", + " 256\n", + " POINT (88073.792 -215544.973)\n", " \n", " \n", "\n", "" ], "text/plain": [ - " calitp_itp_id stop_id geometry hqta_type\n", - "0 142 3977 POINT (199058.382 -471125.032) major_transit_stop\n", - "1 142 3977 POINT (198531.592 -471368.189) major_transit_stop\n", - "2 142 3977 POINT (193068.693 -465847.391) major_transit_stop" + " stop_id stop_lat stop_lon calitp_itp_id geometry\n", + "0 5090 36.080261 -119.021684 256 POINT (87996.619 -214744.271)\n", + "1 8050 36.061094 -118.994880 256 POINT (90430.048 -216848.624)\n", + "2 1100 36.073048 -119.020918 256 POINT (88073.792 -215544.973)" ] }, - "execution_count": 35, + "execution_count": 184, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "row_per_stop.head(3)" - ] - }, - { - "cell_type": "code", - "execution_count": 36, - "id": "5bbfaa07-f16c-46a9-ae5e-338a5b7f5d8b", - "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], - "source": [ - "geoparquet_gcs_export(row_per_stop, 'major_bus_stops')" + "tbl_stops.head(3)" ] }, { "cell_type": "code", - "execution_count": 24, - "id": "dcccae17-5f35-4fc4-a5dc-0e5cf45e2f25", + "execution_count": 185, + "id": "d5a65203-2245-4ea4-94d3-71685a00c929", "metadata": {}, "outputs": [], "source": [ - "# major_bus_operators = [int(x) for x in list(major_bus.calitp_itp_id.astype(int).unique())]" + "to_join = major_bus_stops[['calitp_itp_id']].astype({'calitp_itp_id': 'int64'})" ] }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 186, "id": "19f9b7dd-1b2b-4c7a-9ba9-3e1e1e9b46be", "metadata": { "tags": [] }, "outputs": [], "source": [ - "# tbl_stops = (tbl.gtfs_schedule.stops() \n", - "# >> filter(_.calitp_itp_id.isin(major_bus_operators))\n", - "# >> select(_.stop_id, _.stop_lat, _.stop_lon, _.calitp_itp_id)\n", - "# >> collect()\n", - "# )\n", - "# tbl_stops = gpd.GeoDataFrame(tbl_stops,\n", - "# geometry = gpd.points_from_xy(tbl_stops.stop_lon, tbl_stops.stop_lat),\n", - "# crs = 'EPSG:4326').to_crs('EPSG:6414') ## https://epsg.io/6414 (meters)" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "7d959fef-e315-4985-b3fd-72192096a691", - "metadata": {}, - "outputs": [], - "source": [ - "# def join_stops(df):\n", - "# stops_filtered = tbl_stops >> filter(_.calitp_itp_id == int(df.calitp_itp_id.iloc[0]))\n", - "# df = row_per_stop.sjoin(stops_filtered, how='inner', predicate='contains')\n", - "# return df" + "tbl_stops_major = (tbl_stops\n", + " >> inner_join(_, to_join, on=['calitp_itp_id'])\n", + " >> distinct(_.calitp_itp_id, _.stop_id, _keep_all=True)\n", + " )\n" ] }, { "cell_type": "code", - "execution_count": 27, - "id": "909f1b0f-0d99-4713-90e5-cf86e7bcab1e", - "metadata": {}, - "outputs": [], - "source": [ - "# join_to_stop = row_per_stop.groupby('calitp_itp_id').apply(join_stops)" - ] - }, - { - "cell_type": "markdown", - "id": "f1ac0f78-6b99-4079-8c26-ca875367f6a8", + "execution_count": 187, + "id": "5410b54c-930f-4d88-982a-4275a90334d4", "metadata": {}, - "source": [ - "#### Definitions and Output:\n", - "\n", - "* hqta_type: major_transit_stop\n", - "* stop_id: one stop id... (not ideal, but oh well)\n", - "* geometry: .buffer(700)?\n", - "* _can alway pull more info spatially_" + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
0397137.976371-122.3196634POINT (-203473.763 -1956.750)
1205037.789595-122.2458004POINT (-197487.747 -22870.228)
2344537.767420-122.1963754POINT (-193199.376 -25436.510)
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id \\\n", + "0 3971 37.976371 -122.319663 4 \n", + "1 2050 37.789595 -122.245800 4 \n", + "2 3445 37.767420 -122.196375 4 \n", + "\n", + " geometry \n", + "0 POINT (-203473.763 -1956.750) \n", + "1 POINT (-197487.747 -22870.228) \n", + "2 POINT (-193199.376 -25436.510) " + ] + }, + "execution_count": 187, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tbl_stops_major.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 188, + "id": "9a9987a0-74c2-4018-99d6-bc68ecbb292a", + "metadata": {}, + "outputs": [], + "source": [ + "tbl_stops_major.geometry = tbl_stops_major.buffer(100)" + ] + }, + { + "cell_type": "code", + "execution_count": 189, + "id": "ee7ff27d-6ffc-4458-bd95-5aa5c8a9a57e", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
0397137.976371-122.3196634POLYGON ((-203373.763 -1956.750, -203374.244 -...
1205037.789595-122.2458004POLYGON ((-197387.747 -22870.228, -197388.229 ...
2344537.767420-122.1963754POLYGON ((-193099.376 -25436.510, -193099.857 ...
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id \\\n", + "0 3971 37.976371 -122.319663 4 \n", + "1 2050 37.789595 -122.245800 4 \n", + "2 3445 37.767420 -122.196375 4 \n", + "\n", + " geometry \n", + "0 POLYGON ((-203373.763 -1956.750, -203374.244 -... \n", + "1 POLYGON ((-197387.747 -22870.228, -197388.229 ... \n", + "2 POLYGON ((-193099.376 -25436.510, -193099.857 ... " + ] + }, + "execution_count": 189, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tbl_stops_major.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 190, + "id": "1ac15d0a-1aeb-48c4-9acf-92b7642b6fcd", + "metadata": {}, + "outputs": [], + "source": [ + "drop_id = major_bus_stops.drop(columns=['stop_id'])" + ] + }, + { + "cell_type": "code", + "execution_count": 191, + "id": "e1d0d729-4931-4020-bfd6-4c15818caff0", + "metadata": {}, + "outputs": [], + "source": [ + "spatial_stops_major = tbl_stops_major.sjoin(drop_id, how='inner', predicate='contains')" + ] + }, + { + "cell_type": "code", + "execution_count": 192, + "id": "b593d95a-308f-4635-9ce5-f24bbdd164e6", + "metadata": {}, + "outputs": [], + "source": [ + "new_major_stops = spatial_stops_major.drop_duplicates(subset=['stop_id', 'calitp_itp_id_left', 'calitp_itp_id_right'])" + ] + }, + { + "cell_type": "code", + "execution_count": 193, + "id": "46241013-0529-40c7-a8d9-3002637a4240", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/geodataframe.py:1351: SettingWithCopyWarning: \n", + "A value is trying to be set on a copy of a slice from a DataFrame.\n", + "Try using .loc[row_indexer,col_indexer] = value instead\n", + "\n", + "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", + " super().__setitem__(key, value)\n" + ] + } + ], + "source": [ + "new_major_stops.geometry = new_major_stops.centroid" + ] + }, + { + "cell_type": "code", + "execution_count": 194, + "id": "ed5c5734-7ede-4211-a61b-f22eec81686a", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(new_major_stops)" + ] + }, + { + "cell_type": "markdown", + "id": "99a33ab8-c664-4671-89ef-54cdff7462f2", + "metadata": {}, + "source": [ + "### Bus Corridors to Stops Along Corridor" + ] + }, + { + "cell_type": "code", + "execution_count": 195, + "id": "6943606a-d815-49c6-aa43-a7ab27285939", + "metadata": {}, + "outputs": [], + "source": [ + "tbl_stops_corridors = tbl_stops" + ] + }, + { + "cell_type": "code", + "execution_count": 196, + "id": "bf2f1177-b087-416c-8ae4-3f3f3569da55", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
0509036.080261-119.021684256POINT (87996.619 -214744.271)
1805036.061094-118.994880256POINT (90430.048 -216848.624)
2110036.073048-119.020918256POINT (88073.792 -215544.973)
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id geometry\n", + "0 5090 36.080261 -119.021684 256 POINT (87996.619 -214744.271)\n", + "1 8050 36.061094 -118.994880 256 POINT (90430.048 -216848.624)\n", + "2 1100 36.073048 -119.020918 256 POINT (88073.792 -215544.973)" + ] + }, + "execution_count": 196, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "tbl_stops_corridors.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 197, + "id": "eda55a78-d4c5-47cc-8012-ac2d1fa4a92f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idhqta_typegeometry
22564812f4ecb6-c161-480e-8ec2-d7e3b63c7e38hq_corridor_busPOLYGON ((-133311.510 166655.910, -133353.419 ...
22571424654hq_corridor_busPOLYGON ((212373.929 -486798.063, 212402.264 -...
22581426679hq_corridor_busMULTIPOLYGON (((200815.723 -472198.343, 200811...
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id hqta_type \\\n", + "2256 48 12f4ecb6-c161-480e-8ec2-d7e3b63c7e38 hq_corridor_bus \n", + "2257 142 4654 hq_corridor_bus \n", + "2258 142 6679 hq_corridor_bus \n", + "\n", + " geometry \n", + "2256 POLYGON ((-133311.510 166655.910, -133353.419 ... \n", + "2257 POLYGON ((212373.929 -486798.063, 212402.264 -... \n", + "2258 MULTIPOLYGON (((200815.723 -472198.343, 200811... " + ] + }, + "execution_count": 197, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "bus_hqtc_extract.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 198, + "id": "c161a6c5-bd29-4f0e-aaa2-f83731af42d4", + "metadata": {}, + "outputs": [], + "source": [ + "stops_in_corridor = tbl_stops_corridors.clip(bus_hqtc_extract)" + ] + }, + { + "cell_type": "code", + "execution_count": 199, + "id": "83da99fb-4d2c-438b-bf24-65ce726fba0a", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 32894 entries, 26531 to 121250\n", + "Data columns (total 5 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 stop_id 32894 non-null object \n", + " 1 stop_lat 32894 non-null float64 \n", + " 2 stop_lon 32894 non-null float64 \n", + " 3 calitp_itp_id 32894 non-null int64 \n", + " 4 geometry 32894 non-null geometry\n", + "dtypes: float64(2), geometry(1), int64(1), object(1)\n", + "memory usage: 1.5+ MB\n" + ] + } + ], + "source": [ + "stops_in_corridor.info()" + ] + }, + { + "cell_type": "code", + "execution_count": 200, + "id": "82657639-7ad8-43e2-9050-7b49b0da0799", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "Int64Index: 32009 entries, 26531 to 121250\n", + "Data columns (total 5 columns):\n", + " # Column Non-Null Count Dtype \n", + "--- ------ -------------- ----- \n", + " 0 stop_id 32009 non-null object \n", + " 1 stop_lat 32009 non-null float64 \n", + " 2 stop_lon 32009 non-null float64 \n", + " 3 calitp_itp_id 32009 non-null int64 \n", + " 4 geometry 32009 non-null geometry\n", + "dtypes: float64(2), geometry(1), int64(1), object(1)\n", + "memory usage: 1.5+ MB\n" + ] + } + ], + "source": [ + "stops_in_corridor.drop_duplicates(subset = ['stop_id', 'calitp_itp_id']).info()" + ] + }, + { + "cell_type": "code", + "execution_count": 201, + "id": "7fbca026-79dc-4249-a6fb-9ee436a422cc", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(bus_hqtc_extract)" + ] + }, + { + "cell_type": "code", + "execution_count": 202, + "id": "d10d08e6-2166-4d74-9b21-40181da5f19e", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(stops_in_corridor)" + ] + }, + { + "cell_type": "markdown", + "id": "f1ac0f78-6b99-4079-8c26-ca875367f6a8", + "metadata": {}, + "source": [ + "#### Definitions and Output:\n", + "\n", + "* hqta_type: major_transit_stop\n", + "* stop_id: one stop id... (not ideal, but oh well)\n", + "* geometry: .buffer(700)?\n", + "* _can alway pull more info spatially_" + ] + }, + { + "cell_type": "markdown", + "id": "03d81f0e-da43-4116-ae9b-b094b1466f2b", + "metadata": {}, + "source": [ + "## Unbuffered Export" + ] + }, + { + "cell_type": "markdown", + "id": "403c2790-2f47-4b3f-9740-443020721a0b", + "metadata": {}, + "source": [ + "Thank you for this data. It would be useful for us to get the HQTC stops as a point data file, not a polygon. Also, if you could differentiate between train, bus, BRT, and ferry stop that would be immensely helpful.\n", + "\n", + "Let me know if it is possible to get the data in this format. " + ] + }, + { + "cell_type": "markdown", + "id": "baa2a7f4-5212-4911-9e6e-1e9bfc2f1d59", + "metadata": {}, + "source": [ + "#### Major Transit Stops (bus intersections)" + ] + }, + { + "cell_type": "code", + "execution_count": 203, + "id": "a4188f4e-5b5f-44d6-b3be-e8ed70fd8e64", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_id_leftgeometryindex_rightcalitp_itp_id_righthqta_type
1205037.789595-122.2458004POINT (-197487.747 -22870.228)18734major_transit_stop
661616037.789312-122.2457844POINT (-197487.086 -22901.713)18734major_transit_stop
868604437.789646-122.2461174POINT (-197515.484 -22863.900)18734major_transit_stop
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id_left \\\n", + "1 2050 37.789595 -122.245800 4 \n", + "661 6160 37.789312 -122.245784 4 \n", + "868 6044 37.789646 -122.246117 4 \n", + "\n", + " geometry index_right calitp_itp_id_right \\\n", + "1 POINT (-197487.747 -22870.228) 1873 4 \n", + "661 POINT (-197487.086 -22901.713) 1873 4 \n", + "868 POINT (-197515.484 -22863.900) 1873 4 \n", + "\n", + " hqta_type \n", + "1 major_transit_stop \n", + "661 major_transit_stop \n", + "868 major_transit_stop " + ] + }, + "execution_count": 203, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_major_stops.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 204, + "id": "c5a8d5cb-fd72-4dbf-85bb-a76996d567eb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idcalitp_itp_id_2hqta_typegeometry
1420504major_stop_busPOINT (-197487.747 -22870.228)
661461604major_stop_busPOINT (-197487.086 -22901.713)
868460444major_stop_busPOINT (-197515.484 -22863.900)
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id calitp_itp_id_2 hqta_type \\\n", + "1 4 2050 4 major_stop_bus \n", + "661 4 6160 4 major_stop_bus \n", + "868 4 6044 4 major_stop_bus \n", + "\n", + " geometry \n", + "1 POINT (-197487.747 -22870.228) \n", + "661 POINT (-197487.086 -22901.713) \n", + "868 POINT (-197515.484 -22863.900) " + ] + }, + "execution_count": 204, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "new_major_bus_extract = new_major_stops >> select(_.calitp_itp_id == _.calitp_itp_id_left, _.stop_id,\n", + " _.calitp_itp_id_2 == _.calitp_itp_id_right, _.hqta_type, _.geometry\n", + " )\n", + "new_major_bus_extract['hqta_type'] = 'major_stop_bus'\n", + "new_major_bus_extract.head(3)" + ] + }, + { + "cell_type": "markdown", + "id": "e9a0e81f-b16b-4fab-82e6-f7eb84999ee9", + "metadata": {}, + "source": [ + "#### Stops Along HQ Transit Corridors (bus)" + ] + }, + { + "cell_type": "code", + "execution_count": 205, + "id": "644055ed-ab86-4e07-80fb-0c17a457b8f4", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
stop_idstop_latstop_loncalitp_itp_idgeometry
2653126234.420949-119.703600293POINT (27236.798 -399421.201)
66308S8034.421013-119.703516169POINT (27244.495 -399414.075)
2677611334.420955-119.670648293POINT (30264.810 -399410.543)
\n", + "
" + ], + "text/plain": [ + " stop_id stop_lat stop_lon calitp_itp_id \\\n", + "26531 262 34.420949 -119.703600 293 \n", + "66308 S80 34.421013 -119.703516 169 \n", + "26776 113 34.420955 -119.670648 293 \n", + "\n", + " geometry \n", + "26531 POINT (27236.798 -399421.201) \n", + "66308 POINT (27244.495 -399414.075) \n", + "26776 POINT (30264.810 -399410.543) " + ] + }, + "execution_count": 205, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "stops_in_corridor.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 206, + "id": "e3fe89fe-f38c-4209-80da-b1a7ec950933", + "metadata": {}, + "outputs": [], + "source": [ + "stops_extract = stops_in_corridor >> select(_.calitp_itp_id, _.stop_id, _.geometry)" + ] + }, + { + "cell_type": "code", + "execution_count": 207, + "id": "62591143-ce91-408a-86a7-67d993a64205", + "metadata": {}, + "outputs": [], + "source": [ + "stops_extract['hqta_type'] = 'hq_corridor_bus'" + ] + }, + { + "cell_type": "code", + "execution_count": 208, + "id": "283ddc23-5a5f-4606-ab30-72341ee890cb", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idgeometryhqta_type
26531293262POINT (27236.798 -399421.201)hq_corridor_bus
66308169S80POINT (27244.495 -399414.075)hq_corridor_bus
26776293113POINT (30264.810 -399410.543)hq_corridor_bus
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id geometry hqta_type\n", + "26531 293 262 POINT (27236.798 -399421.201) hq_corridor_bus\n", + "66308 169 S80 POINT (27244.495 -399414.075) hq_corridor_bus\n", + "26776 293 113 POINT (30264.810 -399410.543) hq_corridor_bus" + ] + }, + "execution_count": 208, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "stops_extract.head(3)" + ] + }, + { + "cell_type": "markdown", + "id": "3d90eef5-3b4d-4c6a-96c9-e40a2855a260", + "metadata": {}, + "source": [ + "#### Major Transit Stops (rail/ferry/brt)" + ] + }, + { + "cell_type": "code", + "execution_count": 209, + "id": "5138b1e6-4c99-4ff1-b672-89d5f5a484e2", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometryhqta_type
106618218010133.768071-118.1929210POINT (167426.752 -470294.073)major_transit_stop
107818218015333.768740-118.1893620POINT (167755.039 -470213.608)major_transit_stop
107618218010233.772258-118.1937000POINT (167345.741 -469831.223)major_transit_stop
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "1066 182 1 80101 33.768071 -118.192921 \n", + "1078 182 1 80153 33.768740 -118.189362 \n", + "1076 182 1 80102 33.772258 -118.193700 \n", + "\n", + " route_type geometry hqta_type \n", + "1066 0 POINT (167426.752 -470294.073) major_transit_stop \n", + "1078 0 POINT (167755.039 -470213.608) major_transit_stop \n", + "1076 0 POINT (167345.741 -469831.223) major_transit_stop " + ] + }, + "execution_count": 209, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_stops.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 210, + "id": "8a269cf5-fb38-467f-b31d-8c98c2aed684", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_extract = rail_ferry_brt_stops >> select(_.calitp_itp_id == _.calitp_itp_id, _.stop_id,\n", + " _.hqta_type, _.route_type, _.geometry\n", + " )" + ] + }, + { + "cell_type": "code", + "execution_count": 211, + "id": "154b935a-5c1b-48d9-a44b-d276ade8b4ae", + "metadata": {}, + "outputs": [], + "source": [ + "rail_ferry_brt_extract = (rail_ferry_brt_extract\n", + " >> mutate(\n", + " hqta_type = case_when({\n", + " _.route_type.isin(['0', '1', '2']): 'major_stop_rail',\n", + " _.route_type == '3': 'major_stop_brt',\n", + " _.route_type == '4': 'major_stop_ferry'\n", + " })\n", + " )\n", + " >> select(-_.route_type)\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": 212, + "id": "795f12d4-f881-4d72-adf2-69a4276084e9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idhqta_typegeometry
106618280101major_stop_railPOINT (167426.752 -470294.073)
107818280153major_stop_railPOINT (167755.039 -470213.608)
107618280102major_stop_railPOINT (167345.741 -469831.223)
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id hqta_type geometry\n", + "1066 182 80101 major_stop_rail POINT (167426.752 -470294.073)\n", + "1078 182 80153 major_stop_rail POINT (167755.039 -470213.608)\n", + "1076 182 80102 major_stop_rail POINT (167345.741 -469831.223)" + ] + }, + "execution_count": 212, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "rail_ferry_brt_extract.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 213, + "id": "45f7684d-af37-4e66-bfec-e5e5d4b1d2c4", + "metadata": {}, + "outputs": [], + "source": [ + "points_combined = new_major_bus_extract.append(stops_extract).append(rail_ferry_brt_extract)" + ] + }, + { + "cell_type": "code", + "execution_count": 214, + "id": "f74db8b5-c1c2-4f68-88d8-89964d2a7179", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "calitp_itp_id int64\n", + "stop_id object\n", + "calitp_itp_id_2 object\n", + "hqta_type object\n", + "geometry geometry\n", + "dtype: object" + ] + }, + "execution_count": 214, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "points_combined.dtypes" + ] + }, + { + "cell_type": "code", + "execution_count": 215, + "id": "c767a0e4-e8c5-4967-b223-c982717de70c", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idcalitp_itp_id_2hqta_typegeometry
1420504major_stop_busPOINT (-197487.747 -22870.228)
661461604major_stop_busPOINT (-197487.086 -22901.713)
868460444major_stop_busPOINT (-197515.484 -22863.900)
4378461614major_stop_busPOINT (-197544.479 -22958.955)
6453074major_stop_busPOINT (-189006.213 -28181.062)
..................
42328295NaNmajor_stop_brtPOINT (246407.338 -422724.364)
172328288NaNmajor_stop_brtPOINT (243453.358 -421760.464)
996323165NaNmajor_stop_railPOINT (172732.681 -389214.320)
34213VRVNaNmajor_stop_railPOINT (248354.060 -383016.649)
994323163NaNmajor_stop_railPOINT (172437.092 -378906.434)
\n", + "

37473 rows × 5 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id calitp_itp_id_2 hqta_type \\\n", + "1 4 2050 4 major_stop_bus \n", + "661 4 6160 4 major_stop_bus \n", + "868 4 6044 4 major_stop_bus \n", + "4378 4 6161 4 major_stop_bus \n", + "6 4 5307 4 major_stop_bus \n", + "... ... ... ... ... \n", + "4 232 8295 NaN major_stop_brt \n", + "17 232 8288 NaN major_stop_brt \n", + "996 323 165 NaN major_stop_rail \n", + "342 13 VRV NaN major_stop_rail \n", + "994 323 163 NaN major_stop_rail \n", + "\n", + " geometry \n", + "1 POINT (-197487.747 -22870.228) \n", + "661 POINT (-197487.086 -22901.713) \n", + "868 POINT (-197515.484 -22863.900) \n", + "4378 POINT (-197544.479 -22958.955) \n", + "6 POINT (-189006.213 -28181.062) \n", + "... ... \n", + "4 POINT (246407.338 -422724.364) \n", + "17 POINT (243453.358 -421760.464) \n", + "996 POINT (172732.681 -389214.320) \n", + "342 POINT (248354.060 -383016.649) \n", + "994 POINT (172437.092 -378906.434) \n", + "\n", + "[37473 rows x 5 columns]" + ] + }, + "execution_count": 215, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "points_combined" + ] + }, + { + "cell_type": "code", + "execution_count": 161, + "id": "1eaa13fb-88d9-4f5f-ac07-5a5711f974db", + "metadata": {}, + "outputs": [], + "source": [ + "# map_hqta(points_combined)" + ] + }, + { + "cell_type": "code", + "execution_count": 224, + "id": "f7d2d824-f02a-450c-a18f-baa4f4b4c8b3", + "metadata": {}, + "outputs": [], + "source": [ + "names = tbl.views.gtfs_agency_names() >> select(_.calitp_itp_id, _.agency_name) >> collect()\n", + "with_names = points_combined >> inner_join(_, names, on = 'calitp_itp_id')" + ] + }, + { + "cell_type": "code", + "execution_count": 231, + "id": "f5597551-8553-446b-9f1d-4c9996be932c", + "metadata": {}, + "outputs": [], + "source": [ + "with_names = with_names.drop_duplicates(subset=['calitp_itp_id', 'hqta_type', 'stop_id'])\n", + "with_names = with_names.drop(columns=['calitp_itp_id_2'])" + ] + }, + { + "cell_type": "code", + "execution_count": 233, + "id": "8babf759-70b5-43ca-913b-f3a4f594c30f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idstop_idhqta_typegeometryagency_name
042050major_stop_busPOINT (-197487.747 -22870.228)AC Transit
146160major_stop_busPOINT (-197487.086 -22901.713)AC Transit
246044major_stop_busPOINT (-197515.484 -22863.900)AC Transit
\n", + "
" + ], + "text/plain": [ + " calitp_itp_id stop_id hqta_type geometry \\\n", + "0 4 2050 major_stop_bus POINT (-197487.747 -22870.228) \n", + "1 4 6160 major_stop_bus POINT (-197487.086 -22901.713) \n", + "2 4 6044 major_stop_bus POINT (-197515.484 -22863.900) \n", + "\n", + " agency_name \n", + "0 AC Transit \n", + "1 AC Transit \n", + "2 AC Transit " + ] + }, + "execution_count": 233, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "with_names.head(3)" + ] + }, + { + "cell_type": "code", + "execution_count": 234, + "id": "136b178e-edc6-4492-a8d9-1a97080f48f2", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], + "source": [ + "geoparquet_gcs_export(with_names, 'ca_high_quality_transit_points')" + ] + }, + { + "cell_type": "code", + "execution_count": 235, + "id": "b7cc3286-aa84-4b66-acba-4935481e1650", + "metadata": {}, + "outputs": [], + "source": [ + "with_names.to_file('./ca_high_quality_transit_point.geojson', driver='GeoJSON')" + ] + }, + { + "cell_type": "code", + "execution_count": 236, + "id": "abd4b07a-6804-4f80-9377-ca34208b5e78", + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/tmp/ipykernel_44/2615873071.py:1: UserWarning: Column names longer than 10 characters will be truncated when saved to ESRI Shapefile.\n", + " with_names.to_file('./ca_high_quality_transit/ca_high_quality_transit_point.shp')\n" + ] + } + ], + "source": [ + "with_names.to_file('./ca_high_quality_transit/ca_high_quality_transit_point.shp')" + ] + }, + { + "cell_type": "code", + "execution_count": 237, + "id": "62bf6074-7796-4fee-9ea7-9a4d67f438a1", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "array(['major_stop_bus', 'hq_corridor_bus', 'major_stop_brt',\n", + " 'major_stop_rail', 'major_stop_ferry'], dtype=object)" + ] + }, + "execution_count": 237, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "with_names['hqta_type'].unique()" ] }, { From 0040e14e6365e5df7bfbccd72d09aaf2fd9018bc Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Tue, 7 Dec 2021 01:07:05 +0000 Subject: [PATCH 20/24] start hqta revisions, siuba query error --- high_quality_transit_areas/bus_corridors.ipynb | 3 +++ high_quality_transit_areas/combine_and_visualize.ipynb | 1 + 2 files changed, 4 insertions(+) diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index cf7bf6411..73c973f4f 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -20,6 +20,8 @@ "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", + "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", + "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", @@ -57,6 +59,7 @@ "Requirement already satisfied: backcall in /opt/conda/lib/python3.9/site-packages (from ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.2.0)\n", "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", + "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", diff --git a/high_quality_transit_areas/combine_and_visualize.ipynb b/high_quality_transit_areas/combine_and_visualize.ipynb index 28abca3d7..c2f2e244a 100644 --- a/high_quality_transit_areas/combine_and_visualize.ipynb +++ b/high_quality_transit_areas/combine_and_visualize.ipynb @@ -560,6 +560,7 @@ " stop_lat\n", " stop_lon\n", " calitp_itp_id\n", + " stop_id\n", " geometry\n", " \n", " \n", From b81c6b3f6e2865517e0f83c4e25725bf531b021e Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 8 Dec 2021 19:10:29 +0000 Subject: [PATCH 21/24] fix+refactor rail_ferry_brt --- high_quality_transit_areas/rail_ferry_brt.ipynb | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 706376a07..4e77a4315 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -212,7 +212,22 @@ "execution_count": 10, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "6dd08c23eb034e769c8317c27148dccf", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[37.79790800531397, -121.26366399999999], controls=(ZoomControl(options=['position', 'zoom_in_text'…" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], "source": [ "# map_hqta(rail_stops, 'route_type')" ] From 6dde59ac7ab2e7cbfd614d2345b5530761c33462 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Wed, 8 Dec 2021 21:04:17 +0000 Subject: [PATCH 22/24] illustrate nb save issue --- .../bus_corridors.ipynb | 8 +- .../rail_ferry_brt.ipynb | 281 ++---------------- 2 files changed, 35 insertions(+), 254 deletions(-) diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 73c973f4f..3f432f8fd 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -96,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, "outputs": [ @@ -165,7 +165,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -177,7 +177,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -189,7 +189,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 4e77a4315..55ce3878f 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", "metadata": { "tags": [] @@ -17,16 +17,7 @@ "execution_count": 2, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", - " warnings.warn(\n" - ] - } - ], + "outputs": [], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -77,7 +68,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", "metadata": {}, "outputs": [], @@ -96,7 +87,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], @@ -140,7 +131,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", "metadata": { "tags": [] @@ -158,7 +149,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", "metadata": {}, "outputs": [], @@ -171,7 +162,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", "metadata": {}, "outputs": [], @@ -185,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", "metadata": {}, "outputs": [], @@ -199,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], @@ -209,25 +200,10 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": null, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "6dd08c23eb034e769c8317c27148dccf", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "Map(center=[37.79790800531397, -121.26366399999999], controls=(ZoomControl(options=['position', 'zoom_in_text'…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "# map_hqta(rail_stops, 'route_type')" ] @@ -246,7 +222,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], @@ -260,7 +236,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -270,7 +246,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -287,7 +263,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -297,7 +273,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -307,7 +283,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -320,7 +296,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -330,7 +306,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -340,7 +316,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -353,7 +329,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -363,7 +339,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -381,7 +357,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -394,7 +370,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -406,7 +382,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -424,7 +400,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -438,198 +414,17 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometry
0100340000237.797908-121.2636642POINT (-111116.950 -23544.700)
1100340000137.957058-121.2789482POINT (-112222.169 -5836.078)
2100340000337.696468-121.4338692POINT (-126252.943 -34607.238)
31003400004.337.657549-121.8829622POINT (-165877.168 -38241.179)
41003400004.137.697081-121.7176482POINT (-151236.096 -34123.815)
........................
28410248354937.872939-122.4554464POINT (-215679.403 -13151.168)
29410248356937.856636-122.4782754POINT (-217731.552 -14910.728)
31338081872937.770840-122.3857914POINT (-209847.993 -24653.833)
32338081873337.864540-122.3139324POINT (-203274.531 -14397.269)
33338081872737.797482-122.3950254POINT (-210585.228 -21672.628)
\n", - "

1324 rows × 7 columns

\n", - "
" - ], - "text/plain": [ - " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", - "0 10 0 3400002 37.797908 -121.263664 \n", - "1 10 0 3400001 37.957058 -121.278948 \n", - "2 10 0 3400003 37.696468 -121.433869 \n", - "3 10 0 3400004.3 37.657549 -121.882962 \n", - "4 10 0 3400004.1 37.697081 -121.717648 \n", - ".. ... ... ... ... ... \n", - "28 41 0 2483549 37.872939 -122.455446 \n", - "29 41 0 2483569 37.856636 -122.478275 \n", - "31 338 0 818729 37.770840 -122.385791 \n", - "32 338 0 818733 37.864540 -122.313932 \n", - "33 338 0 818727 37.797482 -122.395025 \n", - "\n", - " route_type geometry \n", - "0 2 POINT (-111116.950 -23544.700) \n", - "1 2 POINT (-112222.169 -5836.078) \n", - "2 2 POINT (-126252.943 -34607.238) \n", - "3 2 POINT (-165877.168 -38241.179) \n", - "4 2 POINT (-151236.096 -34123.815) \n", - ".. ... ... \n", - "28 4 POINT (-215679.403 -13151.168) \n", - "29 4 POINT (-217731.552 -14910.728) \n", - "31 4 POINT (-209847.993 -24653.833) \n", - "32 4 POINT (-203274.531 -14397.269) \n", - "33 4 POINT (-210585.228 -21672.628) \n", - "\n", - "[1324 rows x 7 columns]" - ] - }, - "execution_count": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "rail_brt_ferry" ] }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", "metadata": {}, "outputs": [], @@ -639,7 +434,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "b4d279ae-5283-47e6-b503-f01738f7672a", "metadata": {}, "outputs": [], @@ -698,21 +493,7 @@ "execution_count": 33, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", - "\n", - "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", - "\n", - "To further ignore this warning, you can do: \n", - "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", - " gdf.to_parquet(f\"{name}.parquet\")\n" - ] - } - ], + "outputs": [], "source": [ "geoparquet_gcs_export(rail_brt_ferry, 'rail_brt_ferry')" ] From 84c41dfdcee573a9541868d8113f496b46e8d5c0 Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Thu, 9 Dec 2021 00:09:13 +0000 Subject: [PATCH 23/24] view lbt PCH corridor pending debug --- .../bus_corridors.ipynb | 11 +- .../rail_ferry_brt.ipynb | 264 ++++++++++++++++-- 2 files changed, 239 insertions(+), 36 deletions(-) diff --git a/high_quality_transit_areas/bus_corridors.ipynb b/high_quality_transit_areas/bus_corridors.ipynb index 3f432f8fd..54fa13b8d 100644 --- a/high_quality_transit_areas/bus_corridors.ipynb +++ b/high_quality_transit_areas/bus_corridors.ipynb @@ -20,8 +20,6 @@ "Requirement already satisfied: pygeos in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 2)) (0.12.0)\n", "Requirement already satisfied: ipyleaflet in /opt/conda/lib/python3.9/site-packages (from -r requirements.txt (line 3)) (0.15.0)\n", "Requirement already satisfied: pandas>=0.25.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.3.4)\n", - "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", - "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: shapely>=1.6 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.0)\n", "Requirement already satisfied: pyproj>=2.2.0 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (3.3.0)\n", "Requirement already satisfied: fiona>=1.8 in /opt/conda/lib/python3.9/site-packages (from geopandas->-r requirements.txt (line 1)) (1.8.20)\n", @@ -60,6 +58,7 @@ "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", "Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.2.1)\n", + "Requirement already satisfied: jupyter-core in /opt/conda/lib/python3.9/site-packages (from nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (4.9.1)\n", "Requirement already satisfied: notebook>=4.4.1 in /opt/conda/lib/python3.9/site-packages (from widgetsnbextension~=3.5.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (6.4.5)\n", "Requirement already satisfied: parso<0.9.0,>=0.8.0 in /opt/conda/lib/python3.9/site-packages (from jedi>=0.16->ipython>=4.0.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.8.2)\n", "Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in /opt/conda/lib/python3.9/site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets<8,>=7.6.0->ipyleaflet->-r requirements.txt (line 3)) (0.18.0)\n", @@ -96,7 +95,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "e37ce21c-ae28-4359-89b8-f628f852c489", "metadata": {}, "outputs": [ @@ -165,7 +164,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "25b4b77d-3d2e-4ecc-a6db-fa27aecf71db", "metadata": {}, "outputs": [], @@ -177,7 +176,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "ed58ef3a-f454-4f00-9202-bae1dc82f92d", "metadata": {}, "outputs": [], @@ -189,7 +188,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "7d8165e1-492a-4013-bb1f-de1b252fa5d1", "metadata": {}, "outputs": [], diff --git a/high_quality_transit_areas/rail_ferry_brt.ipynb b/high_quality_transit_areas/rail_ferry_brt.ipynb index 55ce3878f..706376a07 100644 --- a/high_quality_transit_areas/rail_ferry_brt.ipynb +++ b/high_quality_transit_areas/rail_ferry_brt.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "ec2f837d-4bc1-4656-88e3-558e3db2f92c", "metadata": { "tags": [] @@ -17,7 +17,16 @@ "execution_count": 2, "id": "aec8f31d-33de-46fa-be90-79a25e559128", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/opt/conda/lib/python3.9/site-packages/geopandas/_compat.py:111: UserWarning: The Shapely GEOS version (3.9.1-CAPI-1.14.2) is incompatible with the GEOS version PyGEOS was compiled with (3.10.1-CAPI-1.16.0). Conversions between both will be slow.\n", + " warnings.warn(\n" + ] + } + ], "source": [ "import calitp\n", "from calitp.tables import tbl\n", @@ -68,7 +77,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "f0253d1e-ce54-4c5d-95cb-1e0578a3cb9c", "metadata": {}, "outputs": [], @@ -87,7 +96,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "c779f0d3-5253-4a4c-82c2-8741e45cd615", "metadata": {}, "outputs": [], @@ -131,7 +140,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "ccac42d0-6424-4b79-ac9a-b77f7d5536e9", "metadata": { "tags": [] @@ -149,7 +158,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "687afbd5-c4ca-4076-87a2-2d76e2b556b5", "metadata": {}, "outputs": [], @@ -162,7 +171,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "56f23a2c-6231-472f-9318-efc9d39c90d3", "metadata": {}, "outputs": [], @@ -176,7 +185,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "01c42d7c-779e-48f2-baf3-b987f4557c6b", "metadata": {}, "outputs": [], @@ -190,7 +199,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "665e8e4b-6bac-44bb-9e37-4e9151186dd3", "metadata": {}, "outputs": [], @@ -200,7 +209,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "5f0affb3-fa64-40e6-9751-c6b6e0145a30", "metadata": {}, "outputs": [], @@ -222,7 +231,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "f5bd001a-1553-46d7-9bed-cb40d457bd54", "metadata": {}, "outputs": [], @@ -236,7 +245,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "e537715e-576f-400d-b070-f2a2e92107dc", "metadata": {}, "outputs": [], @@ -246,7 +255,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "8a6b60ce-8343-44be-bc13-627da47bad3e", "metadata": {}, "outputs": [], @@ -263,7 +272,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "3bfe1ffb-4b8a-4757-8c7c-a4545d927690", "metadata": {}, "outputs": [], @@ -273,7 +282,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "fd8c3d65-c847-44a3-afd0-d5239e8c8ef3", "metadata": {}, "outputs": [], @@ -283,7 +292,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "1f3f3a84-ff2a-430d-bf1a-9b9ad7df9f79", "metadata": {}, "outputs": [], @@ -296,7 +305,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "75ab0103-b13a-4bcd-992c-f550ac0d7c63", "metadata": {}, "outputs": [], @@ -306,7 +315,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 18, "id": "501c99f8-5c67-4619-9d2d-26d122275d33", "metadata": {}, "outputs": [], @@ -316,7 +325,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 19, "id": "dea32983-6c05-4dbb-b5a8-3964c2665ad9", "metadata": {}, "outputs": [], @@ -329,7 +338,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "id": "d14872f0-f932-4d44-9fa1-07e6c6598d6b", "metadata": {}, "outputs": [], @@ -339,7 +348,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 21, "id": "da92e541-49f1-4f2e-ba6d-337456db5346", "metadata": {}, "outputs": [], @@ -357,7 +366,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 22, "id": "a1291f99-2560-4d3b-8155-02a6fbc08bbc", "metadata": {}, "outputs": [], @@ -370,7 +379,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 23, "id": "c4cf42ea-7740-45ed-a2dc-0e769ae90715", "metadata": {}, "outputs": [], @@ -382,7 +391,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 24, "id": "5de12b81-e461-4f5e-955d-2df1abfdd6e3", "metadata": {}, "outputs": [], @@ -400,7 +409,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 25, "id": "0d1364e9-8b07-4b3d-a7fb-b73b868f5f98", "metadata": {}, "outputs": [], @@ -414,17 +423,198 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 26, "id": "eb2ff617-0944-4720-90ac-0c03e296789e", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
calitp_itp_idcalitp_url_numberstop_idstop_latstop_lonroute_typegeometry
0100340000237.797908-121.2636642POINT (-111116.950 -23544.700)
1100340000137.957058-121.2789482POINT (-112222.169 -5836.078)
2100340000337.696468-121.4338692POINT (-126252.943 -34607.238)
31003400004.337.657549-121.8829622POINT (-165877.168 -38241.179)
41003400004.137.697081-121.7176482POINT (-151236.096 -34123.815)
........................
28410248354937.872939-122.4554464POINT (-215679.403 -13151.168)
29410248356937.856636-122.4782754POINT (-217731.552 -14910.728)
31338081872937.770840-122.3857914POINT (-209847.993 -24653.833)
32338081873337.864540-122.3139324POINT (-203274.531 -14397.269)
33338081872737.797482-122.3950254POINT (-210585.228 -21672.628)
\n", + "

1324 rows × 7 columns

\n", + "
" + ], + "text/plain": [ + " calitp_itp_id calitp_url_number stop_id stop_lat stop_lon \\\n", + "0 10 0 3400002 37.797908 -121.263664 \n", + "1 10 0 3400001 37.957058 -121.278948 \n", + "2 10 0 3400003 37.696468 -121.433869 \n", + "3 10 0 3400004.3 37.657549 -121.882962 \n", + "4 10 0 3400004.1 37.697081 -121.717648 \n", + ".. ... ... ... ... ... \n", + "28 41 0 2483549 37.872939 -122.455446 \n", + "29 41 0 2483569 37.856636 -122.478275 \n", + "31 338 0 818729 37.770840 -122.385791 \n", + "32 338 0 818733 37.864540 -122.313932 \n", + "33 338 0 818727 37.797482 -122.395025 \n", + "\n", + " route_type geometry \n", + "0 2 POINT (-111116.950 -23544.700) \n", + "1 2 POINT (-112222.169 -5836.078) \n", + "2 2 POINT (-126252.943 -34607.238) \n", + "3 2 POINT (-165877.168 -38241.179) \n", + "4 2 POINT (-151236.096 -34123.815) \n", + ".. ... ... \n", + "28 4 POINT (-215679.403 -13151.168) \n", + "29 4 POINT (-217731.552 -14910.728) \n", + "31 4 POINT (-209847.993 -24653.833) \n", + "32 4 POINT (-203274.531 -14397.269) \n", + "33 4 POINT (-210585.228 -21672.628) \n", + "\n", + "[1324 rows x 7 columns]" + ] + }, + "execution_count": 26, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "rail_brt_ferry" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 27, "id": "c957af13-3cab-44ef-8c64-830f5d8f1a2f", "metadata": {}, "outputs": [], @@ -434,7 +624,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 28, "id": "b4d279ae-5283-47e6-b503-f01738f7672a", "metadata": {}, "outputs": [], @@ -493,7 +683,21 @@ "execution_count": 33, "id": "ba7057fc-a405-461c-ae65-230966fe9bfa", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/home/jovyan/data-analyses/high_quality_transit_areas/utilities.py:85: UserWarning: this is an initial implementation of Parquet/Feather file support and associated metadata. This is tracking version 0.1.0 of the metadata specification at https://github.com/geopandas/geo-arrow-spec\n", + "\n", + "This metadata specification does not yet make stability promises. We do not yet recommend using this in a production setting unless you are able to rewrite your Parquet/Feather files.\n", + "\n", + "To further ignore this warning, you can do: \n", + "import warnings; warnings.filterwarnings('ignore', message='.*initial implementation of Parquet.*')\n", + " gdf.to_parquet(f\"{name}.parquet\")\n" + ] + } + ], "source": [ "geoparquet_gcs_export(rail_brt_ferry, 'rail_brt_ferry')" ] From 1823a402123fd007dcb8dc492e93723d5378f92f Mon Sep 17 00:00:00 2001 From: Eric Dasmalchi Date: Fri, 10 Dec 2021 00:16:17 +0000 Subject: [PATCH 24/24] interim export for opr --- high_quality_transit_areas/combine_and_visualize.ipynb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/high_quality_transit_areas/combine_and_visualize.ipynb b/high_quality_transit_areas/combine_and_visualize.ipynb index c2f2e244a..0a79cce07 100644 --- a/high_quality_transit_areas/combine_and_visualize.ipynb +++ b/high_quality_transit_areas/combine_and_visualize.ipynb @@ -561,6 +561,9 @@ " stop_lon\n", " calitp_itp_id\n", " stop_id\n", + " stop_lat\n", + " stop_lon\n", + " calitp_itp_id\n", " geometry\n", " \n", " \n",