From bc539e3af62a462716b6ee9b3c85364bc563ea6b Mon Sep 17 00:00:00 2001 From: Paddy Mullen Date: Tue, 29 Oct 2024 15:38:19 -0400 Subject: [PATCH] Chore/cleanup examples (#320) * removing old unused notebooks * cleaned all notebooks and added cleaning command * removing some more unused files --- docs/example-notebooks/DFViewer.ipynb | 23 +- .../Exception-Traits-demo.ipynb | 76 +- docs/example-notebooks/Extending-pandas.ipynb | 43 +- docs/example-notebooks/Extending.ipynb | 49 +- docs/example-notebooks/Filter.ipynb | 1879 +--------- docs/example-notebooks/Full-tour.ipynb | 7 - docs/example-notebooks/GeoPandas.ipynb | 31 +- docs/example-notebooks/Histograms-demo.ipynb | 23 +- .../example-notebooks/Itables-testcases.ipynb | 59 +- .../Pluggable-Analysis-Framework.ipynb | 41 +- docs/example-notebooks/Solara-Buckaroo.ipynb | 35 +- docs/example-notebooks/Untitled1.ipynb | 45 - docs/example-notebooks/Untitled2.ipynb | 40 - docs/example-notebooks/football-plays | 147 - docs/example-notebooks/introduction.ipynb | 7 - docs/example-notebooks/styling-gallery.ipynb | 65 +- docs/example-notebooks/styling-howto.ipynb | 63 +- docs/example-notebooks/testcases-fast.ipynb | 45 +- .../tidy-tuesday/2019-11-bike-commutes.ipynb | 108 - introduction.ipynb | 328 -- package.json | 3 +- pyproject.toml | 3 +- regular-summary-stats.ipynb | 3038 ----------------- scripts/clean_notebooks.sh | 18 + full_build.sh => scripts/full_build.sh | 0 test-environment-ipyw7.yaml | 24 - test-environment-ipyw8.yaml | 24 - tox.ini | 62 - tryit.ipynb | 155 - 29 files changed, 281 insertions(+), 6160 deletions(-) delete mode 100644 docs/example-notebooks/Untitled1.ipynb delete mode 100644 docs/example-notebooks/Untitled2.ipynb delete mode 100644 docs/example-notebooks/football-plays delete mode 100644 docs/example-notebooks/tidy-tuesday/2019-11-bike-commutes.ipynb delete mode 100644 introduction.ipynb delete mode 100644 regular-summary-stats.ipynb create mode 100755 scripts/clean_notebooks.sh rename full_build.sh => scripts/full_build.sh (100%) delete mode 100644 test-environment-ipyw7.yaml delete mode 100644 test-environment-ipyw8.yaml delete mode 100644 tox.ini delete mode 100644 tryit.ipynb diff --git a/docs/example-notebooks/DFViewer.ipynb b/docs/example-notebooks/DFViewer.ipynb index ab0578eb..f2373515 100644 --- a/docs/example-notebooks/DFViewer.ipynb +++ b/docs/example-notebooks/DFViewer.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "e95ac3e5-4532-4aad-9ad1-4096d0e2d631", + "id": "0", "metadata": {}, "source": [ "# DFViewer\n", @@ -15,7 +15,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c0150f9f-0fb0-487f-88ad-9c495c406e59", + "id": "1", "metadata": { "tags": [] }, @@ -27,7 +27,7 @@ }, { "cell_type": "markdown", - "id": "acea57ee-06b6-4244-b6d4-fa14a8747e94", + "id": "2", "metadata": {}, "source": [ "# Using the default DFViewer is straightforward" @@ -36,7 +36,7 @@ { "cell_type": "code", "execution_count": null, - "id": "db41edd1-0569-4cb4-b95a-aaf82e854903", + "id": "3", "metadata": { "tags": [] }, @@ -48,7 +48,7 @@ }, { "cell_type": "markdown", - "id": "fabc0d41-9343-463e-b2f5-b43671a1d7e2", + "id": "4", "metadata": {}, "source": [ "## Removing pinned_rows" @@ -57,7 +57,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4887466f-afaa-4adc-809a-bb4bdf064d17", + "id": "5", "metadata": { "tags": [] }, @@ -68,7 +68,7 @@ }, { "cell_type": "markdown", - "id": "fa8be87e-3b64-44e4-acda-76bba7566990", + "id": "6", "metadata": {}, "source": [ "## It works with polars too" @@ -77,7 +77,7 @@ { "cell_type": "code", "execution_count": null, - "id": "566d9cc1-c1bb-431b-bbab-776e029adebc", + "id": "7", "metadata": { "tags": [] }, @@ -107,13 +107,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Exception-Traits-demo.ipynb b/docs/example-notebooks/Exception-Traits-demo.ipynb index 644bdb0f..a6051d5a 100644 --- a/docs/example-notebooks/Exception-Traits-demo.ipynb +++ b/docs/example-notebooks/Exception-Traits-demo.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "54685928-3f8c-430e-b270-09e51949997f", + "id": "0", "metadata": {}, "source": [ "# Demo of the trait exception rewriting\n", @@ -14,8 +14,8 @@ }, { "cell_type": "code", - "execution_count": 1, - "id": "3ba20b97-144d-459a-8217-f9e1793acbc7", + "execution_count": null, + "id": "1", "metadata": { "tags": [] }, @@ -28,38 +28,12 @@ }, { "cell_type": "code", - "execution_count": 2, - "id": "091125db-b117-4b92-b1d4-231c54a8b1ea", + "execution_count": null, + "id": "2", "metadata": { "tags": [] }, - "outputs": [ - { - "ename": "ZeroDivisionError", - "evalue": "division by zero", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[2], line 28\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcompute_second\u001b[39m(\u001b[38;5;28mself\u001b[39m, val):\n\u001b[1;32m 26\u001b[0m \u001b[38;5;241m1\u001b[39m\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m0\u001b[39m\n\u001b[0;32m---> 28\u001b[0m ErrorSecond(\u001b[38;5;241m5\u001b[39m)\n", - "Cell \u001b[0;32mIn[2], line 8\u001b[0m, in \u001b[0;36mDumbBase.__init__\u001b[0;34m(self, val)\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__init__\u001b[39m(\u001b[38;5;28mself\u001b[39m, val):\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39m\u001b[38;5;21m__init__\u001b[39m()\n\u001b[0;32m----> 8\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfirst_trait \u001b[38;5;241m=\u001b[39m val\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:729\u001b[0m, in \u001b[0;36mTraitType.__set__\u001b[0;34m(self, obj, value)\u001b[0m\n\u001b[1;32m 727\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m TraitError(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mThe \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m trait is read-only.\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;241m%\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mname)\n\u001b[1;32m 728\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 729\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset(obj, value)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:718\u001b[0m, in \u001b[0;36mTraitType.set\u001b[0;34m(self, obj, value)\u001b[0m\n\u001b[1;32m 714\u001b[0m silent \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 715\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m silent \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m 716\u001b[0m \u001b[38;5;66;03m# we explicitly compare silent to True just in case the equality\u001b[39;00m\n\u001b[1;32m 717\u001b[0m \u001b[38;5;66;03m# comparison above returns something other than True/False\u001b[39;00m\n\u001b[0;32m--> 718\u001b[0m obj\u001b[38;5;241m.\u001b[39m_notify_trait(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mname, old_value, new_value)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:1503\u001b[0m, in \u001b[0;36mHasTraits._notify_trait\u001b[0;34m(self, name, old_value, new_value)\u001b[0m\n\u001b[1;32m 1500\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_notify_trait\u001b[39m(\u001b[38;5;28mself\u001b[39m, name, old_value, new_value):\n\u001b[1;32m 1501\u001b[0m \u001b[38;5;66;03m# print(\"name\", name, \"old_value\", old_value)\u001b[39;00m\n\u001b[1;32m 1502\u001b[0m \u001b[38;5;66;03m# try:\u001b[39;00m\n\u001b[0;32m-> 1503\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnotify_change(\n\u001b[1;32m 1504\u001b[0m Bunch(\n\u001b[1;32m 1505\u001b[0m name\u001b[38;5;241m=\u001b[39mname,\n\u001b[1;32m 1506\u001b[0m old\u001b[38;5;241m=\u001b[39mold_value,\n\u001b[1;32m 1507\u001b[0m new\u001b[38;5;241m=\u001b[39mnew_value,\n\u001b[1;32m 1508\u001b[0m owner\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28mtype\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mchange\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 1510\u001b[0m )\n\u001b[1;32m 1511\u001b[0m )\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:1519\u001b[0m, in \u001b[0;36mHasTraits.notify_change\u001b[0;34m(self, change)\u001b[0m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mnotify_change\u001b[39m(\u001b[38;5;28mself\u001b[39m, change):\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Notify observers of a change event\"\"\"\u001b[39;00m\n\u001b[0;32m-> 1519\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_notify_observers(change)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:1566\u001b[0m, in \u001b[0;36mHasTraits._notify_observers\u001b[0;34m(self, event)\u001b[0m\n\u001b[1;32m 1563\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(c, EventHandler) \u001b[38;5;129;01mand\u001b[39;00m c\u001b[38;5;241m.\u001b[39mname \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1564\u001b[0m c \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(\u001b[38;5;28mself\u001b[39m, c\u001b[38;5;241m.\u001b[39mname)\n\u001b[0;32m-> 1566\u001b[0m c(event)\n", - "Cell \u001b[0;32mIn[2], line 15\u001b[0m, in \u001b[0;36mDumbBase.handle_first\u001b[0;34m(self, change)\u001b[0m\n\u001b[1;32m 13\u001b[0m \u001b[38;5;129m@observe\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mfirst_trait\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 14\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mhandle_first\u001b[39m(\u001b[38;5;28mself\u001b[39m, change):\n\u001b[0;32m---> 15\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msecond_trait \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcompute_first(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfirst_trait)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:729\u001b[0m, in \u001b[0;36mTraitType.__set__\u001b[0;34m(self, obj, value)\u001b[0m\n\u001b[1;32m 727\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m TraitError(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mThe \u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m trait is read-only.\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;241m%\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mname)\n\u001b[1;32m 728\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 729\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset(obj, value)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:718\u001b[0m, in \u001b[0;36mTraitType.set\u001b[0;34m(self, obj, value)\u001b[0m\n\u001b[1;32m 714\u001b[0m silent \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m 715\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m silent \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m 716\u001b[0m \u001b[38;5;66;03m# we explicitly compare silent to True just in case the equality\u001b[39;00m\n\u001b[1;32m 717\u001b[0m \u001b[38;5;66;03m# comparison above returns something other than True/False\u001b[39;00m\n\u001b[0;32m--> 718\u001b[0m obj\u001b[38;5;241m.\u001b[39m_notify_trait(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mname, old_value, new_value)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:1503\u001b[0m, in \u001b[0;36mHasTraits._notify_trait\u001b[0;34m(self, name, old_value, new_value)\u001b[0m\n\u001b[1;32m 1500\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_notify_trait\u001b[39m(\u001b[38;5;28mself\u001b[39m, name, old_value, new_value):\n\u001b[1;32m 1501\u001b[0m \u001b[38;5;66;03m# print(\"name\", name, \"old_value\", old_value)\u001b[39;00m\n\u001b[1;32m 1502\u001b[0m \u001b[38;5;66;03m# try:\u001b[39;00m\n\u001b[0;32m-> 1503\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mnotify_change(\n\u001b[1;32m 1504\u001b[0m Bunch(\n\u001b[1;32m 1505\u001b[0m name\u001b[38;5;241m=\u001b[39mname,\n\u001b[1;32m 1506\u001b[0m old\u001b[38;5;241m=\u001b[39mold_value,\n\u001b[1;32m 1507\u001b[0m new\u001b[38;5;241m=\u001b[39mnew_value,\n\u001b[1;32m 1508\u001b[0m owner\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 1509\u001b[0m \u001b[38;5;28mtype\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mchange\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 1510\u001b[0m )\n\u001b[1;32m 1511\u001b[0m )\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:1519\u001b[0m, in \u001b[0;36mHasTraits.notify_change\u001b[0;34m(self, change)\u001b[0m\n\u001b[1;32m 1517\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mnotify_change\u001b[39m(\u001b[38;5;28mself\u001b[39m, change):\n\u001b[1;32m 1518\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Notify observers of a change event\"\"\"\u001b[39;00m\n\u001b[0;32m-> 1519\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_notify_observers(change)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/traitlets/traitlets.py:1566\u001b[0m, in \u001b[0;36mHasTraits._notify_observers\u001b[0;34m(self, event)\u001b[0m\n\u001b[1;32m 1563\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(c, EventHandler) \u001b[38;5;129;01mand\u001b[39;00m c\u001b[38;5;241m.\u001b[39mname \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 1564\u001b[0m c \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(\u001b[38;5;28mself\u001b[39m, c\u001b[38;5;241m.\u001b[39mname)\n\u001b[0;32m-> 1566\u001b[0m c(event)\n", - "Cell \u001b[0;32mIn[2], line 22\u001b[0m, in \u001b[0;36mDumbBase.handle_second\u001b[0;34m(self, change)\u001b[0m\n\u001b[1;32m 20\u001b[0m \u001b[38;5;129m@observe\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msecond_trait\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 21\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mhandle_second\u001b[39m(\u001b[38;5;28mself\u001b[39m, change):\n\u001b[0;32m---> 22\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mthird_trait \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcompute_second(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msecond_trait)\n", - "Cell \u001b[0;32mIn[2], line 26\u001b[0m, in \u001b[0;36mErrorSecond.compute_second\u001b[0;34m(self, val)\u001b[0m\n\u001b[1;32m 25\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcompute_second\u001b[39m(\u001b[38;5;28mself\u001b[39m, val):\n\u001b[0;32m---> 26\u001b[0m \u001b[38;5;241m1\u001b[39m\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m0\u001b[39m\n", - "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" - ] - } - ], + "outputs": [], "source": [ "class DumbBase(HasTraits):\n", " first_trait = Any()\n", @@ -93,35 +67,12 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "1876620c-eb2c-4bdc-8a90-761c51a9a77b", + "execution_count": null, + "id": "3", "metadata": { "tags": [] }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "self.exception (, ZeroDivisionError('division by zero'), )\n" - ] - }, - { - "ename": "ZeroDivisionError", - "evalue": "division by zero", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mZeroDivisionError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[4], line 50\u001b[0m\n\u001b[1;32m 48\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcompute_second\u001b[39m(\u001b[38;5;28mself\u001b[39m, val):\n\u001b[1;32m 49\u001b[0m \u001b[38;5;241m1\u001b[39m\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m0\u001b[39m\n\u001b[0;32m---> 50\u001b[0m ab \u001b[38;5;241m=\u001b[39m ErrorSecondSmart(\u001b[38;5;241m5\u001b[39m)\n\u001b[1;32m 51\u001b[0m ab\n", - "Cell \u001b[0;32mIn[4], line 25\u001b[0m, in \u001b[0;36mSmartBase.__init__\u001b[0;34m(self, val)\u001b[0m\n\u001b[1;32m 23\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mself.exception\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mexception)\n\u001b[1;32m 24\u001b[0m exc, exc1, tb \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mexception\n\u001b[0;32m---> 25\u001b[0m six\u001b[38;5;241m.\u001b[39mreraise(exc, exc1, tb)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-5/lib/python3.11/site-packages/six.py:718\u001b[0m, in \u001b[0;36mreraise\u001b[0;34m(tp, value, tb)\u001b[0m\n\u001b[1;32m 716\u001b[0m value \u001b[38;5;241m=\u001b[39m tp()\n\u001b[1;32m 717\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m value\u001b[38;5;241m.\u001b[39m__traceback__ \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m tb:\n\u001b[0;32m--> 718\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m value\u001b[38;5;241m.\u001b[39mwith_traceback(tb)\n\u001b[1;32m 719\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m value\n\u001b[1;32m 720\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n", - "Cell \u001b[0;32mIn[4], line 42\u001b[0m, in \u001b[0;36mSmartBase.handle_second\u001b[0;34m(self, change)\u001b[0m\n\u001b[1;32m 38\u001b[0m \u001b[38;5;129m@observe\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msecond_trait\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 39\u001b[0m \u001b[38;5;129m@exception_protect\u001b[39m\n\u001b[1;32m 40\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mhandle_second\u001b[39m(\u001b[38;5;28mself\u001b[39m, change):\n\u001b[1;32m 41\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m---> 42\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mthird_trait \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcompute_second(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msecond_trait)\n\u001b[1;32m 43\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mException\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 44\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mexception \u001b[38;5;241m=\u001b[39m sys\u001b[38;5;241m.\u001b[39mexc_info()\n", - "Cell \u001b[0;32mIn[4], line 49\u001b[0m, in \u001b[0;36mErrorSecondSmart.compute_second\u001b[0;34m(self, val)\u001b[0m\n\u001b[1;32m 48\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mcompute_second\u001b[39m(\u001b[38;5;28mself\u001b[39m, val):\n\u001b[0;32m---> 49\u001b[0m \u001b[38;5;241m1\u001b[39m\u001b[38;5;241m/\u001b[39m\u001b[38;5;241m0\u001b[39m\n", - "\u001b[0;31mZeroDivisionError\u001b[0m: division by zero" - ] - } - ], + "outputs": [], "source": [ "def exception_protect(func):\n", " def wrapped(self, *args, **kwargs):\n", @@ -179,7 +130,7 @@ { "cell_type": "code", "execution_count": null, - "id": "48b4e65c-8ac9-487b-9e9e-7cb5e9dd4fb1", + "id": "4", "metadata": {}, "outputs": [], "source": [] @@ -202,13 +153,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Extending-pandas.ipynb b/docs/example-notebooks/Extending-pandas.ipynb index 9d836c2f..49770b12 100644 --- a/docs/example-notebooks/Extending-pandas.ipynb +++ b/docs/example-notebooks/Extending-pandas.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "4d39f5cc-7791-4e90-8108-60752647487c", + "id": "0", "metadata": {}, "source": [ "# Extending Buckaroo for pandas\n", @@ -22,7 +22,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73f3516e-2273-495a-b3b9-f68593b0018b", + "id": "1", "metadata": { "tags": [] }, @@ -38,7 +38,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45a03efb-ec32-4cda-b443-99425e80a458", + "id": "2", "metadata": { "tags": [] }, @@ -54,7 +54,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8086b3b9-f97e-4b4c-9c0a-85566be060a3", + "id": "3", "metadata": { "tags": [] }, @@ -66,7 +66,7 @@ }, { "cell_type": "markdown", - "id": "85054e95-edc2-4842-994d-3f6131660a8e", + "id": "4", "metadata": {}, "source": [ "# Using the Pluggable Analysis Framework\n", @@ -87,7 +87,7 @@ { "cell_type": "code", "execution_count": null, - "id": "912b478d-bd67-4bb8-a31d-a5f8e95f8f40", + "id": "5", "metadata": { "tags": [] }, @@ -114,7 +114,7 @@ }, { "cell_type": "markdown", - "id": "05ecd1e4-1bde-48ce-ac51-bf53f7bb91c4", + "id": "6", "metadata": {}, "source": [ "# Adding a styling analysis\n", @@ -133,7 +133,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c03b5bc4-0025-4b55-9e7c-cc1a69508688", + "id": "7", "metadata": { "tags": [] }, @@ -194,7 +194,7 @@ }, { "cell_type": "markdown", - "id": "a3116fa5-174e-4c67-98d7-dd33dc9b2275", + "id": "8", "metadata": {}, "source": [ "Let's look at pinned_rows, they can be modified by setting `pinned_rows` on Buckaroo Instaniation" @@ -202,7 +202,7 @@ }, { "cell_type": "markdown", - "id": "be8c2eb7-a791-46f8-b3b4-62f596799b21", + "id": "9", "metadata": {}, "source": [ "# lets add a post processing method" @@ -211,7 +211,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c2088225-051e-4cd7-b353-03df60124cc2", + "id": "10", "metadata": { "tags": [] }, @@ -227,7 +227,7 @@ { "cell_type": "code", "execution_count": null, - "id": "708da9e2-6311-4755-a3af-38afcaa49a3d", + "id": "11", "metadata": { "tags": [] }, @@ -276,7 +276,7 @@ }, { "cell_type": "markdown", - "id": "8f2a47ec-0067-4e10-ac6d-d45c46ed6171", + "id": "12", "metadata": {}, "source": [ "## Where to use PostProcessing\n", @@ -315,7 +315,7 @@ }, { "cell_type": "markdown", - "id": "1a9e4db3-82ca-4478-ab87-0e29cccdf108", + "id": "13", "metadata": {}, "source": [ "# Putting it all together\n", @@ -326,7 +326,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d8ccbb77-5cc1-4501-bb84-45480d1213ad", + "id": "14", "metadata": { "tags": [] }, @@ -355,7 +355,7 @@ }, { "cell_type": "markdown", - "id": "c83014fe-7a61-415d-862d-b7b055b2835e", + "id": "15", "metadata": {}, "source": [ "# Why aren't there click handlers?\n", @@ -367,7 +367,7 @@ }, { "cell_type": "markdown", - "id": "e19b6de0-5684-4f0e-b821-dd3ba1198e72", + "id": "16", "metadata": {}, "source": [ "# What about autocleaning and the low code UI\n", @@ -385,7 +385,7 @@ { "cell_type": "code", "execution_count": null, - "id": "db2eb990-b6b0-47aa-b7ca-2fe40b9dcebe", + "id": "17", "metadata": {}, "outputs": [], "source": [] @@ -408,13 +408,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.20" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Extending.ipynb b/docs/example-notebooks/Extending.ipynb index 68937271..96400109 100644 --- a/docs/example-notebooks/Extending.ipynb +++ b/docs/example-notebooks/Extending.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "4d39f5cc-7791-4e90-8108-60752647487c", + "id": "0", "metadata": {}, "source": [ "# Extending Buckaroo\n", @@ -22,7 +22,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73f3516e-2273-495a-b3b9-f68593b0018b", + "id": "1", "metadata": { "tags": [] }, @@ -38,7 +38,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45a03efb-ec32-4cda-b443-99425e80a458", + "id": "2", "metadata": { "tags": [] }, @@ -54,7 +54,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8086b3b9-f97e-4b4c-9c0a-85566be060a3", + "id": "3", "metadata": { "tags": [] }, @@ -66,7 +66,7 @@ }, { "cell_type": "markdown", - "id": "85054e95-edc2-4842-994d-3f6131660a8e", + "id": "4", "metadata": {}, "source": [ "# Using the Pluggable Analysis Framework\n", @@ -87,7 +87,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37f0be6a-e94d-4650-b11d-cf3418ff0944", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -108,7 +108,7 @@ }, { "cell_type": "markdown", - "id": "05ecd1e4-1bde-48ce-ac51-bf53f7bb91c4", + "id": "6", "metadata": {}, "source": [ "# Adding a styling analysis\n", @@ -127,7 +127,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c03b5bc4-0025-4b55-9e7c-cc1a69508688", + "id": "7", "metadata": { "tags": [] }, @@ -188,7 +188,7 @@ }, { "cell_type": "markdown", - "id": "a3116fa5-174e-4c67-98d7-dd33dc9b2275", + "id": "8", "metadata": {}, "source": [ "Let's look at pinned_rows, they can be modified by setting `pinned_rows` on Buckaroo Instaniation" @@ -196,7 +196,7 @@ }, { "cell_type": "markdown", - "id": "be8c2eb7-a791-46f8-b3b4-62f596799b21", + "id": "9", "metadata": {}, "source": [ "# lets add a post processing method" @@ -205,7 +205,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3ca85511-9a03-4477-aaf3-586947d8db02", + "id": "10", "metadata": { "tags": [] }, @@ -218,7 +218,7 @@ { "cell_type": "code", "execution_count": null, - "id": "49243e53-e52c-45d8-bcd7-ca98d05ced5a", + "id": "11", "metadata": { "tags": [] }, @@ -230,7 +230,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c2088225-051e-4cd7-b353-03df60124cc2", + "id": "12", "metadata": { "tags": [] }, @@ -245,7 +245,7 @@ }, { "cell_type": "markdown", - "id": "4b8ed040-093f-4921-b60d-17dc736db674", + "id": "13", "metadata": {}, "source": [ "Here we decide that any value of `float_col` below `20` is an error. \n", @@ -258,7 +258,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0bdd2826-1716-4b88-b54d-74241f42549d", + "id": "14", "metadata": { "tags": [] }, @@ -304,7 +304,7 @@ }, { "cell_type": "markdown", - "id": "8f2a47ec-0067-4e10-ac6d-d45c46ed6171", + "id": "15", "metadata": {}, "source": [ "## Where to use PostProcessing\n", @@ -343,7 +343,7 @@ }, { "cell_type": "markdown", - "id": "1a9e4db3-82ca-4478-ab87-0e29cccdf108", + "id": "16", "metadata": {}, "source": [ "# Putting it all together\n", @@ -354,7 +354,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d8ccbb77-5cc1-4501-bb84-45480d1213ad", + "id": "17", "metadata": { "tags": [] }, @@ -386,7 +386,7 @@ }, { "cell_type": "markdown", - "id": "c83014fe-7a61-415d-862d-b7b055b2835e", + "id": "18", "metadata": {}, "source": [ "# Why aren't there click handlers?\n", @@ -398,7 +398,7 @@ }, { "cell_type": "markdown", - "id": "e19b6de0-5684-4f0e-b821-dd3ba1198e72", + "id": "19", "metadata": {}, "source": [ "# What about autocleaning and the low code UI\n", @@ -412,7 +412,7 @@ { "cell_type": "code", "execution_count": null, - "id": "db2eb990-b6b0-47aa-b7ca-2fe40b9dcebe", + "id": "20", "metadata": {}, "outputs": [], "source": [] @@ -435,13 +435,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.19" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Filter.ipynb b/docs/example-notebooks/Filter.ipynb index cf3d4e1d..5091d593 100644 --- a/docs/example-notebooks/Filter.ipynb +++ b/docs/example-notebooks/Filter.ipynb @@ -2,8 +2,8 @@ "cells": [ { "cell_type": "code", - "execution_count": 3, - "id": "bd133988-1c2e-49ca-9c43-2464516723ea", + "execution_count": null, + "id": "0", "metadata": { "tags": [] }, @@ -15,8 +15,8 @@ }, { "cell_type": "code", - "execution_count": 4, - "id": "cbcf499f-d012-43d8-a8f7-0de2a532aef7", + "execution_count": null, + "id": "1", "metadata": { "tags": [] }, @@ -28,28 +28,12 @@ }, { "cell_type": "code", - "execution_count": 6, - "id": "6f0ce3a7-49e6-4e0c-a59b-6c650a616873", + "execution_count": null, + "id": "2", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "711c3b609a664bbaa6d9c1eb5f9b8798", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "PolarsBuckarooWidget(buckaroo_options={'sampled': ['random'], 'auto_clean': ['aggressive', 'conservative'], 'p…" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "str_df = pl.DataFrame({\n", " 'a': [\"foo\", \"foobar\", \"baz\", None, None], \n", @@ -64,31 +48,20 @@ }, { "cell_type": "code", - "execution_count": 8, - "id": "3c7a0c41-5564-46e5-a392-00f9261b7224", + "execution_count": null, + "id": "3", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "bw.ac_obj" ] }, { "cell_type": "code", - "execution_count": 28, - "id": "71a35c07-6685-4da5-994a-c1cdbc9784e8", + "execution_count": null, + "id": "4", "metadata": { "tags": [] }, @@ -106,132 +79,44 @@ }, { "cell_type": "code", - "execution_count": 29, - "id": "97b6f1ee-5d30-4e38-83ad-934be1e6df16", + "execution_count": null, + "id": "5", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "shape: (2, 5)
abcde
stri64stri64i64
"baz"3null230
nullnull"baz"440
" - ], - "text/plain": [ - "shape: (2, 5)\n", - "┌──────┬──────┬──────┬─────┬─────┐\n", - "│ a ┆ b ┆ c ┆ d ┆ e │\n", - "│ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", - "│ str ┆ i64 ┆ str ┆ i64 ┆ i64 │\n", - "╞══════╪══════╪══════╪═════╪═════╡\n", - "│ baz ┆ 3 ┆ null ┆ 2 ┆ 30 │\n", - "│ null ┆ null ┆ baz ┆ 4 ┆ 40 │\n", - "└──────┴──────┴──────┴─────┴─────┘" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "str_filter_df(str_df, \"baz\")" ] }, { "cell_type": "code", - "execution_count": 30, - "id": "343329d2-6939-4077-b5cd-eb8abe43c297", + "execution_count": null, + "id": "6", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "shape: (3, 5)
abcde
stri64stri64i64
"foobar"2null1-5
"baz"3null230
nullnull"baz"440
" - ], - "text/plain": [ - "shape: (3, 5)\n", - "┌────────┬──────┬──────┬─────┬─────┐\n", - "│ a ┆ b ┆ c ┆ d ┆ e │\n", - "│ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", - "│ str ┆ i64 ┆ str ┆ i64 ┆ i64 │\n", - "╞════════╪══════╪══════╪═════╪═════╡\n", - "│ foobar ┆ 2 ┆ null ┆ 1 ┆ -5 │\n", - "│ baz ┆ 3 ┆ null ┆ 2 ┆ 30 │\n", - "│ null ┆ null ┆ baz ┆ 4 ┆ 40 │\n", - "└────────┴──────┴──────┴─────┴─────┘" - ] - }, - "execution_count": 30, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "str_filter_df(str_df, \"ba\")" ] }, { "cell_type": "code", - "execution_count": 32, - "id": "51b09c5a-82f0-40da-bb39-be3d40df477f", + "execution_count": null, + "id": "7", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "shape: (2, 5)
abcde
stri64stri64i64
"foo"1null02
"baz"3null230
" - ], - "text/plain": [ - "shape: (2, 5)\n", - "┌─────┬─────┬──────┬─────┬─────┐\n", - "│ a ┆ b ┆ c ┆ d ┆ e │\n", - "│ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", - "│ str ┆ i64 ┆ str ┆ i64 ┆ i64 │\n", - "╞═════╪═════╪══════╪═════╪═════╡\n", - "│ foo ┆ 1 ┆ null ┆ 0 ┆ 2 │\n", - "│ baz ┆ 3 ┆ null ┆ 2 ┆ 30 │\n", - "└─────┴─────┴──────┴─────┴─────┘" - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "str_df.filter(pl.col('e').gt(1), pl.col('e').lt(35))" ] }, { "cell_type": "code", - "execution_count": 35, - "id": "353c77a9-5185-4376-a124-3b798a8db580", + "execution_count": null, + "id": "8", "metadata": { "tags": [] }, @@ -248,51 +133,20 @@ }, { "cell_type": "code", - "execution_count": 36, - "id": "3a1734ce-d744-4dc6-bf18-a4ed2960e3b2", + "execution_count": null, + "id": "9", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "shape: (4, 5)
abcde
stri64stri64i64
"foo"1null02
"baz"3null230
nullnull"foo"31
nullnull"baz"440
" - ], - "text/plain": [ - "shape: (4, 5)\n", - "┌──────┬──────┬──────┬─────┬─────┐\n", - "│ a ┆ b ┆ c ┆ d ┆ e │\n", - "│ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", - "│ str ┆ i64 ┆ str ┆ i64 ┆ i64 │\n", - "╞══════╪══════╪══════╪═════╪═════╡\n", - "│ foo ┆ 1 ┆ null ┆ 0 ┆ 2 │\n", - "│ baz ┆ 3 ┆ null ┆ 2 ┆ 30 │\n", - "│ null ┆ null ┆ foo ┆ 3 ┆ 1 │\n", - "│ null ┆ null ┆ baz ┆ 4 ┆ 40 │\n", - "└──────┴──────┴──────┴─────┴─────┘" - ] - }, - "execution_count": 36, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "range_filter_df(str_df, 'e', 0, None)" ] }, { "cell_type": "code", - "execution_count": 19, - "id": "c5fa0bf6-67fd-4b79-ad25-334774b33f90", + "execution_count": null, + "id": "10", "metadata": { "tags": [] }, @@ -303,26 +157,12 @@ }, { "cell_type": "code", - "execution_count": 21, - "id": "ce9cc0bf-e6c7-4d2b-9232-7efd09ed85a0", + "execution_count": null, + "id": "11", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "[(col(\"a\").str.contains([String(foo)])) | (col(\"c\").str.contains([String(foo)]))]" - ], - "text/plain": [ - "" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "def or_join(a,b):\n", " return a|b\n", @@ -331,8 +171,8 @@ }, { "cell_type": "code", - "execution_count": 23, - "id": "ee4d83fa-3b34-4aa5-b09b-a217840c9736", + "execution_count": null, + "id": "12", "metadata": { "tags": [] }, @@ -350,147 +190,48 @@ }, { "cell_type": "code", - "execution_count": 22, - "id": "97525181-6c67-442d-9235-2afa32e03973", + "execution_count": null, + "id": "13", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "shape: (3, 4)
abcd
stri64stri64
"foo"1null0
"foobar"2null1
nullnull"foo"3
" - ], - "text/plain": [ - "shape: (3, 4)\n", - "┌────────┬──────┬──────┬─────┐\n", - "│ a ┆ b ┆ c ┆ d │\n", - "│ --- ┆ --- ┆ --- ┆ --- │\n", - "│ str ┆ i64 ┆ str ┆ i64 │\n", - "╞════════╪══════╪══════╪═════╡\n", - "│ foo ┆ 1 ┆ null ┆ 0 │\n", - "│ foobar ┆ 2 ┆ null ┆ 1 │\n", - "│ null ┆ null ┆ foo ┆ 3 │\n", - "└────────┴──────┴──────┴─────┘" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "str_df.filter(reduce(or_join, [pl.col(c).str.contains('foo') for c in str_df.select(pl.col(pl.String)).columns]))" ] }, { "cell_type": "code", - "execution_count": 18, - "id": "f1f9d364-7e08-45d6-9126-70c3cdd14be3", + "execution_count": null, + "id": "14", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/plain": [ - "[,\n", - " ]" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "r[pl.col(c).str.contains('foo') for c in str_df.select(pl.col(pl.String)).columns]" ] }, { "cell_type": "code", - "execution_count": 17, - "id": "d2e64d2b-0351-4ba9-a68f-961031413c90", + "execution_count": null, + "id": "15", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "shape: (0, 4)
abcd
stri64stri64
" - ], - "text/plain": [ - "shape: (0, 4)\n", - "┌─────┬─────┬─────┬─────┐\n", - "│ a ┆ b ┆ c ┆ d │\n", - "│ --- ┆ --- ┆ --- ┆ --- │\n", - "│ str ┆ i64 ┆ str ┆ i64 │\n", - "╞═════╪═════╪═════╪═════╡\n", - "└─────┴─────┴─────┴─────┘" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "str_df.filter(*[pl.col(c).str.contains('foo') for c in str_df.select(pl.col(pl.String)).columns])" ] }, { "cell_type": "code", - "execution_count": 13, - "id": "a8b06dbb-f302-4a7b-a255-b229b166e1a9", + "execution_count": null, + "id": "16", "metadata": { "tags": [] }, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "shape: (3, 4)
abcd
stri64stri64
"foo"1null0
"foobar"2null1
nullnull"foo"3
" - ], - "text/plain": [ - "shape: (3, 4)\n", - "┌────────┬──────┬──────┬─────┐\n", - "│ a ┆ b ┆ c ┆ d │\n", - "│ --- ┆ --- ┆ --- ┆ --- │\n", - "│ str ┆ i64 ┆ str ┆ i64 │\n", - "╞════════╪══════╪══════╪═════╡\n", - "│ foo ┆ 1 ┆ null ┆ 0 │\n", - "│ foobar ┆ 2 ┆ null ┆ 1 │\n", - "│ null ┆ null ┆ foo ┆ 3 │\n", - "└────────┴──────┴──────┴─────┘" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "#str_df.filter(F.col(pl.String))\n", "str_df.filter(pl.col('a').str.contains('foo')|pl.col('c').str.contains('foo'))" @@ -498,26 +239,12 @@ }, { "cell_type": "code", - "execution_count": 37, - "id": "2c5dfa40-f32a-4e4a-8231-9aabc23e090a", + "execution_count": null, + "id": "17", "metadata": { "tags": [] }, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'np' is not defined", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[37], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbuckaroo\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpolars_buckaroo\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m PolarsBuckarooWidget\n\u001b[1;32m 2\u001b[0m PBW \u001b[38;5;241m=\u001b[39m PolarsBuckarooWidget\n", - "File \u001b[0;32m~/buckaroo/buckaroo/polars_buckaroo.py:7\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpluggable_analysis_framework\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpolars_analysis_management\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m 5\u001b[0m PlDfStats)\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mserialization_utils\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m pd_to_obj\n\u001b[0;32m----> 7\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mbuckaroo\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcustomizations\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpolars_commands\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m (\n\u001b[1;32m 8\u001b[0m DropCol, FillNA, GroupBy \u001b[38;5;66;03m#, OneHot, GroupBy, reindex\u001b[39;00m\n\u001b[1;32m 9\u001b[0m )\n\u001b[1;32m 10\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mcustomizations\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mstyling\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m DefaultSummaryStatsStyling, DefaultMainStyling\n\u001b[1;32m 11\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdataflow\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mdataflow\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m Sampling\n", - "File \u001b[0;32m~/buckaroo/buckaroo/customizations/polars_commands.py:147\u001b[0m\n\u001b[1;32m 141\u001b[0m orred_clause \u001b[38;5;241m=\u001b[39m reduce(or_join, clauses)\n\u001b[1;32m 142\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m df\u001b[38;5;241m.\u001b[39mfilter(orred_clause)\n\u001b[1;32m 143\u001b[0m str_df \u001b[38;5;241m=\u001b[39m pl\u001b[38;5;241m.\u001b[39mDataFrame({\n\u001b[1;32m 144\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124ma\u001b[39m\u001b[38;5;124m'\u001b[39m: [\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfoo\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfoobar\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbaz\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;28;01mNone\u001b[39;00m], \n\u001b[1;32m 145\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mb\u001b[39m\u001b[38;5;124m'\u001b[39m: [ \u001b[38;5;241m1\u001b[39m, \u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m3\u001b[39m, \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;28;01mNone\u001b[39;00m], \n\u001b[1;32m 146\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mc\u001b[39m\u001b[38;5;124m'\u001b[39m: [ \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfoo\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbaz\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[0;32m--> 147\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124md\u001b[39m\u001b[38;5;124m'\u001b[39m: \u001b[43mnp\u001b[49m\u001b[38;5;241m.\u001b[39marange(\u001b[38;5;241m5\u001b[39m),\n\u001b[1;32m 148\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124me\u001b[39m\u001b[38;5;124m'\u001b[39m: [ \u001b[38;5;241m2\u001b[39m, \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m5\u001b[39m, \u001b[38;5;241m30\u001b[39m, \u001b[38;5;241m1\u001b[39m, \u001b[38;5;241m40\u001b[39m]\n\u001b[1;32m 149\u001b[0m })\n\u001b[1;32m 150\u001b[0m str_df\n\u001b[1;32m 151\u001b[0m str_filter_df(str_df, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbaz\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", - "\u001b[0;31mNameError\u001b[0m: name 'np' is not defined" - ] - } - ], + "outputs": [], "source": [ "from buckaroo.polars_buckaroo import PolarsBuckarooWidget\n", "PBW = PolarsBuckarooWidget" @@ -526,7 +253,7 @@ { "cell_type": "code", "execution_count": null, - "id": "93d2211d-fe22-4b97-9506-0635b0c2ed92", + "id": "18", "metadata": {}, "outputs": [], "source": [] @@ -549,1514 +276,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": { - "53269158b91e412cb3de66f700483faa": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - }, - "711c3b609a664bbaa6d9c1eb5f9b8798": { - "model_module": "buckaroo", - "model_module_version": "^0.6.5", - "model_name": "DCEFWidgetModel", - "state": { - "_model_module_version": "^0.6.5", - "_view_module_version": "^0.6.5", - "_view_name": "DCEFWidgetView", - "buckaroo_options": { - "auto_clean": [ - "aggressive", - "conservative" - ], - "df_display": [ - "summary", - "main" - ], - "post_processing": [ - "" - ], - "sampled": [ - "random" - ], - "show_commands": [ - "on" - ], - "summary_stats": [ - "all" - ] - }, - "buckaroo_state": { - "auto_clean": "conservative", - "df_display": "main", - "post_processing": "", - "sampled": false, - "search_string": "", - "show_commands": false - }, - "commandConfig": {}, - "df_data_dict": { - "all_stats": [ - { - "a": "shape: (4,)\nSeries: '' [struct[2]]\n[\n\t{null,2}\n\t{\"foo\",1}\n\t{\"foobar\",1}\n\t{\"baz\",1}\n]", - "b": "shape: (4,)\nSeries: '' [struct[2]]\n[\n\t{null,2}\n\t{1,1}\n\t{2,1}\n\t{3,1}\n]", - "c": "shape: (3,)\nSeries: '' [struct[2]]\n[\n\t{null,3}\n\t{\"foo\",1}\n\t{\"baz\",1}\n]", - "d": "shape: (5,)\nSeries: '' [struct[2]]\n[\n\t{0,1}\n\t{1,1}\n\t{2,1}\n\t{3,1}\n\t{4,1}\n]", - "e": "shape: (5,)\nSeries: '' [struct[2]]\n[\n\t{2,1}\n\t{-5,1}\n\t{30,1}\n\t{1,1}\n\t{40,1}\n]", - "index": "value_counts" - }, - { - "a": "String", - "b": "Int64", - "c": "String", - "d": "Int64", - "e": "Int64", - "index": "dtype" - }, - { - "a": "string", - "b": "integer", - "c": "string", - "d": "integer", - "e": "integer", - "index": "_type" - }, - { - "a": false, - "b": true, - "c": false, - "d": true, - "e": true, - "index": "is_numeric" - }, - { - "a": false, - "b": true, - "c": false, - "d": true, - "e": true, - "index": "is_integer" - }, - { - "a": 5, - "b": 5, - "c": 5, - "d": 5, - "e": 5, - "index": "length" - }, - { - "a": 2, - "b": 2, - "c": 3, - "d": 0, - "e": 0, - "index": "nan_count" - }, - { - "a": "baz", - "b": 1, - "c": "baz", - "d": 0, - "e": -5, - "index": "min" - }, - { - "a": "foobar", - "b": 3, - "c": "foo", - "d": 4, - "e": 40, - "index": "max" - }, - { - "a": null, - "b": null, - "c": null, - "d": 0, - "e": 2, - "index": "mode" - }, - { - "a": null, - "b": 2, - "c": null, - "d": 2, - "e": 13.6, - "index": "mean" - }, - { - "a": 3, - "b": 3, - "c": 2, - "d": 5, - "e": 5, - "index": "unique_count" - }, - { - "a": 0, - "b": 0, - "c": 0, - "d": 0, - "e": 0, - "index": "empty_count" - }, - { - "a": 4, - "b": 4, - "c": 3, - "d": 5, - "e": 5, - "index": "distinct_count" - }, - { - "a": 0.8, - "b": 0.8, - "c": 0.6, - "d": 1, - "e": 1, - "index": "distinct_per" - }, - { - "a": 0, - "b": 0, - "c": 0, - "d": 0, - "e": 0, - "index": "empty_per" - }, - { - "a": 0.6, - "b": 0.6, - "c": 0.4, - "d": 1, - "e": 1, - "index": "unique_per" - }, - { - "a": 0.4, - "b": 0.4, - "c": 0.6, - "d": 0, - "e": 0, - "index": "nan_per" - }, - { - "a": { - "None": 0.4, - "baz": 0.2, - "foo": 0.2, - "foobar": 0.2, - "longtail": -0.6, - "unique": 0.6 - }, - "b": { - "1": 0.2, - "2": 0.2, - "3": 0.2, - "None": 0.4, - "longtail": -0.6, - "unique": 0.6 - }, - "c": { - "None": 0.6, - "baz": 0.2, - "foo": 0.2, - "longtail": -0.4, - "unique": 0.4 - }, - "d": { - "0": 0.2, - "1": 0.2, - "2": 0.2, - "3": 0.2, - "4": 0.2, - "longtail": -1, - "unique": 1 - }, - "e": { - "-5": 0.2, - "1": 0.2, - "2": 0.2, - "30": 0.2, - "40": 0.2, - "longtail": -1, - "unique": 1 - }, - "index": "categorical_histogram" - }, - { - "a": [ - { - "cat_pop": 40, - "name": null - }, - { - "cat_pop": 20, - "name": "foo" - }, - { - "cat_pop": 20, - "name": "foobar" - }, - { - "cat_pop": 20, - "name": "baz" - }, - { - "name": "unique", - "unique": 60 - }, - { - "NA": 40, - "name": "NA" - } - ], - "b": [ - { - "cat_pop": 40, - "name": null - }, - { - "cat_pop": 20, - "name": 1 - }, - { - "cat_pop": 20, - "name": 2 - }, - { - "cat_pop": 20, - "name": 3 - }, - { - "name": "unique", - "unique": 60 - }, - { - "NA": 40, - "name": "NA" - } - ], - "c": [ - { - "cat_pop": 60, - "name": null - }, - { - "cat_pop": 20, - "name": "foo" - }, - { - "cat_pop": 20, - "name": "baz" - }, - { - "name": "unique", - "unique": 40 - }, - { - "NA": 60, - "name": "NA" - } - ], - "d": [ - { - "cat_pop": 20, - "name": 0 - }, - { - "cat_pop": 20, - "name": 1 - }, - { - "cat_pop": 20, - "name": 2 - }, - { - "cat_pop": 20, - "name": 3 - }, - { - "cat_pop": 20, - "name": 4 - }, - { - "name": "unique", - "unique": 100 - } - ], - "e": [ - { - "cat_pop": 20, - "name": 2 - }, - { - "cat_pop": 20, - "name": -5 - }, - { - "cat_pop": 20, - "name": 30 - }, - { - "cat_pop": 20, - "name": 1 - }, - { - "cat_pop": 20, - "name": 40 - }, - { - "name": "unique", - "unique": 100 - } - ], - "index": "histogram" - }, - { - "a": [ - "faked" - ], - "b": [ - "faked" - ], - "c": [ - "faked" - ], - "d": [ - "faked" - ], - "e": [ - "faked" - ], - "index": "histogram_bins" - }, - { - "a": null, - "b": { - "high_tail": 3, - "low_tail": 1, - "meat_histogram": [ - [ - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0 - ], - [ - 1, - 1.2, - 1.4, - 1.6, - 1.8, - 2, - 2.2, - 2.4, - 2.6, - 2.8, - 3 - ] - ], - "normalized_populations": [ - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0 - ] - }, - "c": null, - "d": { - "high_tail": 4, - "low_tail": 0, - "meat_histogram": [ - [ - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 0 - ], - [ - 0, - 0.4, - 0.8, - 1.2, - 1.6, - 2, - 2.4, - 2.8, - 3.2, - 3.6, - 4 - ] - ], - "normalized_populations": [ - 0, - 0, - 0.3333333333, - 0, - 0.3333333333, - 0, - 0, - 0.3333333333, - 0, - 0 - ] - }, - "e": { - "high_tail": 40, - "low_tail": -5, - "meat_histogram": [ - [ - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1 - ], - [ - -5, - 3.1, - 6.2, - 9.3, - 12.4, - 15.5, - 18.6, - 21.7, - 24.8, - 27.9, - 40 - ] - ], - "normalized_populations": [ - 0.6666666667, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0.3333333333 - ] - }, - "index": "histogram_args" - } - ], - "empty": [], - "main": [ - { - "a": "foo", - "b": 1, - "c": null, - "d": 0, - "e": 2, - "index": 0 - }, - { - "a": "foobar", - "b": 2, - "c": null, - "d": 1, - "e": -5, - "index": 1 - }, - { - "a": "baz", - "b": 3, - "c": null, - "d": 2, - "e": 30, - "index": 2 - }, - { - "a": null, - "b": null, - "c": "foo", - "d": 3, - "e": 1, - "index": 3 - }, - { - "a": null, - "b": null, - "c": "baz", - "d": 4, - "e": 40, - "index": 4 - } - ] - }, - "df_display_args": { - "main": { - "data_key": "main", - "df_viewer_config": { - "column_config": [ - { - "col_name": "index", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "a", - "displayer_args": { - "displayer": "string", - "max_length": 35 - } - }, - { - "col_name": "b", - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - } - }, - { - "col_name": "c", - "displayer_args": { - "displayer": "string", - "max_length": 35 - } - }, - { - "col_name": "d", - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - } - }, - { - "col_name": "e", - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - } - } - ], - "component_config": {}, - "extra_grid_config": {}, - "pinned_rows": [ - { - "displayer_args": { - "displayer": "obj" - }, - "primary_key_val": "dtype" - }, - { - "displayer_args": { - "displayer": "histogram" - }, - "primary_key_val": "histogram" - } - ] - }, - "summary_stats_key": "all_stats" - }, - "summary": { - "data_key": "empty", - "df_viewer_config": { - "column_config": [ - { - "col_name": "index", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "a", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "b", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "c", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "d", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "e", - "displayer_args": { - "displayer": "obj" - } - } - ], - "component_config": {}, - "extra_grid_config": {}, - "pinned_rows": [ - { - "displayer_args": { - "displayer": "obj" - }, - "primary_key_val": "dtype" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 3, - "min_fraction_digits": 3 - }, - "primary_key_val": "min" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 3, - "min_fraction_digits": 3 - }, - "primary_key_val": "mean" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 3, - "min_fraction_digits": 3 - }, - "primary_key_val": "max" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - }, - "primary_key_val": "unique_count" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - }, - "primary_key_val": "distinct_count" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - }, - "primary_key_val": "empty_count" - } - ] - }, - "summary_stats_key": "all_stats" - } - }, - "df_meta": { - "columns": 5, - "rows_shown": 5, - "total_rows": 5 - }, - "layout": "IPY_MODEL_e9fb1ebf420a4760aba7600bfa695f9f", - "operation_results": { - "generated_py_code": "# instantiation, unused", - "transformed_df": { - "column_config": [], - "data": [], - "pinned_rows": [] - } - }, - "operations": [] - } - }, - "93ae12978dff457d9ecdf4bb6ad7d66d": { - "model_module": "buckaroo", - "model_module_version": "^0.6.5", - "model_name": "DCEFWidgetModel", - "state": { - "_model_module_version": "^0.6.5", - "_view_module_version": "^0.6.5", - "_view_name": "DCEFWidgetView", - "buckaroo_options": { - "auto_clean": [ - "aggressive", - "conservative" - ], - "df_display": [ - "summary", - "main" - ], - "post_processing": [ - "" - ], - "sampled": [ - "random" - ], - "show_commands": [ - "on" - ], - "summary_stats": [ - "all" - ] - }, - "buckaroo_state": { - "auto_clean": "conservative", - "df_display": "main", - "post_processing": "", - "sampled": false, - "search_string": "", - "show_commands": "on" - }, - "commandConfig": {}, - "df_data_dict": { - "all_stats": [ - { - "a": "shape: (4,)\nSeries: '' [struct[2]]\n[\n\t{null,2}\n\t{\"foo\",1}\n\t{\"foobar\",1}\n\t{\"baz\",1}\n]", - "b": "shape: (4,)\nSeries: '' [struct[2]]\n[\n\t{null,2}\n\t{1,1}\n\t{2,1}\n\t{3,1}\n]", - "c": "shape: (3,)\nSeries: '' [struct[2]]\n[\n\t{null,3}\n\t{\"foo\",1}\n\t{\"baz\",1}\n]", - "d": "shape: (5,)\nSeries: '' [struct[2]]\n[\n\t{0,1}\n\t{1,1}\n\t{2,1}\n\t{3,1}\n\t{4,1}\n]", - "e": "shape: (5,)\nSeries: '' [struct[2]]\n[\n\t{2,1}\n\t{-5,1}\n\t{30,1}\n\t{1,1}\n\t{40,1}\n]", - "index": "value_counts" - }, - { - "a": "String", - "b": "Int64", - "c": "String", - "d": "Int64", - "e": "Int64", - "index": "dtype" - }, - { - "a": "string", - "b": "integer", - "c": "string", - "d": "integer", - "e": "integer", - "index": "_type" - }, - { - "a": false, - "b": true, - "c": false, - "d": true, - "e": true, - "index": "is_numeric" - }, - { - "a": false, - "b": true, - "c": false, - "d": true, - "e": true, - "index": "is_integer" - }, - { - "a": 5, - "b": 5, - "c": 5, - "d": 5, - "e": 5, - "index": "length" - }, - { - "a": 2, - "b": 2, - "c": 3, - "d": 0, - "e": 0, - "index": "nan_count" - }, - { - "a": "baz", - "b": 1, - "c": "baz", - "d": 0, - "e": -5, - "index": "min" - }, - { - "a": "foobar", - "b": 3, - "c": "foo", - "d": 4, - "e": 40, - "index": "max" - }, - { - "a": null, - "b": null, - "c": null, - "d": 0, - "e": 2, - "index": "mode" - }, - { - "a": null, - "b": 2, - "c": null, - "d": 2, - "e": 13.6, - "index": "mean" - }, - { - "a": 3, - "b": 3, - "c": 2, - "d": 5, - "e": 5, - "index": "unique_count" - }, - { - "a": 0, - "b": 0, - "c": 0, - "d": 0, - "e": 0, - "index": "empty_count" - }, - { - "a": 4, - "b": 4, - "c": 3, - "d": 5, - "e": 5, - "index": "distinct_count" - }, - { - "a": 0.8, - "b": 0.8, - "c": 0.6, - "d": 1, - "e": 1, - "index": "distinct_per" - }, - { - "a": 0, - "b": 0, - "c": 0, - "d": 0, - "e": 0, - "index": "empty_per" - }, - { - "a": 0.6, - "b": 0.6, - "c": 0.4, - "d": 1, - "e": 1, - "index": "unique_per" - }, - { - "a": 0.4, - "b": 0.4, - "c": 0.6, - "d": 0, - "e": 0, - "index": "nan_per" - }, - { - "a": { - "None": 0.4, - "baz": 0.2, - "foo": 0.2, - "foobar": 0.2, - "longtail": -0.6, - "unique": 0.6 - }, - "b": { - "1": 0.2, - "2": 0.2, - "3": 0.2, - "None": 0.4, - "longtail": -0.6, - "unique": 0.6 - }, - "c": { - "None": 0.6, - "baz": 0.2, - "foo": 0.2, - "longtail": -0.4, - "unique": 0.4 - }, - "d": { - "0": 0.2, - "1": 0.2, - "2": 0.2, - "3": 0.2, - "4": 0.2, - "longtail": -1, - "unique": 1 - }, - "e": { - "-5": 0.2, - "1": 0.2, - "2": 0.2, - "30": 0.2, - "40": 0.2, - "longtail": -1, - "unique": 1 - }, - "index": "categorical_histogram" - }, - { - "a": [ - { - "cat_pop": 40, - "name": null - }, - { - "cat_pop": 20, - "name": "foo" - }, - { - "cat_pop": 20, - "name": "foobar" - }, - { - "cat_pop": 20, - "name": "baz" - }, - { - "name": "unique", - "unique": 60 - }, - { - "NA": 40, - "name": "NA" - } - ], - "b": [ - { - "cat_pop": 40, - "name": null - }, - { - "cat_pop": 20, - "name": 1 - }, - { - "cat_pop": 20, - "name": 2 - }, - { - "cat_pop": 20, - "name": 3 - }, - { - "name": "unique", - "unique": 60 - }, - { - "NA": 40, - "name": "NA" - } - ], - "c": [ - { - "cat_pop": 60, - "name": null - }, - { - "cat_pop": 20, - "name": "foo" - }, - { - "cat_pop": 20, - "name": "baz" - }, - { - "name": "unique", - "unique": 40 - }, - { - "NA": 60, - "name": "NA" - } - ], - "d": [ - { - "cat_pop": 20, - "name": 0 - }, - { - "cat_pop": 20, - "name": 1 - }, - { - "cat_pop": 20, - "name": 2 - }, - { - "cat_pop": 20, - "name": 3 - }, - { - "cat_pop": 20, - "name": 4 - }, - { - "name": "unique", - "unique": 100 - } - ], - "e": [ - { - "cat_pop": 20, - "name": 2 - }, - { - "cat_pop": 20, - "name": -5 - }, - { - "cat_pop": 20, - "name": 30 - }, - { - "cat_pop": 20, - "name": 1 - }, - { - "cat_pop": 20, - "name": 40 - }, - { - "name": "unique", - "unique": 100 - } - ], - "index": "histogram" - }, - { - "a": [ - "faked" - ], - "b": [ - "faked" - ], - "c": [ - "faked" - ], - "d": [ - "faked" - ], - "e": [ - "faked" - ], - "index": "histogram_bins" - }, - { - "a": null, - "b": { - "high_tail": 3, - "low_tail": 1, - "meat_histogram": [ - [ - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0 - ], - [ - 1, - 1.2, - 1.4, - 1.6, - 1.8, - 2, - 2.2, - 2.4, - 2.6, - 2.8, - 3 - ] - ], - "normalized_populations": [ - 0, - 0, - 0, - 0, - 1, - 0, - 0, - 0, - 0, - 0 - ] - }, - "c": null, - "d": { - "high_tail": 4, - "low_tail": 0, - "meat_histogram": [ - [ - 0, - 0, - 1, - 0, - 1, - 0, - 0, - 1, - 0, - 0 - ], - [ - 0, - 0.4, - 0.8, - 1.2, - 1.6, - 2, - 2.4, - 2.8, - 3.2, - 3.6, - 4 - ] - ], - "normalized_populations": [ - 0, - 0, - 0.3333333333, - 0, - 0.3333333333, - 0, - 0, - 0.3333333333, - 0, - 0 - ] - }, - "e": { - "high_tail": 40, - "low_tail": -5, - "meat_histogram": [ - [ - 2, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 1 - ], - [ - -5, - 3.1, - 6.2, - 9.3, - 12.4, - 15.5, - 18.6, - 21.7, - 24.8, - 27.9, - 40 - ] - ], - "normalized_populations": [ - 0.6666666667, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0.3333333333 - ] - }, - "index": "histogram_args" - } - ], - "empty": [], - "main": [ - { - "a": "foo", - "b": 1, - "c": null, - "d": 0, - "e": 2, - "index": 0 - }, - { - "a": "foobar", - "b": 2, - "c": null, - "d": 1, - "e": -5, - "index": 1 - }, - { - "a": "baz", - "b": 3, - "c": null, - "d": 2, - "e": 30, - "index": 2 - }, - { - "a": null, - "b": null, - "c": "foo", - "d": 3, - "e": 1, - "index": 3 - }, - { - "a": null, - "b": null, - "c": "baz", - "d": 4, - "e": 40, - "index": 4 - } - ] - }, - "df_display_args": { - "main": { - "data_key": "main", - "df_viewer_config": { - "column_config": [ - { - "col_name": "index", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "a", - "displayer_args": { - "displayer": "string", - "max_length": 35 - } - }, - { - "col_name": "b", - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - } - }, - { - "col_name": "c", - "displayer_args": { - "displayer": "string", - "max_length": 35 - } - }, - { - "col_name": "d", - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - } - }, - { - "col_name": "e", - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - } - } - ], - "component_config": {}, - "extra_grid_config": {}, - "pinned_rows": [ - { - "displayer_args": { - "displayer": "obj" - }, - "primary_key_val": "dtype" - }, - { - "displayer_args": { - "displayer": "histogram" - }, - "primary_key_val": "histogram" - } - ] - }, - "summary_stats_key": "all_stats" - }, - "summary": { - "data_key": "empty", - "df_viewer_config": { - "column_config": [ - { - "col_name": "index", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "a", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "b", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "c", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "d", - "displayer_args": { - "displayer": "obj" - } - }, - { - "col_name": "e", - "displayer_args": { - "displayer": "obj" - } - } - ], - "component_config": {}, - "extra_grid_config": {}, - "pinned_rows": [ - { - "displayer_args": { - "displayer": "obj" - }, - "primary_key_val": "dtype" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 3, - "min_fraction_digits": 3 - }, - "primary_key_val": "min" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 3, - "min_fraction_digits": 3 - }, - "primary_key_val": "mean" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 3, - "min_fraction_digits": 3 - }, - "primary_key_val": "max" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - }, - "primary_key_val": "unique_count" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - }, - "primary_key_val": "distinct_count" - }, - { - "displayer_args": { - "displayer": "float", - "max_fraction_digits": 0, - "min_fraction_digits": 0 - }, - "primary_key_val": "empty_count" - } - ] - }, - "summary_stats_key": "all_stats" - } - }, - "df_meta": { - "columns": 5, - "rows_shown": 5, - "total_rows": 5 - }, - "layout": "IPY_MODEL_53269158b91e412cb3de66f700483faa", - "operation_results": { - "generated_py_code": "# instantiation, unused", - "transformed_df": { - "column_config": [], - "data": [], - "pinned_rows": [] - } - }, - "operations": [] - } - }, - "e9fb1ebf420a4760aba7600bfa695f9f": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "2.0.0", - "model_name": "LayoutModel", - "state": {} - } - }, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Full-tour.ipynb b/docs/example-notebooks/Full-tour.ipynb index a6979554..10ef6aa3 100644 --- a/docs/example-notebooks/Full-tour.ipynb +++ b/docs/example-notebooks/Full-tour.ipynb @@ -249,13 +249,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.20" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/GeoPandas.ipynb b/docs/example-notebooks/GeoPandas.ipynb index 5d085407..45e77bc8 100644 --- a/docs/example-notebooks/GeoPandas.ipynb +++ b/docs/example-notebooks/GeoPandas.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5b17aae3-6857-4eda-b8e0-a5b824edbbf4", + "id": "0", "metadata": { "tags": [] }, @@ -16,7 +16,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8c2d060d-7430-4d54-855d-44cd9376cdab", + "id": "1", "metadata": { "tags": [] }, @@ -28,7 +28,7 @@ { "cell_type": "code", "execution_count": null, - "id": "147ecebd-952c-4fe0-832d-8b93421e69a1", + "id": "2", "metadata": { "tags": [] }, @@ -39,7 +39,7 @@ }, { "cell_type": "markdown", - "id": "f6622889-e4a7-4835-90f4-639492052eb5", + "id": "3", "metadata": {}, "source": [ "# Use GeopandasSVGBuckarooWidget to see renderings of geometry" @@ -48,7 +48,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6cc1aaea-6add-4b1b-901e-9abacb0425a4", + "id": "4", "metadata": { "tags": [] }, @@ -61,7 +61,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dea5fb3e-1e0c-41c0-bbe4-3f4564681665", + "id": "5", "metadata": { "tags": [] }, @@ -107,7 +107,7 @@ }, { "cell_type": "markdown", - "id": "04381d81-91d2-48ed-a10a-436a6bce568d", + "id": "6", "metadata": {}, "source": [ "## Tweaking row height\n", @@ -118,7 +118,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a69c95d7-d66d-4ca5-b11e-5b00c4b7e500", + "id": "7", "metadata": { "tags": [] }, @@ -130,7 +130,7 @@ { "cell_type": "code", "execution_count": null, - "id": "432e571c-e7dc-46b3-9707-f301033fee8a", + "id": "8", "metadata": { "tags": [] }, @@ -143,7 +143,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b309bab6-01f7-4a21-a895-b4075d4c757d", + "id": "9", "metadata": { "tags": [] }, @@ -159,7 +159,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bd9b37da-b9a8-4a22-a20d-81edde8060f8", + "id": "10", "metadata": { "tags": [] }, @@ -172,7 +172,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aae6abe4-227e-481a-9af7-daf9c25b0df1", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -202,13 +202,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Histograms-demo.ipynb b/docs/example-notebooks/Histograms-demo.ipynb index b30e5cae..2a3ee76a 100644 --- a/docs/example-notebooks/Histograms-demo.ipynb +++ b/docs/example-notebooks/Histograms-demo.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "75a6af82-5029-4d16-abf1-f0aeb0489957", + "id": "0", "metadata": { "tags": [] }, @@ -17,7 +17,7 @@ { "cell_type": "code", "execution_count": null, - "id": "aa9097b0-1c99-46b1-b966-06a9e47e57d6", + "id": "1", "metadata": { "tags": [] }, @@ -34,7 +34,7 @@ { "cell_type": "code", "execution_count": null, - "id": "91c4cf93-4a15-48ba-a1e9-a46683fcfccf", + "id": "2", "metadata": { "tags": [] }, @@ -77,7 +77,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9cfe316a-077c-4347-8b5e-c6048c16b5ca", + "id": "3", "metadata": { "tags": [] }, @@ -95,7 +95,7 @@ { "cell_type": "code", "execution_count": null, - "id": "36089fd7-cb7d-43d8-8e91-dbdf30f6a032", + "id": "4", "metadata": { "tags": [] }, @@ -120,7 +120,7 @@ { "cell_type": "code", "execution_count": null, - "id": "02d70ce5-4dc6-42ea-853e-b5d5e99d684f", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -136,7 +136,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0bb02641-0653-4ee7-86c5-7b058abaeb79", + "id": "6", "metadata": { "tags": [] }, @@ -154,7 +154,7 @@ { "cell_type": "code", "execution_count": null, - "id": "425e2df3-54cd-4127-bac7-549fe2c15520", + "id": "7", "metadata": { "tags": [] }, @@ -186,13 +186,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.20" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Itables-testcases.ipynb b/docs/example-notebooks/Itables-testcases.ipynb index f1b90cec..9867ff3b 100644 --- a/docs/example-notebooks/Itables-testcases.ipynb +++ b/docs/example-notebooks/Itables-testcases.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b45fa7dc-e098-40ee-adf4-c3a4c6a5545c", + "id": "0", "metadata": { "tags": [] }, @@ -16,7 +16,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8ddb9152-702f-4bcb-86c6-0de2a138bb89", + "id": "1", "metadata": { "tags": [] }, @@ -28,7 +28,7 @@ { "cell_type": "code", "execution_count": null, - "id": "053d0453-5615-4f7b-a519-bb67912b28da", + "id": "2", "metadata": { "tags": [] }, @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": null, - "id": "7969cc05-1ebe-4b72-beb5-7ea35174bfaa", + "id": "3", "metadata": { "tags": [] }, @@ -52,7 +52,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9b6cae85-33b9-425b-af7d-299c448a6ea1", + "id": "4", "metadata": { "tags": [] }, @@ -64,7 +64,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5d777553-3aeb-4467-99ef-b1a96cbaee8d", + "id": "5", "metadata": { "tags": [] }, @@ -76,7 +76,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9e9f4664-9139-4fbd-974d-f16efe53b608", + "id": "6", "metadata": { "tags": [] }, @@ -88,7 +88,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1ac46685-7288-467b-afad-a4d7699a998a", + "id": "7", "metadata": { "tags": [] }, @@ -100,7 +100,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0748b5cf-1166-4208-94e6-b64b7859e356", + "id": "8", "metadata": { "tags": [] }, @@ -112,7 +112,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a4fafb72-1011-4048-a4b4-4c16b7924e02", + "id": "9", "metadata": { "tags": [] }, @@ -124,7 +124,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f8b40fbd-1b9a-4c3f-8d72-3fc0b7855dc6", + "id": "10", "metadata": { "tags": [] }, @@ -136,7 +136,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cdaa4682-e2d6-4d89-9b46-eb7313855903", + "id": "11", "metadata": { "tags": [] }, @@ -148,7 +148,7 @@ { "cell_type": "code", "execution_count": null, - "id": "cdc821e1-e3f9-4846-ad06-74a887a6ee84", + "id": "12", "metadata": { "tags": [] }, @@ -160,7 +160,7 @@ { "cell_type": "code", "execution_count": null, - "id": "f4bf7e0f-3c80-4fbe-b59f-aa49febc3a38", + "id": "13", "metadata": { "tags": [] }, @@ -172,7 +172,7 @@ { "cell_type": "code", "execution_count": null, - "id": "857e6532-c352-49f1-a2f2-fd0125144207", + "id": "14", "metadata": { "tags": [] }, @@ -184,7 +184,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d5479ba8-9f55-48e6-9a6c-fe9ee246c91a", + "id": "15", "metadata": { "tags": [] }, @@ -196,7 +196,7 @@ { "cell_type": "code", "execution_count": null, - "id": "23be7ceb-de1a-44e8-91e0-2cc894399854", + "id": "16", "metadata": { "tags": [] }, @@ -208,7 +208,7 @@ { "cell_type": "code", "execution_count": null, - "id": "92856cdc-a024-4232-b849-15bab83c16e1", + "id": "17", "metadata": { "tags": [] }, @@ -220,7 +220,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8d7d9912-2a13-4153-af4c-1239a929bc7e", + "id": "18", "metadata": { "tags": [] }, @@ -232,7 +232,7 @@ { "cell_type": "code", "execution_count": null, - "id": "70329ae8-99a5-4b9c-9128-9c3fc2b6362b", + "id": "19", "metadata": { "tags": [] }, @@ -244,7 +244,7 @@ { "cell_type": "code", "execution_count": null, - "id": "998748f6-a664-4cf6-9388-ab9ab742e069", + "id": "20", "metadata": { "tags": [] }, @@ -256,7 +256,7 @@ { "cell_type": "code", "execution_count": null, - "id": "622a3fc5-ca35-4c5c-b48f-b2749ecaac87", + "id": "21", "metadata": { "tags": [] }, @@ -268,7 +268,7 @@ { "cell_type": "code", "execution_count": null, - "id": "929ab710-d645-4376-99ac-dfcc43a247c6", + "id": "22", "metadata": { "tags": [] }, @@ -280,7 +280,7 @@ { "cell_type": "code", "execution_count": null, - "id": "204d1b91-b58b-45d8-8b73-ff212b962abb", + "id": "23", "metadata": { "tags": [] }, @@ -292,7 +292,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a5b35a2b-34c4-455c-9653-eb10b0249344", + "id": "24", "metadata": { "tags": [] }, @@ -304,7 +304,7 @@ { "cell_type": "code", "execution_count": null, - "id": "37b655c1-4937-4ba1-898f-3e225d71a178", + "id": "25", "metadata": { "tags": [] }, @@ -331,13 +331,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.5" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Pluggable-Analysis-Framework.ipynb b/docs/example-notebooks/Pluggable-Analysis-Framework.ipynb index cad92b0c..c80a8a99 100644 --- a/docs/example-notebooks/Pluggable-Analysis-Framework.ipynb +++ b/docs/example-notebooks/Pluggable-Analysis-Framework.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "375845a4-837a-4a32-a84a-ddb0d546878b", + "id": "0", "metadata": { "tags": [] }, @@ -18,7 +18,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9b04f052-6973-4d29-b637-1d350d86798f", + "id": "1", "metadata": { "tags": [] }, @@ -36,7 +36,7 @@ }, { "cell_type": "markdown", - "id": "441e9e82-34ec-4359-9000-dff97f537e12", + "id": "2", "metadata": {}, "source": [ "**These docs need updating for 0.5** Take a look at the [customizations](https://github.com/paddymul/buckaroo/tree/main/buckaroo/customizations) directory in the codebase and file some bugs asking for your suggested improvement. I expect to add a lot more xamples around the 0.6 series" @@ -44,7 +44,7 @@ }, { "cell_type": "markdown", - "id": "a1ec3e18-1649-49d2-8e3b-8e93236d93e1", + "id": "3", "metadata": {}, "source": [ "# Adding a summary stat\n", @@ -60,7 +60,7 @@ { "cell_type": "code", "execution_count": null, - "id": "63fab4e4-5dbb-4b34-ae7c-b4b065d0ed26", + "id": "4", "metadata": {}, "outputs": [], "source": [ @@ -71,7 +71,7 @@ { "cell_type": "code", "execution_count": null, - "id": "67d6d3da-cc93-4566-b542-74c8cd5758b9", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -99,7 +99,7 @@ }, { "cell_type": "markdown", - "id": "ffdd52ed-443c-4ec3-9063-b067e779cbc4", + "id": "6", "metadata": {}, "source": [ "## Basic Unit testing is built in\n", @@ -110,7 +110,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1f3c58fc-b742-4251-9778-e1a33bf4f500", + "id": "7", "metadata": { "tags": [] }, @@ -150,7 +150,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c8faf375-9aa5-4904-a228-08592cb8ad66", + "id": "8", "metadata": {}, "outputs": [], "source": [ @@ -160,7 +160,7 @@ }, { "cell_type": "markdown", - "id": "d28c3fb7-62bf-48db-ae68-f32a01116628", + "id": "9", "metadata": {}, "source": [ "## Reproducing errors in the notebook\n", @@ -177,7 +177,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d41b448c-6533-4a1e-a216-cb18da7e20ca", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -187,7 +187,7 @@ }, { "cell_type": "markdown", - "id": "e2e8eb43-79ed-4652-90d0-32f5dd4cb74e", + "id": "11", "metadata": {}, "source": [ "## Quiet mode\n", @@ -197,7 +197,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e6163569-9fd7-4692-9f95-e9fadb6615c1", + "id": "12", "metadata": {}, "outputs": [], "source": [ @@ -233,7 +233,7 @@ }, { "cell_type": "markdown", - "id": "cf664880-3a8e-451d-8ff1-fb657de0a76a", + "id": "13", "metadata": { "tags": [] }, @@ -243,7 +243,7 @@ }, { "cell_type": "markdown", - "id": "5f184bb2-3a1e-4a74-9c5b-388742ac6b67", + "id": "14", "metadata": { "tags": [] }, @@ -256,7 +256,7 @@ { "cell_type": "code", "execution_count": null, - "id": "44f4d9da-5b06-4d6f-b319-e435e3d62944", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -292,7 +292,7 @@ { "cell_type": "code", "execution_count": null, - "id": "936da2aa-6bac-4344-8395-d62a7961f5f5", + "id": "16", "metadata": {}, "outputs": [], "source": [] @@ -315,13 +315,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.20" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Solara-Buckaroo.ipynb b/docs/example-notebooks/Solara-Buckaroo.ipynb index 009ca555..648c0d89 100644 --- a/docs/example-notebooks/Solara-Buckaroo.ipynb +++ b/docs/example-notebooks/Solara-Buckaroo.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "d69037a0-5b72-469c-8de7-d48a2788bede", + "id": "0", "metadata": {}, "source": [ "# Buckaroo works in Solara too" @@ -11,7 +11,7 @@ { "cell_type": "code", "execution_count": null, - "id": "79fc4322-12b9-42bb-8bc6-2139e1a7d1f8", + "id": "1", "metadata": { "tags": [] }, @@ -25,7 +25,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bd085457-3ecf-438d-bf03-be1c2f0fa8ef", + "id": "2", "metadata": { "tags": [] }, @@ -40,7 +40,7 @@ }, { "cell_type": "markdown", - "id": "ce7aec8e-412a-46a4-af4e-7a026fd33fa1", + "id": "3", "metadata": {}, "source": [ "## You can turn off pinned_rows too" @@ -49,7 +49,7 @@ { "cell_type": "code", "execution_count": null, - "id": "b3558422-55f4-4f88-b85d-71e910d10bd5", + "id": "4", "metadata": { "tags": [] }, @@ -64,7 +64,7 @@ }, { "cell_type": "markdown", - "id": "1551cd59-2e52-4fd0-9d93-f136eed71e2d", + "id": "5", "metadata": {}, "source": [ "# And it works with Polars" @@ -73,7 +73,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a7e2556c-b768-408b-8aa2-bb81bd91ee9c", + "id": "6", "metadata": { "tags": [] }, @@ -90,7 +90,7 @@ }, { "cell_type": "markdown", - "id": "02db2eb2-0b6a-40c4-bcc8-b310a1d6e405", + "id": "7", "metadata": {}, "source": [ "# Let's look at more data" @@ -99,7 +99,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3f74b8fb-7ba3-4c33-ad2e-e17baad839bc", + "id": "8", "metadata": { "tags": [] }, @@ -111,7 +111,7 @@ { "cell_type": "code", "execution_count": null, - "id": "22d571e5-6bf2-4a5f-8bfe-2c69d679f8f8", + "id": "9", "metadata": { "tags": [] }, @@ -125,7 +125,7 @@ }, { "cell_type": "markdown", - "id": "5e4c06cc-7e9c-4d77-afec-7c9e78d8ca3b", + "id": "10", "metadata": {}, "source": [ "# Building an app around SolaraDFViewer\n", @@ -135,7 +135,7 @@ { "cell_type": "code", "execution_count": null, - "id": "4d1256ef-edf5-494a-8a2c-a5c1a6a38b29", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -157,7 +157,7 @@ }, { "cell_type": "markdown", - "id": "9ca33684-b15f-48f9-a19d-f3a5221343ba", + "id": "12", "metadata": {}, "source": [ "# Reading large dataframes" @@ -166,7 +166,7 @@ { "cell_type": "code", "execution_count": null, - "id": "48f11839-2fe0-454b-b616-d82d5fcabf38", + "id": "13", "metadata": { "tags": [] }, @@ -215,13 +215,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/Untitled1.ipynb b/docs/example-notebooks/Untitled1.ipynb deleted file mode 100644 index 52f4cf57..00000000 --- a/docs/example-notebooks/Untitled1.ipynb +++ /dev/null @@ -1,45 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "de2bc8b1-dbeb-4150-81eb-75663cd851c5", - "metadata": {}, - "outputs": [], - "source": [ - "import polars as pl" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "59fd48a4-8a73-4304-a7f7-b05a83d9c60d", - "metadata": {}, - "outputs": [], - "source": [ - "pl.ty" - ] - } - ], - "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.8.18" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/docs/example-notebooks/Untitled2.ipynb b/docs/example-notebooks/Untitled2.ipynb deleted file mode 100644 index b51bf67f..00000000 --- a/docs/example-notebooks/Untitled2.ipynb +++ /dev/null @@ -1,40 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "f22442b3-290e-4171-8247-ae2b92a244d2", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.19" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/docs/example-notebooks/football-plays b/docs/example-notebooks/football-plays deleted file mode 100644 index d59fadd1..00000000 --- a/docs/example-notebooks/football-plays +++ /dev/null @@ -1,147 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 3, - "id": "1a205ce8-d965-44f3-a25f-96325d41b792", - "metadata": {}, - "outputs": [], - "source": [ - "import pandas as pd\n", - "import buckaroo" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "f00120ce-6f93-44a4-8351-a3186664e548", - "metadata": {}, - "outputs": [], - "source": [ - "df = pd.read_csv(\"/Users/paddy/Downloads/pbp-2022.csv\")" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "3c808e13-23ca-4a13-ae05-022aad615a73", - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "99680a7905f7474cb787f2681326043a", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "BuckarooWidget(buckaroo_options={'sampled': ['random'], 'auto_clean': ['aggressive', 'conservative'], 'post_pr…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "df" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "5c6f80f6-80e6-47e2-8fc3-c3fd8a3078b5", - "metadata": {}, - "outputs": [], - "source": [ - "!cp /Users/paddy/Downloads/play_by_play_2007.parquet ./" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "c048283c-dfcd-445a-8af9-bdc741e39636", - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Removing excess columns, found 372 columns\n" - ] - }, - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "7c33788494dc469db75fad24bc007f42", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "BuckarooWidget(buckaroo_options={'sampled': ['random'], 'auto_clean': ['aggressive', 'conservative'], 'post_pr…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "df = pd.read_parquet(\"play_by_play_2007.parquet\")\n", - "df" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "b479121a-aa0c-43a2-95d4-b2a298607ef3", - "metadata": {}, - "outputs": [ - { - "data": { - "application/vnd.jupyter.widget-view+json": { - "model_id": "fb111e26f59149c4bbcc38cb48c580a5", - "version_major": 2, - "version_minor": 0 - }, - "text/plain": [ - "BuckarooWidget(buckaroo_options={'sampled': ['random'], 'auto_clean': ['aggressive', 'conservative'], 'post_pr…" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "df[['time_of_day', 'ydstogo', 'qtr', 'down', 'game_seconds_remaining', 'play_type', 'home_team', 'away_team']]" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8f1e2d08-552d-4a0a-aa7a-81e5b4cc198b", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.8.18" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/docs/example-notebooks/introduction.ipynb b/docs/example-notebooks/introduction.ipynb index e7f7aa5e..268718d3 100644 --- a/docs/example-notebooks/introduction.ipynb +++ b/docs/example-notebooks/introduction.ipynb @@ -302,13 +302,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.20" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/styling-gallery.ipynb b/docs/example-notebooks/styling-gallery.ipynb index f0ac5ca5..dd040d29 100644 --- a/docs/example-notebooks/styling-gallery.ipynb +++ b/docs/example-notebooks/styling-gallery.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "99218d54-79db-4c3c-8ca5-373e3c1ed677", + "id": "0", "metadata": { "tags": [] }, @@ -21,7 +21,7 @@ { "cell_type": "code", "execution_count": null, - "id": "840e09f3-8153-4800-a383-636556af4f32", + "id": "1", "metadata": { "tags": [] }, @@ -35,7 +35,7 @@ }, { "cell_type": "markdown", - "id": "cf49c5fd-b617-4495-b018-1fadbc90cb4c", + "id": "2", "metadata": {}, "source": [ "This notebook generally follows the order of [DFWhole.ts](https://github.com/paddymul/buckaroo/blob/main/js/components/DFViewerParts/DFWhole.ts)\n", @@ -74,14 +74,14 @@ }, { "cell_type": "markdown", - "id": "cefb1b9b-edae-4c7d-8d54-04597ab981b5", + "id": "3", "metadata": {}, "source": [] }, { "cell_type": "code", "execution_count": null, - "id": "4697fa58-9609-412f-b2d0-48a63fed0c99", + "id": "4", "metadata": { "tags": [] }, @@ -101,7 +101,7 @@ { "cell_type": "code", "execution_count": null, - "id": "6e84d497-539f-4c62-810f-1cef72f417d2", + "id": "5", "metadata": { "tags": [] }, @@ -123,7 +123,7 @@ { "cell_type": "code", "execution_count": null, - "id": "540dcd65-248d-43a3-b8c3-2db3159d3f8d", + "id": "6", "metadata": { "tags": [] }, @@ -143,7 +143,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5c49dd11-9727-4ac1-829c-bed1a155629b", + "id": "7", "metadata": { "tags": [] }, @@ -165,7 +165,7 @@ { "cell_type": "code", "execution_count": null, - "id": "18e5adba-49b8-453a-86f7-ce438c61113a", + "id": "8", "metadata": { "tags": [] }, @@ -188,7 +188,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e8cefca2-6db8-4599-b46a-40e7cc45caef", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -216,7 +216,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fa1410bf-8540-4daf-8080-ae7d52e70546", + "id": "10", "metadata": { "tags": [] }, @@ -248,7 +248,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c943c155-1266-45b3-a790-c98a89e75cf8", + "id": "11", "metadata": { "tags": [] }, @@ -264,7 +264,7 @@ { "cell_type": "code", "execution_count": null, - "id": "06a67f09-191a-40d1-8cf3-2ef240290516", + "id": "12", "metadata": { "tags": [] }, @@ -305,7 +305,7 @@ { "cell_type": "code", "execution_count": null, - "id": "fd4dd7b5-ed26-42b6-aa20-f9d7211b7e95", + "id": "13", "metadata": { "tags": [] }, @@ -317,7 +317,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0f6231ea-a570-40d7-ab9d-86e8ce08c5a9", + "id": "14", "metadata": { "tags": [] }, @@ -333,7 +333,7 @@ }, { "cell_type": "markdown", - "id": "c8d2accd-4732-43ff-b92a-d827b330b538", + "id": "15", "metadata": {}, "source": [ "# Tooltips" @@ -342,7 +342,7 @@ { "cell_type": "code", "execution_count": null, - "id": "344ce005-1c0d-4ee6-8ef3-95c2cde977ac", + "id": "16", "metadata": { "tags": [] }, @@ -360,7 +360,7 @@ }, { "cell_type": "markdown", - "id": "f7a91713-b95d-4546-a5ad-0be964f4b2df", + "id": "17", "metadata": {}, "source": [ "# Color_map_config\n", @@ -390,7 +390,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3dbf1c45-7725-4cd7-8008-da3085f55667", + "id": "18", "metadata": { "tags": [] }, @@ -408,7 +408,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a43ecbfb-ae8d-428f-9cb5-29eb53afa076", + "id": "19", "metadata": { "tags": [] }, @@ -430,7 +430,7 @@ { "cell_type": "code", "execution_count": null, - "id": "0bc7cef8-1f93-4415-a420-c9aa44fd583e", + "id": "20", "metadata": { "tags": [] }, @@ -450,7 +450,7 @@ }, { "cell_type": "markdown", - "id": "1768186c-14fc-49fa-8e03-e8f454411d5b", + "id": "21", "metadata": {}, "source": [ "Extra col def type\n", @@ -462,7 +462,7 @@ }, { "cell_type": "markdown", - "id": "2ebaa204-9a32-47d0-9d87-14d9755a738b", + "id": "22", "metadata": {}, "source": [ "# Utility Code" @@ -471,7 +471,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3fd31184-6197-4d13-a319-aaefee224745", + "id": "23", "metadata": { "tags": [] }, @@ -537,7 +537,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9eee93ff-49c2-41ca-b402-5378afa04ab8", + "id": "24", "metadata": { "tags": [] }, @@ -556,7 +556,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df395ef4-2f33-49d5-a380-6cead5926566", + "id": "25", "metadata": { "tags": [] }, @@ -574,7 +574,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8a8b8b12-d094-4dcc-9152-1b00e77fb182", + "id": "26", "metadata": { "tags": [] }, @@ -588,7 +588,7 @@ { "cell_type": "code", "execution_count": null, - "id": "440fb9fe-96b5-49c2-a341-41583b8fc0c6", + "id": "27", "metadata": { "tags": [] }, @@ -600,7 +600,7 @@ { "cell_type": "code", "execution_count": null, - "id": "a10fe4bf-4522-41b5-b634-736cf5280cf5", + "id": "28", "metadata": { "tags": [] }, @@ -633,13 +633,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.20" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/styling-howto.ipynb b/docs/example-notebooks/styling-howto.ipynb index 7eac94c7..e03bdbeb 100644 --- a/docs/example-notebooks/styling-howto.ipynb +++ b/docs/example-notebooks/styling-howto.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "markdown", - "id": "f7fd6f90-3a45-4090-a0aa-bf0e03aab56b", + "id": "0", "metadata": { "tags": [] }, @@ -23,7 +23,7 @@ { "cell_type": "code", "execution_count": null, - "id": "73f3516e-2273-495a-b3b9-f68593b0018b", + "id": "1", "metadata": { "tags": [] }, @@ -39,7 +39,7 @@ { "cell_type": "code", "execution_count": null, - "id": "45a03efb-ec32-4cda-b443-99425e80a458", + "id": "2", "metadata": { "tags": [] }, @@ -53,7 +53,7 @@ { "cell_type": "code", "execution_count": null, - "id": "8086b3b9-f97e-4b4c-9c0a-85566be060a3", + "id": "3", "metadata": { "tags": [] }, @@ -64,7 +64,7 @@ }, { "cell_type": "markdown", - "id": "04bae28c-68e4-43d1-b323-1ac503efa18a", + "id": "4", "metadata": {}, "source": [ "## `displayer`\n", @@ -74,7 +74,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3c6d50c3-004b-4850-8404-bef00a990e55", + "id": "5", "metadata": { "tags": [] }, @@ -91,7 +91,7 @@ }, { "cell_type": "markdown", - "id": "de8b7829-c898-4fec-93b0-09c3f7552146", + "id": "6", "metadata": {}, "source": [ "Now we are going to force `float_col` to be displayed with a 'float' displayer\n", @@ -114,7 +114,7 @@ }, { "cell_type": "markdown", - "id": "8999d568-ddbe-40c8-a7cb-fa7fe0c47c9c", + "id": "7", "metadata": {}, "source": [ "# `tooltip_config`\n", @@ -129,7 +129,7 @@ { "cell_type": "code", "execution_count": null, - "id": "abc0e795-4ab9-4a5d-b09d-3b926e82afee", + "id": "8", "metadata": { "tags": [] }, @@ -145,7 +145,7 @@ }, { "cell_type": "markdown", - "id": "c5e17dd6-f658-48d1-b40c-a4ac354ea5d5", + "id": "9", "metadata": {}, "source": [ "# color_map_config\n", @@ -159,7 +159,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9a75b18b-c61d-45d7-b0e1-295ad869a17c", + "id": "10", "metadata": { "tags": [] }, @@ -178,7 +178,7 @@ { "cell_type": "code", "execution_count": null, - "id": "3a2a125c-75c7-42ae-a87f-6a47bd41068c", + "id": "11", "metadata": { "tags": [] }, @@ -197,7 +197,7 @@ }, { "cell_type": "markdown", - "id": "0ca07426-086c-4041-bf08-07c7447c8eb5", + "id": "12", "metadata": {}, "source": [ "# Hiding a column\n", @@ -210,7 +210,7 @@ { "cell_type": "code", "execution_count": null, - "id": "924c506c-123c-43ed-80f8-e239014f7e75", + "id": "13", "metadata": { "tags": [] }, @@ -225,7 +225,7 @@ }, { "cell_type": "markdown", - "id": "621d5306-ba11-487b-bb5b-3841c412bf3a", + "id": "14", "metadata": {}, "source": [ "# Pinned rows\n", @@ -235,7 +235,7 @@ { "cell_type": "code", "execution_count": null, - "id": "42da3b2a-a3bf-4c89-be15-0227fc9b916a", + "id": "15", "metadata": { "tags": [] }, @@ -252,7 +252,7 @@ }, { "cell_type": "markdown", - "id": "05ecd1e4-1bde-48ce-ac51-bf53f7bb91c4", + "id": "16", "metadata": {}, "source": [ "# Packaging and reusing styling configurations with the `StylingAnalysis` class\n", @@ -272,7 +272,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c03b5bc4-0025-4b55-9e7c-cc1a69508688", + "id": "17", "metadata": { "tags": [] }, @@ -299,7 +299,7 @@ }, { "cell_type": "markdown", - "id": "a60bf7a8-4d5d-4089-8157-dafbd5a689ef", + "id": "18", "metadata": {}, "source": [ "## Toggling between styles\n", @@ -309,7 +309,7 @@ { "cell_type": "code", "execution_count": null, - "id": "e8b25177-de65-4f5f-838f-152e1b621f5c", + "id": "19", "metadata": { "tags": [] }, @@ -334,7 +334,7 @@ }, { "cell_type": "markdown", - "id": "1b0b5aa9-e820-49bd-a242-d8cf68441191", + "id": "20", "metadata": {}, "source": [ "## overriding styling from post_processing\n", @@ -350,7 +350,7 @@ { "cell_type": "code", "execution_count": null, - "id": "df64d5b2-e408-48ff-978f-8790c46dff21", + "id": "21", "metadata": {}, "outputs": [], "source": [ @@ -371,7 +371,7 @@ }, { "cell_type": "markdown", - "id": "a2618a7e-b8d9-44ca-b598-07428e654668", + "id": "22", "metadata": {}, "source": [ "# Buckaroo internals related to styling\n", @@ -381,7 +381,7 @@ { "cell_type": "code", "execution_count": null, - "id": "323a5a9d-933b-4bad-856d-17162a22913a", + "id": "23", "metadata": { "tags": [] }, @@ -394,7 +394,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d8ee357c-ba69-49b1-a8a9-bc31cb8cde47", + "id": "24", "metadata": { "tags": [] }, @@ -441,7 +441,7 @@ { "cell_type": "code", "execution_count": null, - "id": "29aa8f47-7cd9-43c5-99e5-84ffeb39e188", + "id": "25", "metadata": { "tags": [] }, @@ -476,7 +476,7 @@ { "cell_type": "code", "execution_count": null, - "id": "216936c9-8863-47af-bbcd-68eab766e91d", + "id": "26", "metadata": {}, "outputs": [], "source": [ @@ -507,7 +507,7 @@ { "cell_type": "code", "execution_count": null, - "id": "91a3d9a8-cbed-496e-95d1-39068bc1c99d", + "id": "27", "metadata": {}, "outputs": [], "source": [] @@ -530,13 +530,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.20" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/testcases-fast.ipynb b/docs/example-notebooks/testcases-fast.ipynb index d4764c94..61b9874a 100644 --- a/docs/example-notebooks/testcases-fast.ipynb +++ b/docs/example-notebooks/testcases-fast.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": null, - "id": "51091834-6d31-4e0e-b13c-a7be0a02ddb4", + "id": "0", "metadata": {}, "outputs": [], "source": [ @@ -15,7 +15,7 @@ { "cell_type": "code", "execution_count": null, - "id": "040f826c-8bfe-4c03-bd8b-c65986d2ac2f", + "id": "1", "metadata": { "tags": [] }, @@ -28,7 +28,7 @@ { "cell_type": "code", "execution_count": null, - "id": "54790361-302e-4266-bc5e-47273997b8d2", + "id": "2", "metadata": { "tags": [] }, @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1da53d4a-1fc8-4705-acb5-d2b38d505c03", + "id": "3", "metadata": {}, "outputs": [], "source": [ @@ -49,7 +49,7 @@ }, { "cell_type": "markdown", - "id": "4bc0a224-fcf7-4835-8efa-1714ef9f08b4", + "id": "4", "metadata": {}, "source": [ "# At first glance the performance is close\n", @@ -61,7 +61,7 @@ { "cell_type": "code", "execution_count": null, - "id": "91062062-940e-4448-8c71-46f060b9dac3", + "id": "5", "metadata": {}, "outputs": [], "source": [ @@ -77,7 +77,7 @@ { "cell_type": "code", "execution_count": null, - "id": "bb36ce16-9f52-4bf3-a119-e1c490c3622f", + "id": "6", "metadata": {}, "outputs": [], "source": [ @@ -88,7 +88,7 @@ { "cell_type": "code", "execution_count": null, - "id": "ad7249a2-6960-4505-9ae5-b0173f251463", + "id": "7", "metadata": {}, "outputs": [], "source": [] @@ -96,7 +96,7 @@ { "cell_type": "code", "execution_count": null, - "id": "30063897-1b67-4507-a3b8-0d98ab0f4b9f", + "id": "8", "metadata": {}, "outputs": [], "source": [ @@ -108,7 +108,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dd8b3a75-a615-402d-9c6c-fc57c2759fe4", + "id": "9", "metadata": {}, "outputs": [], "source": [ @@ -120,7 +120,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5e338ccf-5a61-457d-addd-bdfd8510aa86", + "id": "10", "metadata": {}, "outputs": [], "source": [ @@ -132,7 +132,7 @@ { "cell_type": "code", "execution_count": null, - "id": "dd5b1809-5d8d-4c26-b263-165592918b2a", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -144,7 +144,7 @@ { "cell_type": "code", "execution_count": null, - "id": "5159536e-bad0-46cd-ba99-77c17f42dacd", + "id": "12", "metadata": {}, "outputs": [], "source": [ @@ -156,7 +156,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c223dcb4-a354-4f3a-b492-e6ae33c99188", + "id": "13", "metadata": {}, "outputs": [], "source": [ @@ -168,7 +168,7 @@ { "cell_type": "code", "execution_count": null, - "id": "c1c73c91-0343-417a-a45f-ef5f8c39e884", + "id": "14", "metadata": {}, "outputs": [], "source": [ @@ -180,7 +180,7 @@ { "cell_type": "code", "execution_count": null, - "id": "97851149-49b4-41e2-a14f-ee9fbfcf7848", + "id": "15", "metadata": {}, "outputs": [], "source": [ @@ -192,7 +192,7 @@ { "cell_type": "code", "execution_count": null, - "id": "1bb274bb-27b0-4bb4-b296-7c246ced9ce5", + "id": "16", "metadata": {}, "outputs": [], "source": [ @@ -204,7 +204,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12553bd6-be53-4001-be9a-dfc939981d38", + "id": "17", "metadata": {}, "outputs": [], "source": [ @@ -214,7 +214,7 @@ { "cell_type": "code", "execution_count": null, - "id": "257f2303-2b64-447b-8523-f8defac60cd9", + "id": "18", "metadata": {}, "outputs": [], "source": [ @@ -239,13 +239,6 @@ "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.7" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } } }, "nbformat": 4, diff --git a/docs/example-notebooks/tidy-tuesday/2019-11-bike-commutes.ipynb b/docs/example-notebooks/tidy-tuesday/2019-11-bike-commutes.ipynb deleted file mode 100644 index 97436642..00000000 --- a/docs/example-notebooks/tidy-tuesday/2019-11-bike-commutes.ipynb +++ /dev/null @@ -1,108 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "id": "e3407bdb-1154-41bd-8947-89b3105ef509", - "metadata": {}, - "outputs": [], - "source": [ - "https://github.com/rfordatascience/tidytuesday/tree/master/data/2019/2019-11-05\n" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b57ae41f-c812-441a-9b6e-afca371522a8", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "import pandas as pd\n", - "import buckaroo" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "b12c0a7b-0010-4676-b145-ec20fa32627a", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "df = pd.read_csv(\"https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2019/2019-11-05/commute.csv\")\n", - "df" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "9d66e3fc-7908-44e1-823c-f187374b6253", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "df['city'].apply(lambda x: x.split(' ')[-1])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "5bf645ff-a5dc-406e-a488-b97728574da4", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "from buckaroo.pluggable_analysis_framework.pluggable_analysis_framework import ColAnalysis\n", - "bw = buckaroo.BuckarooWidget(df)\n", - "\n", - "@bw.add_processing\n", - "def transform_city(df):\n", - " df['muni_type'] = df['city'].apply(lambda x: x.split(' ')[-1])\n", - " df['muni_name'] = df['city'].apply(lambda x: ' '.join(x.split(' ')[:-1]))\n", - " return df\n", - "bw" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "8ec67615-a239-4826-9674-ccce04b34c03", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.7" - }, - "widgets": { - "application/vnd.jupyter.widget-state+json": { - "state": {}, - "version_major": 2, - "version_minor": 0 - } - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/introduction.ipynb b/introduction.ipynb deleted file mode 100644 index 97706d67..00000000 --- a/introduction.ipynb +++ /dev/null @@ -1,328 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import pandas as pd\n", - "import numpy as np\n", - "from buckaroo.buckaroo_widget import BuckarooWidget" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df = pd.read_csv('./examples/data/yellow_tripdata_2021-02.csv')\n", - "df" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "w = BuckarooWidget(df, showCommands=False)\n", - "w" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Adding a summary stat" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "from buckaroo.pluggable_analysis_framework import (ColAnalysis)\n", - "from scipy.stats import skew\n", - "class Skew(ColAnalysis):\n", - " provides_summary = [\"skew\"]\n", - " requires_summary = []\n", - " \n", - " @staticmethod\n", - " def summary(sampled_ser, summary_ser, ser):\n", - " if pd.api.types.is_integer_dtype(sampled_ser):\n", - " return dict(skew=skew(sampled_ser.dropna().astype('int64')))\n", - " elif pd.api.types.is_float_dtype(sampled_ser):\n", - " return dict(skew=skew(sampled_ser.astype('float64')))\n", - " else:\n", - " return dict(skew=\"NA\")\n", - " summary_stats_display = [\n", - " 'dtype',\n", - " 'length',\n", - " 'nan_count',\n", - " 'distinct_count',\n", - " 'empty_count',\n", - " 'empty_per',\n", - " 'unique_per',\n", - " 'nan_per',\n", - " 'is_numeric',\n", - " 'is_integer',\n", - " 'is_datetime',\n", - " 'mode',\n", - " 'min',\n", - " 'max',\n", - " 'mean',\n", - " # we must add skew to the list of summary_stats_display, otherwise our new stat won't be displayed\n", - " 'skew']\n", - "w.add_analysis(Skew)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "## Basic Unit testing is built in\n", - "\n", - "Because there are so many corner cases with numerical code, every time a new summary stat is added, a variety of simple tests are run against it. This lets you discover bugs earlier." - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "w = BuckarooWidget(df[:500], showCommands=False)\n", - "# Here we try to replace min_digits with a version that throws errors on bools.\n", - "# Small error, but representantive of the types of erros that we see in the wild.\n", - "def int_digits(n):\n", - " if np.isnan(n):\n", - " return 1\n", - " if n == 0:\n", - " return 1\n", - " if np.sign(n) == -1:\n", - " return int(np.floor(np.log10(np.abs(n)))) + 2\n", - " return int(np.floor(np.log10(n)+1))\n", - "\n", - "class MinDigits(ColAnalysis):\n", - " requires_summary = [\"min\"]\n", - " provides_summary = [\"min_digits\"]\n", - " \n", - " @staticmethod\n", - " def summary(sampled_ser, summary_ser, ser):\n", - " is_numeric = pd.api.types.is_numeric_dtype(sampled_ser.dtype)\n", - " if is_numeric:\n", - " return {\n", - " 'min_digits':int_digits(summary_ser.loc['min'])}\n", - " else:\n", - " return {\n", - " 'min_digits':0}\n", - "w.add_analysis(MinDigits)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "#now we can use the reproduce line to quickly try this and iterate until we get to a solution\n", - "from buckaroo.analysis_management import PERVERSE_DF\n", - "MinDigits.summary(PERVERSE_DF['UInt8None'], pd.Series({'min': pd.NA, }), PERVERSE_DF['UInt8None'])" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "# use quiet = True if you just want the analysis to shutup and work for the most part.\n", - "# not generally recommended, but expedient. If this wasn't built in, users would write\n", - "# this functionality again over and over, poorly\n", - "\n", - "class MinDigits(ColAnalysis):\n", - " requires_summary = [\"min\"]\n", - " provides_summary = [\"min_digits\"]\n", - " quiet = True\n", - " \n", - " @staticmethod\n", - " def summary(sampled_ser, summary_ser, ser):\n", - " is_numeric = pd.api.types.is_numeric_dtype(sampled_ser.dtype)\n", - " if is_numeric:\n", - " return {\n", - " 'min_digits':int_digits(summary_ser.loc['min'])}\n", - " else:\n", - " return {\n", - " 'min_digits':0}\n", - "w.add_analysis(MinDigits)" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Making a new default dataframe display function" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "from buckaroo.widget_utils import disable\n", - "from IPython.core.getipython import get_ipython\n", - "from IPython.display import display\n", - "import warnings\n", - "\n", - "disable()\n", - "def my_display_as_buckaroo(df):\n", - " w = BuckarooWidget(df, showCommands=False)\n", - " #the analysis we added throws warnings, let's muffle that when used as the default display\n", - " warnings.filterwarnings('ignore')\n", - " w.add_analysis(Skew)\n", - " warnings.filterwarnings('default')\n", - " return display(w)\n", - "\n", - "def my_enable():\n", - " \"\"\"\n", - " Automatically use buckaroo to display all DataFrames\n", - " instances in the notebook.\n", - "\n", - " \"\"\"\n", - " ip = get_ipython()\n", - " if ip is None:\n", - " print(\"must be running inside ipython to enable default display via enable()\")\n", - " return\n", - " ip_formatter = ip.display_formatter.ipython_display_formatter\n", - " ip_formatter.for_type(pd.DataFrame, my_display_as_buckaroo)\n", - "my_enable()" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "df" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Adding a Command to the Low Code UI" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from buckaroo.all_transforms import Command\n", - "from buckaroo.lispy import s\n", - "#Here we start adding commands to the Buckaroo Widget. Every call to add_command replaces a command with the same name\n", - "@w.add_command\n", - "class GroupBy2(Command):\n", - " command_default = [s(\"groupby2\"), s('df'), 'col', {}]\n", - " command_pattern = [[3, 'colMap', 'colEnum', ['null', 'sum', 'mean', 'median', 'count']]]\n", - " @staticmethod \n", - " def transform(df, col, col_spec):\n", - " grps = df.groupby(col)\n", - " df_contents = {}\n", - " for k, v in col_spec.items():\n", - " if v == \"sum\":\n", - " df_contents[k] = grps[k].apply(lambda x: x.sum())\n", - " elif v == \"mean\":\n", - " df_contents[k] = grps[k].apply(lambda x: x.mean())\n", - " elif v == \"median\":\n", - " df_contents[k] = grps[k].apply(lambda x: x.median())\n", - " elif v == \"count\":\n", - " df_contents[k] = grps[k].apply(lambda x: x.count())\n", - " return pd.DataFrame(df_contents)\n", - "\n", - " @staticmethod \n", - " def transform_to_py(df, col, col_spec):\n", - " commands = [\n", - " \" grps = df.groupby('%s')\" % col,\n", - " \" df_contents = {}\"\n", - " ]\n", - " for k, v in col_spec.items():\n", - " if v == \"sum\":\n", - " commands.append(\" paddydf_contents['%s'] = grps['%s'].apply(lambda x: x.sum())\" % (k, k))\n", - " elif v == \"mean\":\n", - " commands.append(\" df_contents['%s'] = grps['%s'].apply(lambda x: x.mean())\" % (k, k))\n", - " elif v == \"median\":\n", - " commands.append(\" df_contents['%s'] = grps['%s'].apply(lambda x: x.median())\" % (k, k))\n", - " elif v == \"count\":\n", - " commands.append(\" df_contents['%s'] = grps['%s'].apply(lambda x: x.count())\" % (k, k))\n", - " commands.append(\" df = pd.DataFrame(df_contents)\")\n", - " return \"\\n\".join(commands)\n" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "Note that `groupby2` has been added to the commands" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "import polars as pl\n", - "pl.read_csv('./examples/data/yellow_tripdata_2021-02.csv')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.5" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -} diff --git a/package.json b/package.json index bb76df6a..a34dab89 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,8 @@ "build:lib": "tsc", "build:examples": "webpack --mode=production --config docs/webpack.typescript.localdev.ts --env production", "build:all": "yarn run build:labextension", - "clean": "rimraf dist && yarn run clean:lib && yarn run clean:labextension", + "clean": "rimraf dist && yarn run clean:lib && yarn run clean:labextension && yarn run clean:notebooks", + "clean:notebooks": "scripts/clean_notebooks.sh", "clean:lib": "rimraf lib", "clean:labextension": "rimraf buckaroo/labextension", "lint": "eslint 'js/**/*.{ts,tsx}'", diff --git a/pyproject.toml b/pyproject.toml index cc95a560..e588938a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,8 @@ test = [ "pydantic>=2.5.2", "pyarrow", "geopandas<1.0", - "ruff" + "ruff", + "nbstripout" ] polars = ["polars>=1.0,<1.6", "polars[timezone]" diff --git a/regular-summary-stats.ipynb b/regular-summary-stats.ipynb deleted file mode 100644 index a0d2aa7c..00000000 --- a/regular-summary-stats.ipynb +++ /dev/null @@ -1,3038 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": 1, - "id": "f43d2958-7872-4d38-ad01-a6b75cac29eb", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "import pandas as pd\n", - "%matplotlib inline" - ] - }, - { - "cell_type": "code", - "execution_count": 2, - "id": "2cc2ce06-572f-4962-aee9-345d4db6d0a2", - "metadata": { - "tags": [] - }, - "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", - "
tripdurationstarttimestoptimestart station idstart station namestart station latitudestart station longitudeend station idend station nameend station latitudeend station longitudebikeidusertypebirth yeargender
04712014-01-01 00:00:062014-01-01 00:07:572009Catherine St & Monroe St40.711174-73.996826263Elizabeth St & Hester St40.717290-73.99637516379Subscriber19861
114942014-01-01 00:00:382014-01-01 00:25:325361 Ave & E 30 St40.741444-73.975361259South St & Whitehall St40.701221-74.01234215611Subscriber19631
24642014-01-01 00:03:592014-01-01 00:11:43228E 48 St & 3 Ave40.754601-73.9718792022E 59 St & Sutton Pl40.758491-73.95920616613Subscriber19911
33732014-01-01 00:05:152014-01-01 00:11:28519Pershing Square N40.751884-73.977702526E 33 St & 5 Ave40.747659-73.98490715938Subscriber19891
46602014-01-01 00:05:182014-01-01 00:16:1883Atlantic Ave & Fort Greene Pl40.683826-73.976323436Hancock St & Bedford Ave40.682166-73.95399019830Subscriber19901
................................................
3003957802014-01-31 23:57:342014-02-01 00:10:34308St James Pl & Oliver St40.713079-73.998512312Allen St & E Houston St40.722055-73.98911117299Subscriber19881
30039610742014-01-31 23:57:452014-02-01 00:15:39482W 15 St & 7 Ave40.739355-73.999318488W 39 St & 9 Ave40.756458-73.99372219886Subscriber19821
3003971912014-01-31 23:58:162014-02-01 00:01:27247Perry St & Bleecker St40.735354-74.004831368Carmine St & 6 Ave40.730386-74.00215020249Subscriber19692
30039810522014-01-31 23:58:342014-02-01 00:16:06482W 15 St & 7 Ave40.739355-73.999318488W 39 St & 9 Ave40.756458-73.99372219922Subscriber19812
30039911332014-01-31 23:58:432014-02-01 00:17:36450W 49 St & 8 Ave40.762272-73.987882294Washington Square E40.730494-73.99572118944Subscriber19691
\n", - "

300400 rows × 15 columns

\n", - "
" - ], - "text/plain": [ - " tripduration starttime stoptime \\\n", - "0 471 2014-01-01 00:00:06 2014-01-01 00:07:57 \n", - "1 1494 2014-01-01 00:00:38 2014-01-01 00:25:32 \n", - "2 464 2014-01-01 00:03:59 2014-01-01 00:11:43 \n", - "3 373 2014-01-01 00:05:15 2014-01-01 00:11:28 \n", - "4 660 2014-01-01 00:05:18 2014-01-01 00:16:18 \n", - "... ... ... ... \n", - "300395 780 2014-01-31 23:57:34 2014-02-01 00:10:34 \n", - "300396 1074 2014-01-31 23:57:45 2014-02-01 00:15:39 \n", - "300397 191 2014-01-31 23:58:16 2014-02-01 00:01:27 \n", - "300398 1052 2014-01-31 23:58:34 2014-02-01 00:16:06 \n", - "300399 1133 2014-01-31 23:58:43 2014-02-01 00:17:36 \n", - "\n", - " start station id start station name \\\n", - "0 2009 Catherine St & Monroe St \n", - "1 536 1 Ave & E 30 St \n", - "2 228 E 48 St & 3 Ave \n", - "3 519 Pershing Square N \n", - "4 83 Atlantic Ave & Fort Greene Pl \n", - "... ... ... \n", - "300395 308 St James Pl & Oliver St \n", - "300396 482 W 15 St & 7 Ave \n", - "300397 247 Perry St & Bleecker St \n", - "300398 482 W 15 St & 7 Ave \n", - "300399 450 W 49 St & 8 Ave \n", - "\n", - " start station latitude start station longitude end station id \\\n", - "0 40.711174 -73.996826 263 \n", - "1 40.741444 -73.975361 259 \n", - "2 40.754601 -73.971879 2022 \n", - "3 40.751884 -73.977702 526 \n", - "4 40.683826 -73.976323 436 \n", - "... ... ... ... \n", - "300395 40.713079 -73.998512 312 \n", - "300396 40.739355 -73.999318 488 \n", - "300397 40.735354 -74.004831 368 \n", - "300398 40.739355 -73.999318 488 \n", - "300399 40.762272 -73.987882 294 \n", - "\n", - " end station name end station latitude end station longitude \\\n", - "0 Elizabeth St & Hester St 40.717290 -73.996375 \n", - "1 South St & Whitehall St 40.701221 -74.012342 \n", - "2 E 59 St & Sutton Pl 40.758491 -73.959206 \n", - "3 E 33 St & 5 Ave 40.747659 -73.984907 \n", - "4 Hancock St & Bedford Ave 40.682166 -73.953990 \n", - "... ... ... ... \n", - "300395 Allen St & E Houston St 40.722055 -73.989111 \n", - "300396 W 39 St & 9 Ave 40.756458 -73.993722 \n", - "300397 Carmine St & 6 Ave 40.730386 -74.002150 \n", - "300398 W 39 St & 9 Ave 40.756458 -73.993722 \n", - "300399 Washington Square E 40.730494 -73.995721 \n", - "\n", - " bikeid usertype birth year gender \n", - "0 16379 Subscriber 1986 1 \n", - "1 15611 Subscriber 1963 1 \n", - "2 16613 Subscriber 1991 1 \n", - "3 15938 Subscriber 1989 1 \n", - "4 19830 Subscriber 1990 1 \n", - "... ... ... ... ... \n", - "300395 17299 Subscriber 1988 1 \n", - "300396 19886 Subscriber 1982 1 \n", - "300397 20249 Subscriber 1969 2 \n", - "300398 19922 Subscriber 1981 2 \n", - "300399 18944 Subscriber 1969 1 \n", - "\n", - "[300400 rows x 15 columns]" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df = pd.read_csv('/Users/paddy/code/citibike-play/2014-01 - Citi Bike trip data.csv')\n", - "df" - ] - }, - { - "cell_type": "markdown", - "id": "183717a8-d476-4dd1-a024-8e33ff8cbcf1", - "metadata": {}, - "source": [ - "# Basic Dataframe exploration" - ] - }, - { - "cell_type": "code", - "execution_count": 4, - "id": "d5e43b62-a8ea-4d98-a9f2-f2cf97edcd83", - "metadata": { - "tags": [] - }, - "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", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
tripdurationstarttimestoptimestart station idstart station namestart station latitudestart station longitudeend station idend station nameend station latitudeend station longitudebikeidusertypebirth yeargender
04712014-01-01 00:00:062014-01-01 00:07:572009Catherine St & Monroe St40.711174-73.996826263Elizabeth St & Hester St40.717290-73.99637516379Subscriber19861
114942014-01-01 00:00:382014-01-01 00:25:325361 Ave & E 30 St40.741444-73.975361259South St & Whitehall St40.701221-74.01234215611Subscriber19631
24642014-01-01 00:03:592014-01-01 00:11:43228E 48 St & 3 Ave40.754601-73.9718792022E 59 St & Sutton Pl40.758491-73.95920616613Subscriber19911
33732014-01-01 00:05:152014-01-01 00:11:28519Pershing Square N40.751884-73.977702526E 33 St & 5 Ave40.747659-73.98490715938Subscriber19891
46602014-01-01 00:05:182014-01-01 00:16:1883Atlantic Ave & Fort Greene Pl40.683826-73.976323436Hancock St & Bedford Ave40.682166-73.95399019830Subscriber19901
53302014-01-01 00:05:552014-01-01 00:11:25422W 59 St & 10 Ave40.770513-73.988038526E 33 St & 5 Ave40.747659-73.98490717343Subscriber19871
62612014-01-01 00:06:042014-01-01 00:10:25516E 47 St & 1 Ave40.752069-73.967844167E 39 St & 3 Ave40.748901-73.97604917880Subscriber19831
73372014-01-01 00:06:412014-01-01 00:12:18380W 4 St & 7 Ave S40.734011-74.002939435W 21 St & 6 Ave40.741740-73.99415616275Subscriber19631
84292014-01-01 00:07:332014-01-01 00:14:42296Division St & Bowery40.714131-73.997047306Cliff St & Fulton St40.708235-74.00530117318Subscriber19722
910252014-01-01 00:08:272014-01-01 00:25:32540Lexington Ave & E 26 St40.741473-73.9832094478 Ave & W 52 St40.763707-73.98516215525Subscriber19811
107182014-01-01 00:09:322014-01-01 00:21:30263Elizabeth St & Hester St40.717290-73.996375251Mott St & Prince St40.723180-73.99480015693Customer\\N0
117862014-01-01 00:10:592014-01-01 00:24:05153E 40 St & 5 Ave40.752062-73.9816322902 Ave & E 58 St40.760203-73.96478515281Subscriber19681
122672014-01-01 00:11:172014-01-01 00:15:44151Cleveland Pl & Spring St40.721816-73.997203410Suffolk St & Stanton St40.720664-73.98518015159Subscriber19831
137442014-01-01 00:12:232014-01-01 00:24:47450W 49 St & 8 Ave40.762272-73.9878825056 Ave & W 33 St40.749013-73.98848415157Subscriber19761
147042014-01-01 00:12:252014-01-01 00:24:09331Pike St & Monroe St40.711731-73.991930195Liberty St & Broadway40.709056-74.01043417080Subscriber19802
1513672014-01-01 00:12:472014-01-01 00:35:34519Pershing Square N40.751884-73.977702386Centre St & Worth St40.714948-74.00234520731Customer\\N0
163272014-01-01 00:13:112014-01-01 00:18:38502Henry St & Grand St40.714215-73.981346411E 6 St & Avenue D40.722281-73.97668715655Subscriber19732
172232014-01-01 00:15:302014-01-01 00:19:135282 Ave & E 31 St40.742909-73.977061518E 39 St & 2 Ave40.747804-73.97344215737Subscriber19821
185772014-01-01 00:16:042014-01-01 00:25:41467Dean St & 4 Ave40.683125-73.978951270Adelphi St & Myrtle Ave40.693083-73.97178916115Subscriber19831
195662014-01-01 00:16:132014-01-01 00:25:39467Dean St & 4 Ave40.683125-73.978951270Adelphi St & Myrtle Ave40.693083-73.97178915753Subscriber19832
206372014-01-01 00:16:322014-01-01 00:27:09285Broadway & E 14 St40.734546-73.9907415056 Ave & W 33 St40.749013-73.98848415440Subscriber19811
215132014-01-01 00:16:382014-01-01 00:25:11382University Pl & E 14 St40.734927-73.992005401Allen St & Rivington St40.720196-73.98997814650Subscriber19901
224302014-01-01 00:18:472014-01-01 00:25:57285Broadway & E 14 St40.734546-73.990741380W 4 St & 7 Ave S40.734011-74.00293919415Subscriber19712
238372014-01-01 00:18:542014-01-01 00:32:51488W 39 St & 9 Ave40.756458-73.993722380W 4 St & 7 Ave S40.734011-74.00293916827Subscriber19631
248342014-01-01 00:19:032014-01-01 00:32:57488W 39 St & 9 Ave40.756458-73.993722380W 4 St & 7 Ave S40.734011-74.00293920280Subscriber19631
\n", - "
" - ], - "text/plain": [ - " tripduration starttime stoptime start station id \\\n", - "0 471 2014-01-01 00:00:06 2014-01-01 00:07:57 2009 \n", - "1 1494 2014-01-01 00:00:38 2014-01-01 00:25:32 536 \n", - "2 464 2014-01-01 00:03:59 2014-01-01 00:11:43 228 \n", - "3 373 2014-01-01 00:05:15 2014-01-01 00:11:28 519 \n", - "4 660 2014-01-01 00:05:18 2014-01-01 00:16:18 83 \n", - "5 330 2014-01-01 00:05:55 2014-01-01 00:11:25 422 \n", - "6 261 2014-01-01 00:06:04 2014-01-01 00:10:25 516 \n", - "7 337 2014-01-01 00:06:41 2014-01-01 00:12:18 380 \n", - "8 429 2014-01-01 00:07:33 2014-01-01 00:14:42 296 \n", - "9 1025 2014-01-01 00:08:27 2014-01-01 00:25:32 540 \n", - "10 718 2014-01-01 00:09:32 2014-01-01 00:21:30 263 \n", - "11 786 2014-01-01 00:10:59 2014-01-01 00:24:05 153 \n", - "12 267 2014-01-01 00:11:17 2014-01-01 00:15:44 151 \n", - "13 744 2014-01-01 00:12:23 2014-01-01 00:24:47 450 \n", - "14 704 2014-01-01 00:12:25 2014-01-01 00:24:09 331 \n", - "15 1367 2014-01-01 00:12:47 2014-01-01 00:35:34 519 \n", - "16 327 2014-01-01 00:13:11 2014-01-01 00:18:38 502 \n", - "17 223 2014-01-01 00:15:30 2014-01-01 00:19:13 528 \n", - "18 577 2014-01-01 00:16:04 2014-01-01 00:25:41 467 \n", - "19 566 2014-01-01 00:16:13 2014-01-01 00:25:39 467 \n", - "20 637 2014-01-01 00:16:32 2014-01-01 00:27:09 285 \n", - "21 513 2014-01-01 00:16:38 2014-01-01 00:25:11 382 \n", - "22 430 2014-01-01 00:18:47 2014-01-01 00:25:57 285 \n", - "23 837 2014-01-01 00:18:54 2014-01-01 00:32:51 488 \n", - "24 834 2014-01-01 00:19:03 2014-01-01 00:32:57 488 \n", - "\n", - " start station name start station latitude \\\n", - "0 Catherine St & Monroe St 40.711174 \n", - "1 1 Ave & E 30 St 40.741444 \n", - "2 E 48 St & 3 Ave 40.754601 \n", - "3 Pershing Square N 40.751884 \n", - "4 Atlantic Ave & Fort Greene Pl 40.683826 \n", - "5 W 59 St & 10 Ave 40.770513 \n", - "6 E 47 St & 1 Ave 40.752069 \n", - "7 W 4 St & 7 Ave S 40.734011 \n", - "8 Division St & Bowery 40.714131 \n", - "9 Lexington Ave & E 26 St 40.741473 \n", - "10 Elizabeth St & Hester St 40.717290 \n", - "11 E 40 St & 5 Ave 40.752062 \n", - "12 Cleveland Pl & Spring St 40.721816 \n", - "13 W 49 St & 8 Ave 40.762272 \n", - "14 Pike St & Monroe St 40.711731 \n", - "15 Pershing Square N 40.751884 \n", - "16 Henry St & Grand St 40.714215 \n", - "17 2 Ave & E 31 St 40.742909 \n", - "18 Dean St & 4 Ave 40.683125 \n", - "19 Dean St & 4 Ave 40.683125 \n", - "20 Broadway & E 14 St 40.734546 \n", - "21 University Pl & E 14 St 40.734927 \n", - "22 Broadway & E 14 St 40.734546 \n", - "23 W 39 St & 9 Ave 40.756458 \n", - "24 W 39 St & 9 Ave 40.756458 \n", - "\n", - " start station longitude end station id end station name \\\n", - "0 -73.996826 263 Elizabeth St & Hester St \n", - "1 -73.975361 259 South St & Whitehall St \n", - "2 -73.971879 2022 E 59 St & Sutton Pl \n", - "3 -73.977702 526 E 33 St & 5 Ave \n", - "4 -73.976323 436 Hancock St & Bedford Ave \n", - "5 -73.988038 526 E 33 St & 5 Ave \n", - "6 -73.967844 167 E 39 St & 3 Ave \n", - "7 -74.002939 435 W 21 St & 6 Ave \n", - "8 -73.997047 306 Cliff St & Fulton St \n", - "9 -73.983209 447 8 Ave & W 52 St \n", - "10 -73.996375 251 Mott St & Prince St \n", - "11 -73.981632 290 2 Ave & E 58 St \n", - "12 -73.997203 410 Suffolk St & Stanton St \n", - "13 -73.987882 505 6 Ave & W 33 St \n", - "14 -73.991930 195 Liberty St & Broadway \n", - "15 -73.977702 386 Centre St & Worth St \n", - "16 -73.981346 411 E 6 St & Avenue D \n", - "17 -73.977061 518 E 39 St & 2 Ave \n", - "18 -73.978951 270 Adelphi St & Myrtle Ave \n", - "19 -73.978951 270 Adelphi St & Myrtle Ave \n", - "20 -73.990741 505 6 Ave & W 33 St \n", - "21 -73.992005 401 Allen St & Rivington St \n", - "22 -73.990741 380 W 4 St & 7 Ave S \n", - "23 -73.993722 380 W 4 St & 7 Ave S \n", - "24 -73.993722 380 W 4 St & 7 Ave S \n", - "\n", - " end station latitude end station longitude bikeid usertype \\\n", - "0 40.717290 -73.996375 16379 Subscriber \n", - "1 40.701221 -74.012342 15611 Subscriber \n", - "2 40.758491 -73.959206 16613 Subscriber \n", - "3 40.747659 -73.984907 15938 Subscriber \n", - "4 40.682166 -73.953990 19830 Subscriber \n", - "5 40.747659 -73.984907 17343 Subscriber \n", - "6 40.748901 -73.976049 17880 Subscriber \n", - "7 40.741740 -73.994156 16275 Subscriber \n", - "8 40.708235 -74.005301 17318 Subscriber \n", - "9 40.763707 -73.985162 15525 Subscriber \n", - "10 40.723180 -73.994800 15693 Customer \n", - "11 40.760203 -73.964785 15281 Subscriber \n", - "12 40.720664 -73.985180 15159 Subscriber \n", - "13 40.749013 -73.988484 15157 Subscriber \n", - "14 40.709056 -74.010434 17080 Subscriber \n", - "15 40.714948 -74.002345 20731 Customer \n", - "16 40.722281 -73.976687 15655 Subscriber \n", - "17 40.747804 -73.973442 15737 Subscriber \n", - "18 40.693083 -73.971789 16115 Subscriber \n", - "19 40.693083 -73.971789 15753 Subscriber \n", - "20 40.749013 -73.988484 15440 Subscriber \n", - "21 40.720196 -73.989978 14650 Subscriber \n", - "22 40.734011 -74.002939 19415 Subscriber \n", - "23 40.734011 -74.002939 16827 Subscriber \n", - "24 40.734011 -74.002939 20280 Subscriber \n", - "\n", - " birth year gender \n", - "0 1986 1 \n", - "1 1963 1 \n", - "2 1991 1 \n", - "3 1989 1 \n", - "4 1990 1 \n", - "5 1987 1 \n", - "6 1983 1 \n", - "7 1963 1 \n", - "8 1972 2 \n", - "9 1981 1 \n", - "10 \\N 0 \n", - "11 1968 1 \n", - "12 1983 1 \n", - "13 1976 1 \n", - "14 1980 2 \n", - "15 \\N 0 \n", - "16 1973 2 \n", - "17 1982 1 \n", - "18 1983 1 \n", - "19 1983 2 \n", - "20 1981 1 \n", - "21 1990 1 \n", - "22 1971 2 \n", - "23 1963 1 \n", - "24 1963 1 " - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df.head(25)" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "id": "bd6ccdd6-b2e6-4d7b-b824-12d01469a6f6", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "Index(['tripduration', 'starttime', 'stoptime', 'start station id',\n", - " 'start station name', 'start station latitude',\n", - " 'start station longitude', 'end station id', 'end station name',\n", - " 'end station latitude', 'end station longitude', 'bikeid', 'usertype',\n", - " 'birth year', 'gender'],\n", - " dtype='object')" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df.columns" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "id": "fa48ade1-86de-4fcd-84c0-2064a4a42b0a", - "metadata": { - "tags": [] - }, - "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", - "
tripdurationstart station idstart station latitudestart station longitudeend station idend station latitudeend station longitudebikeidgender
count3.004000e+05300400.000000300400.000000300400.000000300400.000000300400.000000300400.000000300400.000000300400.000000
mean7.339689e+02436.93659840.734996-73.990135437.74276340.734814-73.99032817992.0820441.165632
std5.271464e+03323.8956430.0194080.011779328.9314040.0193830.0118542000.8325640.431966
min6.000000e+0172.00000040.680342-74.01713472.00000040.680342-74.01713414529.0000000.000000
25%3.400000e+02306.00000040.722055-73.998102306.00000040.721816-73.99852216249.0000001.000000
50%5.130000e+02406.00000040.737050-73.990093405.00000040.736529-73.99021417971.0000001.000000
75%7.880000e+02490.00000040.750224-73.981854489.00000040.750200-73.98185419700.0000001.000000
max1.990440e+063002.00000040.770513-73.9500483002.00000040.770513-73.95004821536.0000002.000000
\n", - "
" - ], - "text/plain": [ - " tripduration start station id start station latitude \\\n", - "count 3.004000e+05 300400.000000 300400.000000 \n", - "mean 7.339689e+02 436.936598 40.734996 \n", - "std 5.271464e+03 323.895643 0.019408 \n", - "min 6.000000e+01 72.000000 40.680342 \n", - "25% 3.400000e+02 306.000000 40.722055 \n", - "50% 5.130000e+02 406.000000 40.737050 \n", - "75% 7.880000e+02 490.000000 40.750224 \n", - "max 1.990440e+06 3002.000000 40.770513 \n", - "\n", - " start station longitude end station id end station latitude \\\n", - "count 300400.000000 300400.000000 300400.000000 \n", - "mean -73.990135 437.742763 40.734814 \n", - "std 0.011779 328.931404 0.019383 \n", - "min -74.017134 72.000000 40.680342 \n", - "25% -73.998102 306.000000 40.721816 \n", - "50% -73.990093 405.000000 40.736529 \n", - "75% -73.981854 489.000000 40.750200 \n", - "max -73.950048 3002.000000 40.770513 \n", - "\n", - " end station longitude bikeid gender \n", - "count 300400.000000 300400.000000 300400.000000 \n", - "mean -73.990328 17992.082044 1.165632 \n", - "std 0.011854 2000.832564 0.431966 \n", - "min -74.017134 14529.000000 0.000000 \n", - "25% -73.998522 16249.000000 1.000000 \n", - "50% -73.990214 17971.000000 1.000000 \n", - "75% -73.981854 19700.000000 1.000000 \n", - "max -73.950048 21536.000000 2.000000 " - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df.describe()\n", - "# we can't edit this function\n" - ] - }, - { - "cell_type": "code", - "execution_count": 7, - "id": "aad2dd62-c406-4cbc-a197-60906b365536", - "metadata": { - "tags": [] - }, - "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", - "
tripdurationstarttimestoptimestart station idstart station namestart station latitudestart station longitudeend station idend station nameend station latitudeend station longitudebikeidusertypebirth yeargender
1637795052014-01-17 08:16:122014-01-17 08:24:3772W 52 St & 11 Ave40.767272-73.993929326E 11 St & 1 Ave40.729538-73.98426719234Subscriber19862
1559874572014-01-16 18:02:012014-01-16 18:09:3872W 52 St & 11 Ave40.767272-73.993929510W 51 St & 6 Ave40.760660-73.98042020725Subscriber19841
950898882014-01-13 10:20:022014-01-13 10:34:5072W 52 St & 11 Ave40.767272-73.993929462W 22 St & 10 Ave40.746920-74.00451915847Subscriber19592
555635572014-01-09 18:13:562014-01-09 18:23:1372W 52 St & 11 Ave40.767272-73.993929405Washington St & Gansevoort St40.739323-74.00811915790Subscriber19711
2035602312014-01-20 11:40:422014-01-20 11:44:3372W 52 St & 11 Ave40.767272-73.993929449W 52 St & 9 Ave40.764618-73.98789518405Subscriber19892
................................................
15799411612014-01-16 19:03:382014-01-16 19:22:593002South End Ave & Liberty St40.711512-74.015756483E 12 St & 3 Ave40.732233-73.98890021097Subscriber19881
2656824382014-01-29 09:23:152014-01-29 09:30:333002South End Ave & Liberty St40.711512-74.015756304Broadway & Battery Pl40.704633-74.01361719839Subscriber19821
2655905032014-01-29 09:15:592014-01-29 09:24:223002South End Ave & Liberty St40.711512-74.015756152Warren St & Church St40.714740-74.00910619624Subscriber19772
18343213232014-01-18 10:47:592014-01-18 11:10:023002South End Ave & Liberty St40.711512-74.015756435W 21 St & 6 Ave40.741740-73.99415617215Subscriber19682
18564810302014-01-18 14:12:012014-01-18 14:29:113002South End Ave & Liberty St40.711512-74.01575672W 52 St & 11 Ave40.767272-73.99392921108Subscriber19841
\n", - "

300400 rows × 15 columns

\n", - "
" - ], - "text/plain": [ - " tripduration starttime stoptime \\\n", - "163779 505 2014-01-17 08:16:12 2014-01-17 08:24:37 \n", - "155987 457 2014-01-16 18:02:01 2014-01-16 18:09:38 \n", - "95089 888 2014-01-13 10:20:02 2014-01-13 10:34:50 \n", - "55563 557 2014-01-09 18:13:56 2014-01-09 18:23:13 \n", - "203560 231 2014-01-20 11:40:42 2014-01-20 11:44:33 \n", - "... ... ... ... \n", - "157994 1161 2014-01-16 19:03:38 2014-01-16 19:22:59 \n", - "265682 438 2014-01-29 09:23:15 2014-01-29 09:30:33 \n", - "265590 503 2014-01-29 09:15:59 2014-01-29 09:24:22 \n", - "183432 1323 2014-01-18 10:47:59 2014-01-18 11:10:02 \n", - "185648 1030 2014-01-18 14:12:01 2014-01-18 14:29:11 \n", - "\n", - " start station id start station name start station latitude \\\n", - "163779 72 W 52 St & 11 Ave 40.767272 \n", - "155987 72 W 52 St & 11 Ave 40.767272 \n", - "95089 72 W 52 St & 11 Ave 40.767272 \n", - "55563 72 W 52 St & 11 Ave 40.767272 \n", - "203560 72 W 52 St & 11 Ave 40.767272 \n", - "... ... ... ... \n", - "157994 3002 South End Ave & Liberty St 40.711512 \n", - "265682 3002 South End Ave & Liberty St 40.711512 \n", - "265590 3002 South End Ave & Liberty St 40.711512 \n", - "183432 3002 South End Ave & Liberty St 40.711512 \n", - "185648 3002 South End Ave & Liberty St 40.711512 \n", - "\n", - " start station longitude end station id \\\n", - "163779 -73.993929 326 \n", - "155987 -73.993929 510 \n", - "95089 -73.993929 462 \n", - "55563 -73.993929 405 \n", - "203560 -73.993929 449 \n", - "... ... ... \n", - "157994 -74.015756 483 \n", - "265682 -74.015756 304 \n", - "265590 -74.015756 152 \n", - "183432 -74.015756 435 \n", - "185648 -74.015756 72 \n", - "\n", - " end station name end station latitude \\\n", - "163779 E 11 St & 1 Ave 40.729538 \n", - "155987 W 51 St & 6 Ave 40.760660 \n", - "95089 W 22 St & 10 Ave 40.746920 \n", - "55563 Washington St & Gansevoort St 40.739323 \n", - "203560 W 52 St & 9 Ave 40.764618 \n", - "... ... ... \n", - "157994 E 12 St & 3 Ave 40.732233 \n", - "265682 Broadway & Battery Pl 40.704633 \n", - "265590 Warren St & Church St 40.714740 \n", - "183432 W 21 St & 6 Ave 40.741740 \n", - "185648 W 52 St & 11 Ave 40.767272 \n", - "\n", - " end station longitude bikeid usertype birth year gender \n", - "163779 -73.984267 19234 Subscriber 1986 2 \n", - "155987 -73.980420 20725 Subscriber 1984 1 \n", - "95089 -74.004519 15847 Subscriber 1959 2 \n", - "55563 -74.008119 15790 Subscriber 1971 1 \n", - "203560 -73.987895 18405 Subscriber 1989 2 \n", - "... ... ... ... ... ... \n", - "157994 -73.988900 21097 Subscriber 1988 1 \n", - "265682 -74.013617 19839 Subscriber 1982 1 \n", - "265590 -74.009106 19624 Subscriber 1977 2 \n", - "183432 -73.994156 17215 Subscriber 1968 2 \n", - "185648 -73.993929 21108 Subscriber 1984 1 \n", - "\n", - "[300400 rows x 15 columns]" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df.sort_values('start station id')" - ] - }, - { - "cell_type": "code", - "execution_count": 8, - "id": "c8ad24b4-a65c-4120-b78b-31be7991ba7f", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "tripduration int64\n", - "starttime object\n", - "stoptime object\n", - "start station id int64\n", - "start station name object\n", - "start station latitude float64\n", - "start station longitude float64\n", - "end station id int64\n", - "end station name object\n", - "end station latitude float64\n", - "end station longitude float64\n", - "bikeid int64\n", - "usertype object\n", - "birth year object\n", - "gender int64\n", - "dtype: object" - ] - }, - "execution_count": 8, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df.dtypes" - ] - }, - { - "cell_type": "code", - "execution_count": 9, - "id": "6546e639-5293-4f5c-a6ce-6b9542f8b4c6", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "tripduration 0\n", - "starttime 0\n", - "stoptime 0\n", - "start station id 0\n", - "start station name 0\n", - "start station latitude 0\n", - "start station longitude 0\n", - "end station id 0\n", - "end station name 0\n", - "end station latitude 0\n", - "end station longitude 0\n", - "bikeid 0\n", - "usertype 0\n", - "birth year 0\n", - "gender 0\n", - "dtype: int64" - ] - }, - "execution_count": 9, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "df.isna().sum()" - ] - }, - { - "cell_type": "code", - "execution_count": 13, - "id": "dab96c9c-b105-47e4-8781-db0148b7bbfd", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "tripduration\n", - "385 512\n", - "350 505\n", - "382 502\n", - "376 499\n", - "374 497\n", - " ... \n", - "43227 1\n", - "11723 1\n", - "32886 1\n", - "3597 1\n", - "55504 1\n", - "Name: count, Length: 4502, dtype: int64" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "trip_d_counts = df['tripduration'].value_counts()\n", - "trip_d_counts" - ] - }, - { - "cell_type": "code", - "execution_count": 15, - "id": "dac3af6d-7b54-4ce9-b7ef-07473ed63317", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "1615" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "trip_d_counts[trip_d_counts==1].sum() #durations that only happened once" - ] - }, - { - "cell_type": "code", - "execution_count": 10, - "id": "74f69c57-d811-45fd-adc4-f30b1893cba6", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "tripduration starttime stoptime start station id start station name start station latitude start station longitude end station id end station name end station latitude end station longitude bikeid usertype birth year gender\n", - "60 2014-01-02 15:58:30 2014-01-02 15:59:30 492 W 33 St & 7 Ave 40.750200 -73.990931 492 W 33 St & 7 Ave 40.750200 -73.990931 16179 Subscriber 1986 1 1\n", - "671 2014-01-29 14:38:08 2014-01-29 14:49:19 472 E 32 St & Park Ave 40.745712 -73.981948 538 W 49 St & 5 Ave 40.757952 -73.977876 16002 Subscriber 1959 2 1\n", - " 2014-01-30 14:55:15 2014-01-30 15:06:26 367 E 53 St & Lexington Ave 40.758281 -73.970694 173 Broadway & W 49 St 40.760647 -73.984427 15672 Subscriber 1978 1 1\n", - " 2014-01-30 14:21:24 2014-01-30 14:32:35 531 Forsyth St & Broome St 40.718939 -73.992663 342 Columbia St & Rivington St 40.717400 -73.980166 16368 Subscriber 1982 2 1\n", - " 2014-01-30 14:02:25 2014-01-30 14:13:36 523 W 38 St & 8 Ave 40.754666 -73.991382 168 W 18 St & 6 Ave 40.739713 -73.994564 15657 Subscriber 1982 1 1\n", - " ..\n", - "395 2014-01-12 03:25:01 2014-01-12 03:31:36 465 Broadway & W 41 St 40.755136 -73.986580 498 Broadway & W 32 St 40.748549 -73.988084 20603 Subscriber 1989 1 1\n", - " 2014-01-11 22:36:28 2014-01-11 22:43:03 253 W 13 St & 5 Ave 40.735439 -73.994539 336 Sullivan St & Washington Sq 40.730477 -73.999061 20967 Subscriber 1983 1 1\n", - " 2014-01-11 20:26:23 2014-01-11 20:32:58 300 Shevchenko Pl & E 6 St 40.728145 -73.990214 317 E 6 St & Avenue B 40.724537 -73.981854 21050 Subscriber 1970 2 1\n", - " 2014-01-11 19:17:50 2014-01-11 19:24:25 310 State St & Smith St 40.689269 -73.989129 416 Cumberland St & Lafayette Ave 40.687534 -73.972652 16484 Subscriber 1967 1 1\n", - "1990440 2014-01-28 17:38:05 2014-02-20 18:32:08 524 W 43 St & 6 Ave 40.755273 -73.983169 152 Warren St & Church St 40.714740 -74.009106 15132 Subscriber 1980 1 1\n", - "Name: count, Length: 300400, dtype: int64" - ] - }, - "execution_count": 10, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "ab = df.value_counts()\n", - "ab" - ] - }, - { - "cell_type": "code", - "execution_count": 16, - "id": "0a45badb-8a1d-4527-b078-dae580e7b0d9", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "tripduration 4502\n", - "starttime 266586\n", - "stoptime 267463\n", - "start station id 329\n", - "start station name 329\n", - "start station latitude 329\n", - "start station longitude 329\n", - "end station id 329\n", - "end station name 329\n", - "end station latitude 329\n", - "end station longitude 329\n", - "bikeid 6354\n", - "usertype 2\n", - "birth year 79\n", - "gender 3\n", - "dtype: int64" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "pd.Series(dict([[col, len(df[col].value_counts())] for col in df.columns]))" - ] - }, - { - "cell_type": "code", - "execution_count": 17, - "id": "3e7589c2-bb34-477b-b1a6-e69485dbc7c4", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute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Ud999txITE3X06NGAmbNnz+rYsWP2+4oSExNVUVERMFN3+3Iz5+6v29apU6eAmYEDB15wrdHR0YqOjq63PTIystG++Xy1YfLVfHeK0JWch8Y8f82B0/NJzs/o9HwSGZ3A6fmk0GUM5hiN/neEPvvsM3355Zd2GUlPT9fx48dVVlZmz2zevFm1tbVKS0uzZ7Zu3RrwGp/b7VbPnj3Vtm1be6akpCTgsdxut9LT0yVJKSkpSkxMDJiprKzUjh077BkAAGC2oIvQqVOnVF5ervLycknfvCm5vLxchw8f1qlTpzRlyhRt375df/vb31RSUqL77rtPPXr0kMv1zUsqvXv31vDhwzVx4kTt3LlT77//vnJzczVmzBglJSVJkn7yk58oKipK48eP1759+7Rq1SotWbIk4GWrJ554QkVFRVq4cKH279+vWbNm6YMPPlBubq4kKSwsTHl5eXrmmWf0xz/+UXv27NHPfvYzJSUlaeTIkVd52gAAgBME/dLYBx98oKFDh9q368pJdna2Xn75ZX344YdasWKFjh8/rqSkJGVmZmru3LkBLzm9/vrrys3N1d13363w8HCNGjVKL7zwgr0/Pj5excXFysnJUWpqqjp06KAZM2YE/K2hW2+9VStXrtT06dP1i1/8Qt///ve1bt063XDDDfbM1KlTVVVVpUcffVTHjx/X7bffrqKiIsXExAQbGwAAOFDQRWjIkCGyrIt/5HvTpk2XPUa7du20cuXKS870799ff/7zny8588ADD+iBBx646P6wsDDNmTNHc+bMueyaAACAefi3xgAAgLEoQgAAwFgUIQAAYCyKEAAAMBZFCAAAGIsiBAAAjEURAgAAxqIIAQAAY1GEAACAsShCAADAWBQhAABgLIoQAAAwFkUIAAAYiyIEAACMRRECAADGoggBAABjUYQAAICxKEIAAMBYFCEAAGAsihAAADAWRQgAABiLIgQAAIxFEQIAAMaiCAEAAGNRhAAAgLEoQgAAwFgUIQAAYCyKEAAAMBZFCAAAGIsiBAAAjEURAgAAxqIIAQAAY1GEAACAsShCAADAWBQhAABgLIoQAAAwFkUIAAAYiyIEAACMRRECAADGoggBAABjUYQAAICxKEIAAMBY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U+8vVSckJNR7jbqO1+u95Hzd/w3mmI3pSjKe78knn1RSUlLAN/Hw4cP12muvqaSkRM8995y2bNmiESNGqKamJqTrb4grydizZ08tW7ZMb731ln7729+qtrZWt956qz777DNJzes6Xu013Llzp/bu3asJEyYEbG9O1/BKXOxnsbKyUl9//XVIvvebkwULFujUqVP68Y9/bG9LS0tTYWGhioqK9PLLL+vQoUO64447dPLkySZcacN16tRJS5cu1e9//3v9/ve/V3JysoYMGaJdu3ZJCs3/fjUnR44c0Z/+9Kd6P4vN9TrW1tYqLy9Pt912m2644YaLzjXl70XH/xMbaHrPPvus3nzzTZWWlga8mXjMmDH2f/fr10/9+/dX9+7dVVpaqrvvvrsplhqU9PT0gH+899Zbb1Xv3r31X//1X5o7d24Triz0Xn31VfXr10+DBw8O2P5dv4YmWblypWbPnq233nor4P0zI0aMsP+7f//+SktLU9euXbV69WqNHz++KZYalJ49e6pnz5727VtvvVUHDx7U4sWL9d///d9NuLLGsWLFCrVp00YjR44M2N5cr2NOTo727t3bpO87uxyeEbpKHTp0UEREhCoqKgK2V1RUKDEx8YL3SUxMvOR83f8N5piN6Uoy1lmwYIGeffZZFRcXq3///pecve6669ShQwd9+umnV73mYF1NxjqRkZG68cYb7fU3p+t4Nfmqqqr05ptvNuh/TJvyGl6Ji/0sxsXFqWXLliH5vmgO3nzzTU2YMEGrV6+u9/LD+dq0aaPrr7/+O3MNL2Tw4MH2+p1yDaVvPjW1bNkyjR07VlFRUZecbQ7XMTc3V+vXr9e7776rzp07X3K2KX8vUoSuUlRUlFJTU1VSUmJvq62tVUlJScCzBedKT08PmJckt9ttz6ekpCgxMTFgprKyUjt27LjoMRvTlWSUvnmH/9y5c1VUVKRBgwZd9nE+++wzffnll+rUqVNI1h2MK814rpqaGu3Zs8def3O6jleTb82aNfL5fPrpT3962cdpymt4JS73sxiK74um9sYbb2jcuHF64403Av70wcWcOnVKBw8e/M5cwwspLy+31++Ea1hny5Yt+vTTTxv0/5Q05XW0LEu5ublau3atNm/erJSUlMvep0l/L17VW61hWZZlvfnmm1Z0dLRVWFhoffTRR9ajjz5qtWnTxvJ6vZZlWdbYsWOtp556yp5///33rRYtWlgLFiywPv74Y2vmzJlWZGSktWfPHnvm2Weftdq0aWO99dZb1ocffmjdd999VkpKivX1119/6/ksK/iMzz77rBUVFWX97ne/sz7//HP76+TJk5ZlWdbJkyetn//855bH47EOHTpkvfPOO9ZNN91kff/737fOnDnzncg4e/Zsa9OmTdbBgwetsrIya8yYMVZMTIy1b98+e6Y5Xcdg89W5/fbbrdGjR9fb3hyv4cmTJ63du3dbu3fvtiRZixYtsnbv3m39/e9/tyzLsp566ilr7Nix9vxf//pXKzY21poyZYr18ccfWwUFBVZERIRVVFRkz1zuvDXnfK+//rrVokULq6CgIODn8Pjx4/bMv//7v1ulpaXWoUOHrPfff9/KyMiwOnToYB09evRbz2dZwWdcvHixtW7dOuuTTz6x9uzZYz3xxBNWeHi49c4779gzzekaWlbwGev89Kc/tdLS0i54zOZ0HSdNmmTFx8dbpaWlAd93p0+ftmea0+9FilCI/OpXv7K6dOliRUVFWYMHD7a2b99u7/vBD35gZWdnB8yvXr3auv76662oqCirb9++1oYNGwL219bWWk8//bSVkJBgRUdHW3fffbd14MCBbyPKRQWTsWvXrpakel8zZ860LMuyTp8+bWVmZlrXXnutFRkZaXXt2tWaOHFik/0PU51gMubl5dmzCQkJ1j333GPt2rUr4HjN7ToG+326f/9+S5JVXFxc71jN8RrWfZT6/K+6XNnZ2dYPfvCDevcZOHCgFRUVZV133XXW8uXL6x33Uuft2xRsvh/84AeXnLesb/5cQKdOnayoqCjre9/7njV69Gjr008//XaDnSPYjM8995zVvXt3KyYmxmrXrp01ZMgQa/PmzfWO21yuoWVd2ffp8ePHrZYtW1q//vWvL3jM5nQdL5RNUsDPVnP6vRj2/xcNAABgHN4jBAAAjEURAgAAxqIIAQAAY1GEAACAsShCAADAWBQhAABgLIoQAAAwFkUIAAB867Zu3ap7771XSUlJCgsL07p164I+hmVZWrBgga6//npFR0fre9/7nv7zP/8zqGPwr88DAIBvXVVVlQYMGKBHHnlE999//xUd44knnlBxcbEWLFigfv366dixYzp27FhQx+AvSwMAgCYVFhamtWvXauTIkfY2n8+n//iP/9Abb7yh48eP64YbbtBzzz2nIUOGSJI+/vhj9e/fX3v37lXPnj2v+LF5aQwAADQ7ubm58ng8evPNN/Xhhx/qgQce0PDhw/XJJ59Ikt5++21dd911Wr9+vVJSUtStWzdNmDAh6GeEKEIAAKBZOXz4sJYvX641a9bojjvuUPfu3fXzn/9ct99+u5YvXy5J+utf/6q///3vWrNmjV577TUVFhaqrKxMP/rRj4J6LN4jBAAAmpU9e/aopqZG119/fcB2n8+n9u3bS5Jqa2vl8/n02muv2XOvvvqqUlNTdeDAgQa/XEYRAgAAzcqpU6cUERGhsrIyRUREBOy75pprJEmdOnVSixYtAspS7969JX3zjBJFCAAAfCfdeOONqqmp0dGjR3XHHXdccOa2227T2bNndfDgQXXv3l2S9L//+7+SpK5duzb4sfjUGAAA+NadOnVKn376qaRvis+iRYs0dOhQtWvXTl26dNFPf/pTvf/++1q4cKFuvPFGffHFFyopKVH//v2VlZWl2tpa3Xzzzbrmmmv0/PPPq7a2Vjk5OYqLi1NxcXGD10ERAgAA37rS0lINHTq03vbs7GwVFhbK7/frmWee0WuvvaZ//vOf6tChg2655RbNnj1b/fr1kyQdOXJEjz/+uIqLi9WqVSuNGDFCCxcuVLt27Rq8DooQAAAwFh+fBwAAxqIIAQAAY1GEAACAsShCAADAWBQhAABgLIoQAAAwFkUIAAAYiyIEAACMRRECAADGoggBAABjUYQAAICxKEIAAMBY/w8KcfRfIHEI/wAAAABJRU5ErkJggg==", - "text/plain": [ - "
" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "df['tripduration'].hist()" - ] - }, - { - "cell_type": "code", - "execution_count": 18, - "id": "cabf81db-6c49-4274-8460-770405d1a405", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "{'nan_count': 0,\n", - " 'distinct_count': 1615,\n", - " 'min': 60,\n", - " 'mean': 733.9689447403462,\n", - " 'max': 1990440,\n", - " 'dtype': dtype('int64')}" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "def col_stats(ser):\n", - " l = len(ser)\n", - " values = ser.value_counts()\n", - " return dict(\n", - " nan_count = ser.isna().sum(),\n", - " distinct_count = values[values == 1].sum(),\n", - " min = ser.min(),\n", - " mean = ser.mean(),\n", - " max = ser.max(),\n", - " dtype = ser.dtype)\n", - "col_stats(df['tripduration'])" - ] - }, - { - "cell_type": "code", - "execution_count": 19, - "id": "21d22855-7f52-41ab-b3a8-4e23b77f2e76", - "metadata": { - "tags": [] - }, - "outputs": [], - "source": [ - "sampled_df = df.sample(50) # grab 50 random rows" - ] - }, - { - "cell_type": "code", - "execution_count": 20, - "id": "15bdaf26-09c0-4350-bfec-0db1362a79f5", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "ename": "TypeError", - "evalue": "Could not convert string '2014-01-11 07:18:292014-01-17 22:35:122014-01-25 23:03:312014-01-07 13:06:052014-01-18 09:41:582014-01-27 14:58:362014-01-08 10:36:522014-01-02 19:19:522014-01-03 08:03:132014-01-20 16:58:002014-01-14 16:43:132014-01-17 06:27:252014-01-18 11:17:332014-01-15 17:08:142014-01-13 11:40:182014-01-30 17:19:182014-01-26 03:06:292014-01-29 17:51:082014-01-17 09:03:482014-01-19 13:09:322014-01-08 08:58:282014-01-15 12:35:342014-01-30 19:19:502014-01-23 08:49:162014-01-16 15:59:092014-01-10 20:00:442014-01-28 18:24:372014-01-01 18:58:342014-01-17 18:49:252014-01-16 11:56:452014-01-14 07:16:082014-01-12 09:43:542014-01-31 15:24:332014-01-22 18:25:162014-01-20 17:55:582014-01-06 17:52:012014-01-12 10:25:442014-01-26 19:37:262014-01-20 06:37:262014-01-11 00:22:172014-01-15 16:36:232014-01-06 17:39:112014-01-15 15:12:582014-01-10 09:13:292014-01-26 11:27:172014-01-27 07:40:552014-01-27 06:50:092014-01-31 16:31:512014-01-06 19:05:402014-01-27 18:30:28' to numeric", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[20], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m pd\u001b[38;5;241m.\u001b[39mDataFrame(\u001b[38;5;28mdict\u001b[39m(\u001b[43m[\u001b[49m\u001b[43m[\u001b[49m\u001b[43mcol\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mcol_stats\u001b[49m\u001b[43m(\u001b[49m\u001b[43msampled_df\u001b[49m\u001b[43m[\u001b[49m\u001b[43mcol\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mcol\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43msampled_df\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcolumns\u001b[49m\u001b[43m]\u001b[49m))\n", - "Cell \u001b[0;32mIn[20], line 1\u001b[0m, in \u001b[0;36m\u001b[0;34m(.0)\u001b[0m\n\u001b[0;32m----> 1\u001b[0m pd\u001b[38;5;241m.\u001b[39mDataFrame(\u001b[38;5;28mdict\u001b[39m([[col, \u001b[43mcol_stats\u001b[49m\u001b[43m(\u001b[49m\u001b[43msampled_df\u001b[49m\u001b[43m[\u001b[49m\u001b[43mcol\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m] \u001b[38;5;28;01mfor\u001b[39;00m col \u001b[38;5;129;01min\u001b[39;00m sampled_df\u001b[38;5;241m.\u001b[39mcolumns]))\n", - "Cell \u001b[0;32mIn[18], line 8\u001b[0m, in \u001b[0;36mcol_stats\u001b[0;34m(ser)\u001b[0m\n\u001b[1;32m 2\u001b[0m l \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mlen\u001b[39m(ser)\n\u001b[1;32m 3\u001b[0m values \u001b[38;5;241m=\u001b[39m ser\u001b[38;5;241m.\u001b[39mvalue_counts()\n\u001b[1;32m 4\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mdict\u001b[39m(\n\u001b[1;32m 5\u001b[0m nan_count \u001b[38;5;241m=\u001b[39m ser\u001b[38;5;241m.\u001b[39misna()\u001b[38;5;241m.\u001b[39msum(),\n\u001b[1;32m 6\u001b[0m distinct_count \u001b[38;5;241m=\u001b[39m values[values \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m1\u001b[39m]\u001b[38;5;241m.\u001b[39msum(),\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28mmin\u001b[39m \u001b[38;5;241m=\u001b[39m ser\u001b[38;5;241m.\u001b[39mmin(),\n\u001b[0;32m----> 8\u001b[0m mean \u001b[38;5;241m=\u001b[39m \u001b[43mser\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmean\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m,\n\u001b[1;32m 9\u001b[0m \u001b[38;5;28mmax\u001b[39m \u001b[38;5;241m=\u001b[39m ser\u001b[38;5;241m.\u001b[39mmax(),\n\u001b[1;32m 10\u001b[0m dtype \u001b[38;5;241m=\u001b[39m ser\u001b[38;5;241m.\u001b[39mdtype)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-1/lib/python3.11/site-packages/pandas/core/series.py:6221\u001b[0m, in \u001b[0;36mSeries.mean\u001b[0;34m(self, axis, skipna, numeric_only, **kwargs)\u001b[0m\n\u001b[1;32m 6213\u001b[0m \u001b[38;5;129m@doc\u001b[39m(make_doc(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mmean\u001b[39m\u001b[38;5;124m\"\u001b[39m, ndim\u001b[38;5;241m=\u001b[39m\u001b[38;5;241m1\u001b[39m))\n\u001b[1;32m 6214\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mmean\u001b[39m(\n\u001b[1;32m 6215\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 6219\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[1;32m 6220\u001b[0m ):\n\u001b[0;32m-> 6221\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mNDFrame\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmean\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mskipna\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnumeric_only\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-1/lib/python3.11/site-packages/pandas/core/generic.py:11978\u001b[0m, in \u001b[0;36mNDFrame.mean\u001b[0;34m(self, axis, skipna, numeric_only, **kwargs)\u001b[0m\n\u001b[1;32m 11971\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mmean\u001b[39m(\n\u001b[1;32m 11972\u001b[0m \u001b[38;5;28mself\u001b[39m,\n\u001b[1;32m 11973\u001b[0m axis: Axis \u001b[38;5;241m|\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 11976\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[1;32m 11977\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Series \u001b[38;5;241m|\u001b[39m \u001b[38;5;28mfloat\u001b[39m:\n\u001b[0;32m> 11978\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_stat_function\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 11979\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mmean\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnanops\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mnanmean\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mskipna\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnumeric_only\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\n\u001b[1;32m 11980\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-1/lib/python3.11/site-packages/pandas/core/generic.py:11935\u001b[0m, in \u001b[0;36mNDFrame._stat_function\u001b[0;34m(self, name, func, axis, skipna, numeric_only, **kwargs)\u001b[0m\n\u001b[1;32m 11931\u001b[0m nv\u001b[38;5;241m.\u001b[39mvalidate_func(name, (), kwargs)\n\u001b[1;32m 11933\u001b[0m validate_bool_kwarg(skipna, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mskipna\u001b[39m\u001b[38;5;124m\"\u001b[39m, none_allowed\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[0;32m> 11935\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_reduce\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 11936\u001b[0m \u001b[43m \u001b[49m\u001b[43mfunc\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mname\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mname\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43maxis\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mskipna\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mskipna\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mnumeric_only\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnumeric_only\u001b[49m\n\u001b[1;32m 11937\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-1/lib/python3.11/site-packages/pandas/core/series.py:6129\u001b[0m, in \u001b[0;36mSeries._reduce\u001b[0;34m(self, op, name, axis, skipna, numeric_only, filter_type, **kwds)\u001b[0m\n\u001b[1;32m 6124\u001b[0m \u001b[38;5;66;03m# GH#47500 - change to TypeError to match other methods\u001b[39;00m\n\u001b[1;32m 6125\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\n\u001b[1;32m 6126\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSeries.\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mname\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m does not allow \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mkwd_name\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m=\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnumeric_only\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 6127\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwith non-numeric dtypes.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 6128\u001b[0m )\n\u001b[0;32m-> 6129\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mop\u001b[49m\u001b[43m(\u001b[49m\u001b[43mdelegate\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mskipna\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mskipna\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-1/lib/python3.11/site-packages/pandas/core/nanops.py:147\u001b[0m, in \u001b[0;36mbottleneck_switch.__call__..f\u001b[0;34m(values, axis, skipna, **kwds)\u001b[0m\n\u001b[1;32m 145\u001b[0m result \u001b[38;5;241m=\u001b[39m alt(values, axis\u001b[38;5;241m=\u001b[39maxis, skipna\u001b[38;5;241m=\u001b[39mskipna, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwds)\n\u001b[1;32m 146\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 147\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43malt\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvalues\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43maxis\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mskipna\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mskipna\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwds\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 149\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m result\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-1/lib/python3.11/site-packages/pandas/core/nanops.py:404\u001b[0m, in \u001b[0;36m_datetimelike_compat..new_func\u001b[0;34m(values, axis, skipna, mask, **kwargs)\u001b[0m\n\u001b[1;32m 401\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m datetimelike \u001b[38;5;129;01mand\u001b[39;00m mask \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 402\u001b[0m mask \u001b[38;5;241m=\u001b[39m isna(values)\n\u001b[0;32m--> 404\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[43mvalues\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43maxis\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43maxis\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mskipna\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mskipna\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mmask\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmask\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 406\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m datetimelike:\n\u001b[1;32m 407\u001b[0m result \u001b[38;5;241m=\u001b[39m _wrap_results(result, orig_values\u001b[38;5;241m.\u001b[39mdtype, fill_value\u001b[38;5;241m=\u001b[39miNaT)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-1/lib/python3.11/site-packages/pandas/core/nanops.py:720\u001b[0m, in \u001b[0;36mnanmean\u001b[0;34m(values, axis, skipna, mask)\u001b[0m\n\u001b[1;32m 718\u001b[0m count \u001b[38;5;241m=\u001b[39m _get_counts(values\u001b[38;5;241m.\u001b[39mshape, mask, axis, dtype\u001b[38;5;241m=\u001b[39mdtype_count)\n\u001b[1;32m 719\u001b[0m the_sum \u001b[38;5;241m=\u001b[39m values\u001b[38;5;241m.\u001b[39msum(axis, dtype\u001b[38;5;241m=\u001b[39mdtype_sum)\n\u001b[0;32m--> 720\u001b[0m the_sum \u001b[38;5;241m=\u001b[39m \u001b[43m_ensure_numeric\u001b[49m\u001b[43m(\u001b[49m\u001b[43mthe_sum\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 722\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m axis \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;129;01mand\u001b[39;00m \u001b[38;5;28mgetattr\u001b[39m(the_sum, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mndim\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;28;01mFalse\u001b[39;00m):\n\u001b[1;32m 723\u001b[0m count \u001b[38;5;241m=\u001b[39m cast(np\u001b[38;5;241m.\u001b[39mndarray, count)\n", - "File \u001b[0;32m~/anaconda3/envs/buckaroo-dev-1/lib/python3.11/site-packages/pandas/core/nanops.py:1693\u001b[0m, in \u001b[0;36m_ensure_numeric\u001b[0;34m(x)\u001b[0m\n\u001b[1;32m 1690\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m (is_float(x) \u001b[38;5;129;01mor\u001b[39;00m is_integer(x) \u001b[38;5;129;01mor\u001b[39;00m is_complex(x)):\n\u001b[1;32m 1691\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(x, \u001b[38;5;28mstr\u001b[39m):\n\u001b[1;32m 1692\u001b[0m \u001b[38;5;66;03m# GH#44008, GH#36703 avoid casting e.g. strings to numeric\u001b[39;00m\n\u001b[0;32m-> 1693\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mCould not convert string \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mx\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m to numeric\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 1694\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 1695\u001b[0m x \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mfloat\u001b[39m(x)\n", - "\u001b[0;31mTypeError\u001b[0m: Could not convert string '2014-01-11 07:18:292014-01-17 22:35:122014-01-25 23:03:312014-01-07 13:06:052014-01-18 09:41:582014-01-27 14:58:362014-01-08 10:36:522014-01-02 19:19:522014-01-03 08:03:132014-01-20 16:58:002014-01-14 16:43:132014-01-17 06:27:252014-01-18 11:17:332014-01-15 17:08:142014-01-13 11:40:182014-01-30 17:19:182014-01-26 03:06:292014-01-29 17:51:082014-01-17 09:03:482014-01-19 13:09:322014-01-08 08:58:282014-01-15 12:35:342014-01-30 19:19:502014-01-23 08:49:162014-01-16 15:59:092014-01-10 20:00:442014-01-28 18:24:372014-01-01 18:58:342014-01-17 18:49:252014-01-16 11:56:452014-01-14 07:16:082014-01-12 09:43:542014-01-31 15:24:332014-01-22 18:25:162014-01-20 17:55:582014-01-06 17:52:012014-01-12 10:25:442014-01-26 19:37:262014-01-20 06:37:262014-01-11 00:22:172014-01-15 16:36:232014-01-06 17:39:112014-01-15 15:12:582014-01-10 09:13:292014-01-26 11:27:172014-01-27 07:40:552014-01-27 06:50:092014-01-31 16:31:512014-01-06 19:05:402014-01-27 18:30:28' to numeric" - ] - } - ], - "source": [ - "pd.DataFrame(dict([[col, col_stats(sampled_df[col])] for col in sampled_df.columns]))" - ] - }, - { - "cell_type": "code", - "execution_count": 21, - "id": "30b99e5c-c8b2-496c-822b-b15198e22616", - "metadata": { - "tags": [] - }, - "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", - "
tripdurationstarttimestoptimestart station idstart station namestart station latitudestart station longitudeend station idend station nameend station latitudeend station longitudebikeidusertypebirth yeargender
nan_count000000000000000
distinct_count4850462323232328282828480170
dtypeint64objectobjectint64objectfloat64float64int64objectfloat64float64int64objectobjectint64
min128NaNNaN83NaN40.683125-74.015756127NaN40.682166-74.01234214650NaNNaN0
mean720.24NaNNaN572.3NaN40.73296-73.98873400.14NaN40.730918-73.99000317363.68NaNNaN0.98
max1957NaNNaN3002NaN40.770513-73.9678442022NaN40.763707-73.9539921183NaNNaN2
\n", - "
" - ], - "text/plain": [ - " tripduration starttime stoptime start station id \\\n", - "nan_count 0 0 0 0 \n", - "distinct_count 48 50 46 23 \n", - "dtype int64 object object int64 \n", - "min 128 NaN NaN 83 \n", - "mean 720.24 NaN NaN 572.3 \n", - "max 1957 NaN NaN 3002 \n", - "\n", - " start station name start station latitude \\\n", - "nan_count 0 0 \n", - "distinct_count 23 23 \n", - "dtype object float64 \n", - "min NaN 40.683125 \n", - "mean NaN 40.73296 \n", - "max NaN 40.770513 \n", - "\n", - " start station longitude end station id end station name \\\n", - "nan_count 0 0 0 \n", - "distinct_count 23 28 28 \n", - "dtype float64 int64 object \n", - "min -74.015756 127 NaN \n", - "mean -73.98873 400.14 NaN \n", - "max -73.967844 2022 NaN \n", - "\n", - " end station latitude end station longitude bikeid usertype \\\n", - "nan_count 0 0 0 0 \n", - "distinct_count 28 28 48 0 \n", - "dtype float64 float64 int64 object \n", - "min 40.682166 -74.012342 14650 NaN \n", - "mean 40.730918 -73.990003 17363.68 NaN \n", - "max 40.763707 -73.95399 21183 NaN \n", - "\n", - " birth year gender \n", - "nan_count 0 0 \n", - "distinct_count 17 0 \n", - "dtype object int64 \n", - "min NaN 0 \n", - "mean NaN 0.98 \n", - "max NaN 2 " - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "\n", - "def col_stats(ser):\n", - " l = len(ser)\n", - " values = ser.value_counts()\n", - " base_stats = dict(\n", - " nan_count = ser.isna().sum(),\n", - " distinct_count = values[values == 1].sum(),\n", - " dtype = ser.dtype)\n", - " if pd.api.types.is_numeric_dtype(ser):\n", - " base_stats.update(dict(\n", - " min = ser.min(),\n", - " mean = ser.mean(),\n", - " max = ser.max()))\n", - " return base_stats\n", - "def summary(df):\n", - " #we'll start with the first 50 rows as a smoke test\n", - " small_df = df.iloc[:50]\n", - " return pd.DataFrame(dict([[col, col_stats(small_df[col])] for col in small_df.columns]))\n", - "summary(df)" - ] - }, - { - "cell_type": "markdown", - "id": "243d392e-1820-446a-80ae-8552da26d6b1", - "metadata": {}, - "source": [ - "# ok let's add mode" - ] - }, - { - "cell_type": "code", - "execution_count": 22, - "id": "0c9c5725-212f-4186-b863-ac403ef7b4a9", - "metadata": { - "tags": [] - }, - "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", - "
tripdurationstarttimestoptimestart station idstart station namestart station latitudestart station longitudeend station idend station nameend station latitudeend station longitudebikeidusertypebirth yeargender
nan_count000000000000000
distinct_count4850462323232328282828480170
dtypeint64objectobjectint64objectfloat64float64int64objectfloat64float64int64objectobjectint64
min128NaNNaN83NaN40.683125-74.015756127NaN40.682166-74.01234214650NaNNaN0
mean720.24NaNNaN572.3NaN40.73296-73.98873400.14NaN40.730918-73.99000317363.68NaNNaN0.98
max1957NaNNaN3002NaN40.770513-73.9678442022NaN40.763707-73.9539921183NaNNaN2
mode513NaNNaN422NaN40.770513-73.988038380NaN40.734011-74.00550915693NaNNaN1
\n", - "
" - ], - "text/plain": [ - " tripduration starttime stoptime start station id \\\n", - "nan_count 0 0 0 0 \n", - "distinct_count 48 50 46 23 \n", - "dtype int64 object object int64 \n", - "min 128 NaN NaN 83 \n", - "mean 720.24 NaN NaN 572.3 \n", - "max 1957 NaN NaN 3002 \n", - "mode 513 NaN NaN 422 \n", - "\n", - " start station name start station latitude \\\n", - "nan_count 0 0 \n", - "distinct_count 23 23 \n", - "dtype object float64 \n", - "min NaN 40.683125 \n", - "mean NaN 40.73296 \n", - "max NaN 40.770513 \n", - "mode NaN 40.770513 \n", - "\n", - " start station longitude end station id end station name \\\n", - "nan_count 0 0 0 \n", - "distinct_count 23 28 28 \n", - "dtype float64 int64 object \n", - "min -74.015756 127 NaN \n", - "mean -73.98873 400.14 NaN \n", - "max -73.967844 2022 NaN \n", - "mode -73.988038 380 NaN \n", - "\n", - " end station latitude end station longitude bikeid usertype \\\n", - "nan_count 0 0 0 0 \n", - "distinct_count 28 28 48 0 \n", - "dtype float64 float64 int64 object \n", - "min 40.682166 -74.012342 14650 NaN \n", - "mean 40.730918 -73.990003 17363.68 NaN \n", - "max 40.763707 -73.95399 21183 NaN \n", - "mode 40.734011 -74.005509 15693 NaN \n", - "\n", - " birth year gender \n", - "nan_count 0 0 \n", - "distinct_count 17 0 \n", - "dtype object int64 \n", - "min NaN 0 \n", - "mean NaN 0.98 \n", - "max NaN 2 \n", - "mode NaN 1 " - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "def col_stats(ser):\n", - " l = len(ser)\n", - " values = ser.value_counts()\n", - " base_stats = dict(\n", - " nan_count = ser.isna().sum(),\n", - " distinct_count = values[values == 1].sum(),\n", - " dtype = ser.dtype)\n", - " if pd.api.types.is_numeric_dtype(ser):\n", - " base_stats.update(dict(\n", - " min = ser.min(),\n", - " mean = ser.mean(),\n", - " max = ser.max(),\n", - " mode = ser.mode()[0]\n", - " ))\n", - " return base_stats\n", - "\n", - "def summary(df):\n", - " #we'll start with the first 50 rows as a smoke test\n", - " small_df = df.iloc[:50]\n", - " return pd.DataFrame(dict([[col, col_stats(small_df[col])] for col in small_df.columns]))\n", - "summary(df)" - ] - }, - { - "cell_type": "markdown", - "id": "e6d4592c-a71e-464f-9c53-2143025c3cdf", - "metadata": {}, - "source": [ - "# Now lets add distinct_percentage\n", - "we just want to divide distinct_count by length\n", - "but we have no decent way to insert that calculation, we have to rewrite the entire function" - ] - }, - { - "cell_type": "code", - "execution_count": 23, - "id": "c7dc1ed8-1382-448c-bdec-e740052c6458", - "metadata": { - "tags": [] - }, - "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", - "
tripdurationstarttimestoptimestart station idstart station namestart station latitudestart station longitudeend station idend station nameend station latitudeend station longitudebikeidusertypebirth yeargender
nan_count000000000000000
distinct_count4850462323232328282828480170
distinct_percentage0.961.00.920.460.460.460.460.560.560.560.560.960.00.340.0
dtypeint64objectobjectint64objectfloat64float64int64objectfloat64float64int64objectobjectint64
min128NaNNaN83NaN40.683125-74.015756127NaN40.682166-74.01234214650NaNNaN0
mean720.24NaNNaN572.3NaN40.73296-73.98873400.14NaN40.730918-73.99000317363.68NaNNaN0.98
max1957NaNNaN3002NaN40.770513-73.9678442022NaN40.763707-73.9539921183NaNNaN2
mode513NaNNaN422NaN40.770513-73.988038380NaN40.734011-74.00550915693NaNNaN1
\n", - "
" - ], - "text/plain": [ - " tripduration starttime stoptime start station id \\\n", - "nan_count 0 0 0 0 \n", - "distinct_count 48 50 46 23 \n", - "distinct_percentage 0.96 1.0 0.92 0.46 \n", - "dtype int64 object object int64 \n", - "min 128 NaN NaN 83 \n", - "mean 720.24 NaN NaN 572.3 \n", - "max 1957 NaN NaN 3002 \n", - "mode 513 NaN NaN 422 \n", - "\n", - " start station name start station latitude \\\n", - "nan_count 0 0 \n", - "distinct_count 23 23 \n", - "distinct_percentage 0.46 0.46 \n", - "dtype object float64 \n", - "min NaN 40.683125 \n", - "mean NaN 40.73296 \n", - "max NaN 40.770513 \n", - "mode NaN 40.770513 \n", - "\n", - " start station longitude end station id end station name \\\n", - "nan_count 0 0 0 \n", - "distinct_count 23 28 28 \n", - "distinct_percentage 0.46 0.56 0.56 \n", - "dtype float64 int64 object \n", - "min -74.015756 127 NaN \n", - "mean -73.98873 400.14 NaN \n", - "max -73.967844 2022 NaN \n", - "mode -73.988038 380 NaN \n", - "\n", - " end station latitude end station longitude bikeid \\\n", - "nan_count 0 0 0 \n", - "distinct_count 28 28 48 \n", - "distinct_percentage 0.56 0.56 0.96 \n", - "dtype float64 float64 int64 \n", - "min 40.682166 -74.012342 14650 \n", - "mean 40.730918 -73.990003 17363.68 \n", - "max 40.763707 -73.95399 21183 \n", - "mode 40.734011 -74.005509 15693 \n", - "\n", - " usertype birth year gender \n", - "nan_count 0 0 0 \n", - "distinct_count 0 17 0 \n", - "distinct_percentage 0.0 0.34 0.0 \n", - "dtype object object int64 \n", - "min NaN NaN 0 \n", - "mean NaN NaN 0.98 \n", - "max NaN NaN 2 \n", - "mode NaN NaN 1 " - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "def col_stats(ser):\n", - " \n", - " l = len(ser)\n", - " values = ser.value_counts()\n", - " distinct_count = values[values == 1].sum()\n", - "\n", - " base_stats = dict(\n", - " nan_count = ser.isna().sum(),\n", - " distinct_count = distinct_count,\n", - " distinct_percentage = distinct_count / l,\n", - " dtype = ser.dtype)\n", - " if pd.api.types.is_numeric_dtype(ser):\n", - " base_stats.update(dict(\n", - " min = ser.min(),\n", - " mean = ser.mean(),\n", - " max = ser.max(),\n", - " mode = ser.mode()[0]\n", - " ))\n", - " return base_stats\n", - "\n", - "def summary(df, size=50):\n", - " #we'll start with the first 50 rows as a smoke test\n", - " if size > 0:\n", - " small_df = df.iloc[:size]\n", - " else:\n", - " #use the whole thing\n", - " small_df = df\n", - " return pd.DataFrame(dict([[col, col_stats(small_df[col])] for col in small_df.columns]))\n", - "\n", - "summary(df)" - ] - }, - { - "cell_type": "markdown", - "id": "f480a73f-072c-4480-8d60-6c7929ed6c0f", - "metadata": {}, - "source": [ - "# What about individual stats functions\n", - "summary is modified to recieve a list of functions to apply in order" - ] - }, - { - "cell_type": "code", - "execution_count": 24, - "id": "98b252c6-a5c2-4f5f-b7e2-2f046154327b", - "metadata": { - "tags": [] - }, - "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", - "
tripdurationstarttimestoptimestart station idstart station namestart station latitudestart station longitudeend station idend station nameend station latitudeend station longitudebikeidusertypebirth yeargender
nan_count000000000000000
distinct_count4850462323232328282828480170
dtypeint64objectobjectint64objectfloat64float64int64objectfloat64float64int64objectobjectint64
min128NaNNaN83NaN40.683125-74.015756127NaN40.682166-74.01234214650NaNNaN0
mean720.24NaNNaN572.3NaN40.73296-73.98873400.14NaN40.730918-73.99000317363.68NaNNaN0.98
max1957NaNNaN3002NaN40.770513-73.9678442022NaN40.763707-73.9539921183NaNNaN2
mode513NaNNaN422NaN40.770513-73.988038380NaN40.734011-74.00550915693NaNNaN1
distinct_percentage0.961.00.920.460.460.460.460.560.560.560.560.960.00.340.0
\n", - "
" - ], - "text/plain": [ - " tripduration starttime stoptime start station id \\\n", - "nan_count 0 0 0 0 \n", - "distinct_count 48 50 46 23 \n", - "dtype int64 object object int64 \n", - "min 128 NaN NaN 83 \n", - "mean 720.24 NaN NaN 572.3 \n", - "max 1957 NaN NaN 3002 \n", - "mode 513 NaN NaN 422 \n", - "distinct_percentage 0.96 1.0 0.92 0.46 \n", - "\n", - " start station name start station latitude \\\n", - "nan_count 0 0 \n", - "distinct_count 23 23 \n", - "dtype object float64 \n", - "min NaN 40.683125 \n", - "mean NaN 40.73296 \n", - "max NaN 40.770513 \n", - "mode NaN 40.770513 \n", - "distinct_percentage 0.46 0.46 \n", - "\n", - " start station longitude end station id end station name \\\n", - "nan_count 0 0 0 \n", - "distinct_count 23 28 28 \n", - "dtype float64 int64 object \n", - "min -74.015756 127 NaN \n", - "mean -73.98873 400.14 NaN \n", - "max -73.967844 2022 NaN \n", - "mode -73.988038 380 NaN \n", - "distinct_percentage 0.46 0.56 0.56 \n", - "\n", - " end station latitude end station longitude bikeid \\\n", - "nan_count 0 0 0 \n", - "distinct_count 28 28 48 \n", - "dtype float64 float64 int64 \n", - "min 40.682166 -74.012342 14650 \n", - "mean 40.730918 -73.990003 17363.68 \n", - "max 40.763707 -73.95399 21183 \n", - "mode 40.734011 -74.005509 15693 \n", - "distinct_percentage 0.56 0.56 0.96 \n", - "\n", - " usertype birth year gender \n", - "nan_count 0 0 0 \n", - "distinct_count 0 17 0 \n", - "dtype object object int64 \n", - "min NaN NaN 0 \n", - "mean NaN NaN 0.98 \n", - "max NaN NaN 2 \n", - "mode NaN NaN 1 \n", - "distinct_percentage 0.0 0.34 0.0 " - ] - }, - "execution_count": 24, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "\n", - "def base_col_stats(ser):\n", - " \n", - " l = len(ser)\n", - " values = ser.value_counts()\n", - " distinct_count = values[values == 1].sum()\n", - "\n", - " base_stats = dict(\n", - " nan_count = ser.isna().sum(),\n", - " distinct_count = distinct_count,\n", - " dtype = ser.dtype)\n", - " if pd.api.types.is_numeric_dtype(ser):\n", - " base_stats.update(dict(\n", - " min = ser.min(),\n", - " mean = ser.mean(),\n", - " max = ser.max(),\n", - " mode = ser.mode()[0]\n", - " ))\n", - " return base_stats\n", - "\n", - "def distinct_percentage(ser):\n", - " \n", - " l = len(ser)\n", - " values = ser.value_counts()\n", - " distinct_count = values[values == 1].sum()\n", - "\n", - " return dict(\n", - " distinct_percentage = distinct_count / l)\n", - " return base_stats\n", - "\n", - "def summary_funcs(df, funcs, size=50):\n", - " if size > 0:\n", - " small_df = df.iloc[:size]\n", - " else:\n", - " #use the whole thing\n", - " small_df = df\n", - " \n", - " facts_dict = {}\n", - " for col in small_df.columns:\n", - " facts = {}\n", - " for func in funcs:\n", - " facts.update(func(small_df[col]))\n", - " facts_dict[col] = facts\n", - " return pd.DataFrame(facts_dict)\n", - "\n", - "summary_funcs(df, [base_col_stats, distinct_percentage])" - ] - }, - { - "cell_type": "markdown", - "id": "064e381b-acd6-42fd-88e2-787286fae0ef", - "metadata": {}, - "source": [ - "# It works\n", - "But there's a problem. The call to value_counts is slow. watch the following timings with sampling turned off" - ] - }, - { - "cell_type": "code", - "execution_count": 25, - "id": "d1b96a21-b721-460e-871d-3ae881fe8fdc", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "237 ms ± 26.5 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" - ] - } - ], - "source": [ - "%timeit summary(df, -1)" - ] - }, - { - "cell_type": "code", - "execution_count": 26, - "id": "c4f95f09-f149-4934-92ae-5424ce3065f4", - "metadata": { - "tags": [] - }, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "374 ms ± 7.99 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\n" - ] - } - ], - "source": [ - "%timeit summary_funcs(df, [base_col_stats, distinct_percentage], -1)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "a23805fe-b8de-4ecf-bf68-27312a664943", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.11.5" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/scripts/clean_notebooks.sh b/scripts/clean_notebooks.sh new file mode 100755 index 00000000..dc6d2727 --- /dev/null +++ b/scripts/clean_notebooks.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +#note docs/example-notebooks/Exception-Traits-demo.ipynb specifically has +# stack traces to demonstrate stack trace behavior +nbstripout docs/example-notebooks/DFViewer.ipynb \ + docs/example-notebooks/Extending-pandas.ipynb \ + docs/example-notebooks/Extending.ipynb \ + docs/example-notebooks/Filter.ipynb \ + docs/example-notebooks/Full-tour.ipynb \ + docs/example-notebooks/GeoPandas.ipynb \ + docs/example-notebooks/Histograms-demo.ipynb \ + docs/example-notebooks/Itables-testcases.ipynb \ + docs/example-notebooks/Pluggable-Analysis-Framework.ipynb \ + docs/example-notebooks/Solara-Buckaroo.ipynb \ + docs/example-notebooks/introduction.ipynb \ + docs/example-notebooks/styling-gallery.ipynb \ + docs/example-notebooks/styling-howto.ipynb \ + docs/example-notebooks/testcases-fast.ipynb diff --git a/full_build.sh b/scripts/full_build.sh similarity index 100% rename from full_build.sh rename to scripts/full_build.sh diff --git a/test-environment-ipyw7.yaml b/test-environment-ipyw7.yaml deleted file mode 100644 index f2391ff5..00000000 --- a/test-environment-ipyw7.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: ipydatagrid-test-ipw7 -channels: - - conda-forge -dependencies: - - pip - - python - - nodejs=14 - - yarn - - ipywidgets >=7.6.0,<8 - - traitlets >=4.3.0 - - traittypes >=0.0.6 - - numpy >=1.10.4,<2.0.0 - - pandas >=1.0.0,<2.0.0 - - bqplot - - scipy - - jupyterlab - - jupyter-packaging - - pytest - - nbval - - pytest-cov - - selenium - - flake8 - - nose - - codespell diff --git a/test-environment-ipyw8.yaml b/test-environment-ipyw8.yaml deleted file mode 100644 index 3f002817..00000000 --- a/test-environment-ipyw8.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: ipydatagrid-test-ipw8 -channels: - - conda-forge -dependencies: - - pip - - python - - nodejs=14 - - yarn - - ipywidgets >=8.0.0,<9 - - traitlets >=4.3.0 - - traittypes >=0.0.6 - - numpy >=1.10.4,<2.0.0 - - pandas >=1.0.0,<2.0.0 - - bqplot - - scipy - - jupyterlab - - jupyter-packaging - - pytest - - nbval - - pytest-cov - - selenium - - flake8 - - nose - - codespell diff --git a/tox.ini b/tox.ini deleted file mode 100644 index 47e86231..00000000 --- a/tox.ini +++ /dev/null @@ -1,62 +0,0 @@ -[tox] -envlist = - fix - py310 - py39 - py38 - py37 - py36 - pypy3 - docs - pkg_desc -isolated_build = true -skip_missing_interpreters = true -minversion = 3.7 - -[testenv] -extras = - test -commands = - pytest {tty:--color=yes} tests - pytest --nbval examples -package = wheel -wheel_build_env = .pkg - -[testenv:fix] -description = format the code base to adhere to our styles, and complain about what we cannot do automatically -passenv = - PROGRAMDATA -skip_install = true -deps = - pre-commit>=2 -commands = - pre-commit run --all-files --show-diff-on-failure - -[testenv:pkg_desc] -description = check that the long description is valid -skip_install = true -deps = - build[virtualenv]>=0.7 - twine>=3.7 -commands = - python -m build --sdist --wheel . -o {envtmpdir} - twine check {envtmpdir}/* - -[testenv:dev] -description = dev environment with all deps at {envdir} -usedevelop = true -extras = - dev - test -commands = - python -m pip list --format=columns - python -c "print(r'{envpython}')" - -[flake8] -max-complexity = 22 -max-line-length = 80 -extend-ignore = E203, W503 -noqa-require-code = true - -[pep8] -max-line-length = 80 diff --git a/tryit.ipynb b/tryit.ipynb deleted file mode 100644 index fa79a753..00000000 --- a/tryit.ipynb +++ /dev/null @@ -1,155 +0,0 @@ -{ - "cells": [ - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "import pandas as pd\n", - "import json\n", - "from dcf.dcf_widget import DCFWidget" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "df = pd.read_csv('./examples/data/2014-01-citibike-tripdata.csv')\n", - "df2 = pd.read_csv('./examples/data/yellow_tripdata_2021-02.csv')" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "w = DCFWidget(df=df2)\n", - "w" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "transformed_df = w.dcf_transform(w.commands, w.df)\n", - "w.transformed_df = json.loads(transformed_df.to_json(orient='table', indent=2))" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "w.commands" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "w.generated_py_code" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "w.generated_py_code = w.dcf_to_py_core(w.commands[1:])\n", - "w.generated_py_code" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "from dcf.all_transforms import Transform\n", - "from dcf.lispy import s" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ - "@w.add_command\n", - "class GroupBy2(Transform):\n", - " command_default = [s(\"groupby2\"), s('df'), 'col', {}]\n", - " command_pattern = [[3, 'colMap', 'colEnum', ['null', 'sum', 'mean', 'median', 'count']]]\n", - " @staticmethod \n", - " def transform(df, col, col_spec):\n", - " grps = df.groupby(col)\n", - " df_contents = {}\n", - " for k, v in col_spec.items():\n", - " if v == \"sum\":\n", - " df_contents[k] = grps[k].apply(lambda x: x.sum())\n", - " elif v == \"mean\":\n", - " df_contents[k] = grps[k].apply(lambda x: x.mean())\n", - " elif v == \"median\":\n", - " df_contents[k] = grps[k].apply(lambda x: x.median())\n", - " elif v == \"count\":\n", - " df_contents[k] = grps[k].apply(lambda x: x.count())\n", - " return pd.DataFrame(df_contents)\n", - "\n", - " #test_df = group_df\n", - " #test_sequence = [s(\"groupby2\"), s('df'), 'c', dict(a='sum', b='mean')]\n", - " test_output = pd.DataFrame(\n", - " {'a':[100, 110], 'b':[2.5, 5.5]},\n", - " index=['q','w'])\n", - "\n", - " @staticmethod \n", - " def transform_to_py(df, col, col_spec):\n", - " commands = [\n", - " \" grps = df.groupby('%s')\" % col,\n", - " \" df_contents = {}\"\n", - " ]\n", - " for k, v in col_spec.items():\n", - " if v == \"sum\":\n", - " commands.append(\" paddydf_contents['%s'] = grps['%s'].apply(lambda x: x.sum())\" % (k, k))\n", - " elif v == \"mean\":\n", - " commands.append(\" df_contents['%s'] = grps['%s'].apply(lambda x: x.mean())\" % (k, k))\n", - " elif v == \"median\":\n", - " commands.append(\" df_contents['%s'] = grps['%s'].apply(lambda x: x.median())\" % (k, k))\n", - " elif v == \"count\":\n", - " commands.append(\" df_contents['%s'] = grps['%s'].apply(lambda x: x.count())\" % (k, k))\n", - " #print(\"commands\", commands)\n", - " commands.append(\" df = pd.DataFrame(df_contents)\")\n", - " return \"\\n\".join(commands)\n" - ] - } - ], - "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.11.2" - } - }, - "nbformat": 4, - "nbformat_minor": 4 -}