diff --git a/.gitignore b/.gitignore index 2e5c8a76..2acb731f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +# That pesky Mac file +.DS_Store + # Vim Swapfiles .*.swp .*.swo diff --git a/.travis.yml b/.travis.yml index 0ed81b41..0df2d973 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,23 +11,26 @@ jobs: include: - name: "Minimum install_requires versions" install: - - pip install numpy~=1.12.0 pandas~=0.24.0 SQLAlchemy~=1.1.18 psycopg2~=2.7.0 - - pip install pytest==4.4.2 hypothesis==4.50.2 attrs==19.3.0 + - pip install -r requirements-test.txt + - pip install . numpy~=1.12.0 pandas~=0.24.0 SQLAlchemy~=1.1.18 psycopg2~=2.7.0 - name: "Late 2019 dependencies" install: - - pip install numpy==1.17.4 pandas==0.24.2 SQLAlchemy==1.2.19 psycopg2==2.8.4 - - pip install pytest==4.4.2 hypothesis==4.50.2 attrs==19.3.0 + - pip install -r requirements-test.txt + - pip install . numpy==1.17.4 pandas==0.24.2 SQLAlchemy==1.2.19 psycopg2==2.8.4 - name: "Newest studied dependency versions" install: - - pip install numpy==1.17.4 pandas~=0.25.3 SQLAlchemy~=1.3.11 psycopg2~=2.8.4 - - pip install pytest==4.4.2 hypothesis==4.50.2 attrs==19.3.0 + - pip install -r requirements-test.txt + - pip install . numpy==1.17.4 pandas~=0.25.3 SQLAlchemy~=1.3.11 psycopg2~=2.8.4 - name: "Pure setup.py install" install: + - pip install -r requirements-test.txt - pip install ./ - pip install psycopg2~=2.8.4 - - pip install pytest==4.4.2 hypothesis==4.50.2 attrs==19.3.0 # command to run tests +install: + - pip install -r requirements.txt + - pip install . services: - postgresql env: diff --git a/Makefile b/Makefile index 6d5cb080..2be8e608 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,7 @@ -NOTEBOOK_TESTS=$(addprefix examples/, examples-dplyr-funcs.ipynb case-iris-select.ipynb examples-postgres.ipynb examples-varspec.ipynb) +NOTEBOOK_TESTS=$(addprefix examples/, \ + examples-dplyr-funcs.ipynb case-iris-select.ipynb examples-postgres.ipynb examples-varspec.ipynb \ + examples-siu.ipynb \ + ) AUTODOC_SCRIPT=docs/generate_autodoc.py @@ -11,7 +14,7 @@ test: pytest --dbs="sqlite,postgresql" siuba/ test-travis: - #py.test --nbval $(filter-out %postgres.ipynb, $(NOTEBOOK_TESTS)) + py.test --nbval-lax $(filter-out %postgres.ipynb, $(NOTEBOOK_TESTS)) pytest --dbs="sqlite,postgresql" siuba/ examples/%.ipynb: diff --git a/examples/case-iris-select.ipynb b/examples/case-iris-select.ipynb index 085a6dae..5d9c4c1e 100644 --- a/examples/case-iris-select.ipynb +++ b/examples/case-iris-select.ipynb @@ -11,6 +11,8 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "> 📢: **This document was used during early development of siuba. See the [select docs](https://siuba.readthedocs.io/en/latest/api_table_core/03_select.html).**\n", + "\n", "Many different ways of selecting columns from the iris dataset. " ] }, @@ -23,8 +25,6 @@ "from siuba import *\n", "import pandas as pd\n", "\n", - "from sklearn import datasets\n", - "\n", "pd.set_option('max_rows', 5)" ] }, @@ -34,9 +34,21 @@ "metadata": {}, "outputs": [], "source": [ - "iris = datasets.load_iris()\n", - "df_iris = pd.DataFrame(iris.data, columns = iris.feature_names)\n", - "df_iris['species'] = iris.target_names[iris.target]" + "## Rather than import the iris data from sklearn, I am just including the\n", + "## first 5 rows.\n", + "\n", + "# from sklearn import datasets\n", + "# iris = datasets.load_iris()\n", + "# df_iris = pd.DataFrame(iris.data, columns = iris.feature_names)\n", + "# df_iris['species'] = iris.target_names[iris.target]\n", + "\n", + "df_iris = pd.DataFrame({\n", + " 'sepal length (cm)': [5.1, 4.9, 4.7, 4.6, 5.0],\n", + " 'sepal width (cm)': [3.5, 3.0, 3.2, 3.1, 3.6],\n", + " 'petal length (cm)': [1.4, 1.4, 1.3, 1.5, 1.4],\n", + " 'petal width (cm)': [0.2, 0.2, 0.2, 0.2, 0.2],\n", + " 'species': ['setosa', 'setosa', 'setosa', 'setosa', 'setosa']\n", + "})" ] }, { @@ -90,50 +102,47 @@ " 4.9\n", " \n", " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", + " 2\n", + " 3.2\n", + " 1.3\n", + " 0.2\n", + " setosa\n", + " 4.7\n", " \n", " \n", - " 148\n", - " 3.4\n", - " 5.4\n", - " 2.3\n", - " virginica\n", - " 6.2\n", + " 3\n", + " 3.1\n", + " 1.5\n", + " 0.2\n", + " setosa\n", + " 4.6\n", " \n", " \n", - " 149\n", - " 3.0\n", - " 5.1\n", - " 1.8\n", - " virginica\n", - " 5.9\n", + " 4\n", + " 3.6\n", + " 1.4\n", + " 0.2\n", + " setosa\n", + " 5.0\n", " \n", " \n", "\n", - "

150 rows × 5 columns

\n", "" ], "text/plain": [ - " sepal width (cm) petal length (cm) petal width (cm) species \\\n", - "0 3.5 1.4 0.2 setosa \n", - "1 3.0 1.4 0.2 setosa \n", - ".. ... ... ... ... \n", - "148 3.4 5.4 2.3 virginica \n", - "149 3.0 5.1 1.8 virginica \n", - "\n", - " sepal length (cm) \n", - "0 5.1 \n", - "1 4.9 \n", - ".. ... \n", - "148 6.2 \n", - "149 5.9 \n", + " sepal width (cm) petal length (cm) petal width (cm) species \\\n", + "0 3.5 1.4 0.2 setosa \n", + "1 3.0 1.4 0.2 setosa \n", + "2 3.2 1.3 0.2 setosa \n", + "3 3.1 1.5 0.2 setosa \n", + "4 3.6 1.4 0.2 setosa \n", "\n", - "[150 rows x 5 columns]" + " sepal length (cm) \n", + "0 5.1 \n", + "1 4.9 \n", + "2 4.7 \n", + "3 4.6 \n", + "4 5.0 " ] }, "execution_count": 3, @@ -482,37 +491,34 @@ " setosa\n", " \n", " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", + " 2\n", + " 4.7\n", + " 3.2\n", + " setosa\n", " \n", " \n", - " 148\n", - " 6.2\n", - " 3.4\n", - " virginica\n", + " 3\n", + " 4.6\n", + " 3.1\n", + " setosa\n", " \n", " \n", - " 149\n", - " 5.9\n", - " 3.0\n", - " virginica\n", + " 4\n", + " 5.0\n", + " 3.6\n", + " setosa\n", " \n", " \n", "\n", - "

150 rows × 3 columns

\n", "" ], "text/plain": [ - " sepal length (cm) sepal width (cm) species\n", - "0 5.1 3.5 setosa\n", - "1 4.9 3.0 setosa\n", - ".. ... ... ...\n", - "148 6.2 3.4 virginica\n", - "149 5.9 3.0 virginica\n", - "\n", - "[150 rows x 3 columns]" + " sepal length (cm) sepal width (cm) species\n", + "0 5.1 3.5 setosa\n", + "1 4.9 3.0 setosa\n", + "2 4.7 3.2 setosa\n", + "3 4.6 3.1 setosa\n", + "4 5.0 3.6 setosa" ] }, "execution_count": 6, @@ -576,50 +582,40 @@ " setosa\n", " \n", " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", + " 2\n", + " 4.7\n", + " 3.2\n", + " 1.3\n", + " 0.2\n", + " setosa\n", " \n", " \n", - " 148\n", - " 6.2\n", - " 3.4\n", - " 5.4\n", - " 2.3\n", - " virginica\n", + " 3\n", + " 4.6\n", + " 3.1\n", + " 1.5\n", + " 0.2\n", + " setosa\n", " \n", " \n", - " 149\n", - " 5.9\n", - " 3.0\n", - " 5.1\n", - " 1.8\n", - " virginica\n", + " 4\n", + " 5.0\n", + " 3.6\n", + " 1.4\n", + " 0.2\n", + " setosa\n", " \n", " \n", "\n", - "

150 rows × 5 columns

\n", "" ], "text/plain": [ - " sepal length (cm) sepal width (cm) petal_length petal width (cm) \\\n", - "0 5.1 3.5 1.4 0.2 \n", - "1 4.9 3.0 1.4 0.2 \n", - ".. ... ... ... ... \n", - "148 6.2 3.4 5.4 2.3 \n", - "149 5.9 3.0 5.1 1.8 \n", - "\n", - " species \n", - "0 setosa \n", - "1 setosa \n", - ".. ... \n", - "148 virginica \n", - "149 virginica \n", - "\n", - "[150 rows x 5 columns]" + " sepal length (cm) sepal width (cm) petal_length petal width (cm) species\n", + "0 5.1 3.5 1.4 0.2 setosa\n", + "1 4.9 3.0 1.4 0.2 setosa\n", + "2 4.7 3.2 1.3 0.2 setosa\n", + "3 4.6 3.1 1.5 0.2 setosa\n", + "4 5.0 3.6 1.4 0.2 setosa" ] }, "execution_count": 7, @@ -663,7 +659,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.6.8" }, "toc": { "base_numbering": 1, @@ -680,5 +676,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/examples-dplyr-funcs.ipynb b/examples/examples-dplyr-funcs.ipynb index 098d7bda..014c313d 100644 --- a/examples/examples-dplyr-funcs.ipynb +++ b/examples/examples-dplyr-funcs.ipynb @@ -82,6 +82,15 @@ " \n", " \n", " 0\n", + " pandas\n", + " pandas-dev\n", + " python\n", + " 17800\n", + " 1.0\n", + " 0\n", + " \n", + " \n", + " 1\n", " dplyr\n", " tidyverse\n", " R\n", @@ -90,7 +99,7 @@ " 0\n", " \n", " \n", - " 1\n", + " 2\n", " ggplot2\n", " tidyverse\n", " R\n", @@ -99,7 +108,7 @@ " 700\n", " \n", " \n", - " 2\n", + " 3\n", " plotnine\n", " has2k1\n", " python\n", @@ -107,25 +116,16 @@ " NaN\n", " 0\n", " \n", - " \n", - " 3\n", - " pandas\n", - " pandas-dev\n", - " python\n", - " 17800\n", - " 1.0\n", - " 0\n", - " \n", " \n", "\n", "" ], "text/plain": [ " repo owner language stars x rel_stars1\n", - "0 dplyr tidyverse R 2800 2.0 0\n", - "1 ggplot2 tidyverse R 3500 3.0 700\n", - "2 plotnine has2k1 python 1450 NaN 0\n", - "3 pandas pandas-dev python 17800 1.0 0" + "0 pandas pandas-dev python 17800 1.0 0\n", + "1 dplyr tidyverse R 2800 2.0 0\n", + "2 ggplot2 tidyverse R 3500 3.0 700\n", + "3 plotnine has2k1 python 1450 NaN 0" ] }, "execution_count": 4, @@ -182,6 +182,16 @@ " \n", " \n", " 0\n", + " pandas\n", + " pandas-dev\n", + " python\n", + " 17800\n", + " 1.0\n", + " 0\n", + " 35600\n", + " \n", + " \n", + " 1\n", " dplyr\n", " tidyverse\n", " R\n", @@ -191,7 +201,7 @@ " 5600\n", " \n", " \n", - " 1\n", + " 2\n", " ggplot2\n", " tidyverse\n", " R\n", @@ -201,7 +211,7 @@ " 7000\n", " \n", " \n", - " 2\n", + " 3\n", " plotnine\n", " has2k1\n", " python\n", @@ -210,26 +220,16 @@ " 0\n", " 2900\n", " \n", - " \n", - " 3\n", - " pandas\n", - " pandas-dev\n", - " python\n", - " 17800\n", - " 1.0\n", - " 0\n", - " 35600\n", - " \n", " \n", "\n", "" ], "text/plain": [ " repo owner language stars x rel_stars1 rel_stars2\n", - "0 dplyr tidyverse R 2800 2.0 0 5600\n", - "1 ggplot2 tidyverse R 3500 3.0 700 7000\n", - "2 plotnine has2k1 python 1450 NaN 0 2900\n", - "3 pandas pandas-dev python 17800 1.0 0 35600" + "0 pandas pandas-dev python 17800 1.0 0 35600\n", + "1 dplyr tidyverse R 2800 2.0 0 5600\n", + "2 ggplot2 tidyverse R 3500 3.0 700 7000\n", + "3 plotnine has2k1 python 1450 NaN 0 2900" ] }, "execution_count": 5, @@ -278,6 +278,15 @@ " \n", " \n", " 0\n", + " pandas\n", + " pandas-dev\n", + " python\n", + " 17800\n", + " 1.0\n", + " 0\n", + " \n", + " \n", + " 1\n", " dplyr\n", " tidyverse\n", " R\n", @@ -286,7 +295,7 @@ " 0\n", " \n", " \n", - " 1\n", + " 2\n", " ggplot2\n", " tidyverse\n", " R\n", @@ -295,7 +304,7 @@ " 700\n", " \n", " \n", - " 2\n", + " 3\n", " plotnine\n", " has2k1\n", " python\n", @@ -303,25 +312,16 @@ " NaN\n", " 0\n", " \n", - " \n", - " 3\n", - " pandas\n", - " pandas-dev\n", - " python\n", - " 17800\n", - " 1.0\n", - " 0\n", - " \n", " \n", "\n", "" ], "text/plain": [ " repo owner language stars x rel_stars1\n", - "0 dplyr tidyverse R 2800 2.0 0\n", - "1 ggplot2 tidyverse R 3500 3.0 700\n", - "2 plotnine has2k1 python 1450 NaN 0\n", - "3 pandas pandas-dev python 17800 1.0 0" + "0 pandas pandas-dev python 17800 1.0 0\n", + "1 dplyr tidyverse R 2800 2.0 0\n", + "2 ggplot2 tidyverse R 3500 3.0 700\n", + "3 plotnine has2k1 python 1450 NaN 0" ] }, "execution_count": 6, @@ -379,28 +379,28 @@ " \n", " \n", " 0\n", - " ggplot2\n", - " tidyverse\n", - " R\n", - " 3500\n", - " 3.0\n", - " \n", - " \n", - " 1\n", " pandas\n", " pandas-dev\n", " python\n", " 17800\n", " 1.0\n", " \n", + " \n", + " 1\n", + " ggplot2\n", + " tidyverse\n", + " R\n", + " 3500\n", + " 3.0\n", + " \n", " \n", "\n", "" ], "text/plain": [ " repo owner language stars x\n", - "0 ggplot2 tidyverse R 3500 3.0\n", - "1 pandas pandas-dev python 17800 1.0" + "0 pandas pandas-dev python 17800 1.0\n", + "1 ggplot2 tidyverse R 3500 3.0" ] }, "execution_count": 7, @@ -537,23 +537,23 @@ " \n", " \n", " 0\n", + " python\n", + " pandas\n", + " 16350\n", + " \n", + " \n", + " 1\n", " R\n", " dplyr\n", " 0\n", " \n", " \n", - " 1\n", + " 2\n", " R\n", " ggplot2\n", " 700\n", " \n", " \n", - " 2\n", - " python\n", - " pandas\n", - " 16350\n", - " \n", - " \n", " 3\n", " python\n", " plotnine\n", @@ -565,9 +565,9 @@ ], "text/plain": [ " language repo rel_stars1\n", - "0 R dplyr 0\n", - "1 R ggplot2 700\n", - "2 python pandas 16350\n", + "0 python pandas 16350\n", + "1 R dplyr 0\n", + "2 R ggplot2 700\n", "3 python plotnine 0" ] }, @@ -723,7 +723,7 @@ " \n", " \n", " \n", - " 0\n", + " 3\n", " plotnine\n", " has2k1\n", " python\n", @@ -747,7 +747,7 @@ " 3.0\n", " \n", " \n", - " 3\n", + " 0\n", " pandas\n", " pandas-dev\n", " python\n", @@ -760,10 +760,10 @@ ], "text/plain": [ " repo owner language stars x\n", - "0 plotnine has2k1 python 1450 NaN\n", + "3 plotnine has2k1 python 1450 NaN\n", "1 dplyr tidyverse R 2800 2.0\n", "2 ggplot2 tidyverse R 3500 3.0\n", - "3 pandas pandas-dev python 17800 1.0" + "0 pandas pandas-dev python 17800 1.0" ] }, "execution_count": 11, @@ -812,7 +812,7 @@ { "data": { "text/plain": [ - "array(['pandas', 'dplyr', 'wat', 'wat'], dtype='0\n", " R\n", " repo owner stars x\n", - "0 dplyr ...\n", + "1 dplyr ...\n", " \n", " \n", " 1\n", @@ -909,7 +909,7 @@ "text/plain": [ " language data\n", "0 R repo owner stars x\n", - "0 dplyr ...\n", + "1 dplyr ...\n", "1 python repo owner stars x\n", "0 panda..." ] @@ -1908,7 +1908,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.6.8" }, "toc": { "base_numbering": 1, diff --git a/examples/examples-postgres.ipynb b/examples/examples-postgres.ipynb index 7ea34ac7..6bf77a0b 100644 --- a/examples/examples-postgres.ipynb +++ b/examples/examples-postgres.ipynb @@ -17,7 +17,7 @@ { "data": { "text/plain": [ - "" + "" ] }, "execution_count": 1, @@ -80,7 +80,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -138,7 +138,7 @@ "0 1 2 jack@msn.com 2" ] }, - "execution_count": 2, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -146,6 +146,7 @@ "source": [ "from siuba import *\n", "from siuba.sql.verbs import LazyTbl, collect, show_query\n", + "from siuba.sql.dply.vector import dense_rank\n", "import siuba.meta_hook.sqlalchemy.sql.functions as F\n", "\n", "from sqlalchemy import sql\n", @@ -156,7 +157,7 @@ "#tbl_addresses >> mutate(_, num = dense_rank(_.id)) >> show_query(_)\n", "q = (tbl_addresses\n", " >> group_by(\"user_id\")\n", - " >> mutate(num = _.id.dense_rank())\n", + " >> mutate(num = dense_rank(_.id))\n", " >> filter(\n", " _.id > _.id.min(),\n", " _.email_address.str.startswith(\"jack\")\n", @@ -1919,7 +1920,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.6.8" }, "toc": { "base_numbering": 1, @@ -1941,5 +1942,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/examples-siu.ipynb b/examples/examples-siu.ipynb index 64dad2b3..4eaeb55f 100644 --- a/examples/examples-siu.ipynb +++ b/examples/examples-siu.ipynb @@ -1,5 +1,12 @@ { "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "> 📢: **This document was used during early development of siuba. See the [siuba intro doc](https://siuba.readthedocs.io/en/latest/api_table_core/03_select.html).**\n" + ] + }, { "cell_type": "code", "execution_count": 1, @@ -11,14 +18,14 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "_.somecol.min(, )\n" + "_.somecol.min()\n" ] }, { @@ -27,7 +34,7 @@ "5" ] }, - "execution_count": 8, + "execution_count": 2, "metadata": {}, "output_type": "execute_result" } @@ -84,7 +91,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -93,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -102,7 +109,7 @@ "['aa', 'bb', 'cc']" ] }, - "execution_count": 3, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -114,7 +121,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -123,7 +130,7 @@ "['A', 'B', 'C']" ] }, - "execution_count": 4, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -135,7 +142,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -144,7 +151,7 @@ "1" ] }, - "execution_count": 5, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -165,7 +172,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -174,7 +181,7 @@ "[0, 1]" ] }, - "execution_count": 6, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -195,7 +202,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -204,7 +211,7 @@ "[1, 3]" ] }, - "execution_count": 7, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } @@ -217,7 +224,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -226,7 +233,7 @@ "[0, 0]" ] }, - "execution_count": 8, + "execution_count": 9, "metadata": {}, "output_type": "execute_result" } @@ -290,7 +297,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -316,7 +323,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -333,7 +340,7 @@ "└─2" ] }, - "execution_count": 10, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } @@ -351,7 +358,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -360,7 +367,7 @@ "{'a', 'b', 'c'}" ] }, - "execution_count": 11, + "execution_count": 12, "metadata": {}, "output_type": "execute_result" } @@ -401,14 +408,14 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "(1, _(a, ) + _(b, ), )\n" + "(1,_('a') + _('b'))\n" ] }, { @@ -417,7 +424,7 @@ "4" ] }, - "execution_count": 12, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } @@ -435,7 +442,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": {}, "outputs": [ { @@ -446,7 +453,7 @@ "└─{'a': [1, 2, 3]}" ] }, - "execution_count": 13, + "execution_count": 14, "metadata": {}, "output_type": "execute_result" } @@ -457,7 +464,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -472,7 +479,7 @@ " └─'b'" ] }, - "execution_count": 14, + "execution_count": 15, "metadata": {}, "output_type": "execute_result" } @@ -483,7 +490,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -499,7 +506,7 @@ " └─'b'" ] }, - "execution_count": 15, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -525,7 +532,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": {}, "outputs": [], "source": [ @@ -535,38 +542,40 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "201 µs ± 10.4 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n" + "212 µs ± 50.2 µs per loop (mean ± std. dev. of 7 runs, 1000 loops each)\n" ] } ], "source": [ "%%timeit\n", + "# NBVAL_IGNORE_OUTPUT\n", "\n", "x = lmap(_['a'], l)" ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "8.18 µs ± 529 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n" + "7.29 µs ± 199 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n" ] } ], "source": [ "%%timeit\n", + "# NBVAL_IGNORE_OUTPUT\n", "\n", "x = lmap(lambda x: x['a'], l)" ] @@ -587,7 +596,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -596,7 +605,7 @@ "['a', _, _, _]" ] }, - "execution_count": 19, + "execution_count": 20, "metadata": {}, "output_type": "execute_result" } @@ -616,7 +625,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -625,7 +634,7 @@ "['a', ['a'], ['a'], ['a']]" ] }, - "execution_count": 20, + "execution_count": 21, "metadata": {}, "output_type": "execute_result" } @@ -662,9 +671,6 @@ } ], "metadata": { - "jupytext": { - "formats": "Rmd" - }, "kernelspec": { "display_name": "Python 3", "language": "python", @@ -680,7 +686,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.6.8" }, "toc": { "base_numbering": 1, @@ -702,5 +708,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/examples/examples-varspec.ipynb b/examples/examples-varspec.ipynb index 3b65efd5..afdc4e4f 100644 --- a/examples/examples-varspec.ipynb +++ b/examples/examples-varspec.ipynb @@ -123,7 +123,7 @@ { "data": { "text/plain": [ - "Var('_.startswith(a, )', negated = False, alias = None)" + "Var('_.startswith('a')', negated = False, alias = None)" ] }, "execution_count": 5, @@ -153,7 +153,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.6.7" + "version": "3.6.8" }, "toc": { "base_numbering": 1, @@ -170,5 +170,5 @@ } }, "nbformat": 4, - "nbformat_minor": 2 + "nbformat_minor": 4 } diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 00000000..6f5d0100 --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,37 @@ +appnope==0.1.0 +attrs==19.3.0 +backcall==0.1.0 +coverage==5.0.3 +decorator==4.4.2 +hypothesis==5.6.0 +importlib-metadata==1.5.0 +ipykernel==5.1.4 +ipython==7.13.0 +ipython-genutils==0.2.0 +jedi==0.16.0 +jsonschema==3.2.0 +jupyter-client==6.0.0 +jupyter-core==4.6.3 +more-itertools==8.2.0 +nbformat==5.0.4 +nbval==0.9.5 +packaging==20.3 +parso==0.6.2 +pexpect==4.8.0 +pickleshare==0.7.5 +pluggy==0.13.1 +prompt-toolkit==3.0.3 +ptyprocess==0.6.0 +py==1.8.1 +Pygments==2.5.2 +pyparsing==2.4.6 +pyrsistent==0.15.7 +pytest==5.3.5 +python-dateutil==2.8.1 +pyzmq==19.0.0 +six==1.14.0 +sortedcontainers==2.1.0 +tornado==6.0.4 +traitlets==4.3.3 +wcwidth==0.1.8 +zipp==3.1.0 diff --git a/setup.py b/setup.py index d0e22977..cdf8ee39 100644 --- a/setup.py +++ b/setup.py @@ -7,15 +7,18 @@ _version_re = re.compile(r'__version__\s+=\s+(.*)') with open('siuba/__init__.py', 'rb') as f: - version = str(ast.literal_eval(_version_re.search( + VERSION = str(ast.literal_eval(_version_re.search( f.read().decode('utf-8')).group(1))) +with open('README.md') as f: + README = f.read() + # setup ----------------------------------------------------------------------- setup( name='siuba', packages=find_packages(), - version=version, + version=VERSION, description='A package for quick, scrappy analyses with pandas and SQL', author='Michael Chow', license='MIT', @@ -29,6 +32,8 @@ ], python_requires=">=3.6", include_package_data=True, + long_description=README, + long_description_content_type="text/markdown", classifiers=[ 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.6',