From 3caf3a12469d017428d5e2bb94143185e8770038 Mon Sep 17 00:00:00 2001 From: Jim Crist-Harif Date: Wed, 29 Mar 2023 16:39:54 -0500 Subject: [PATCH] feat(api): replace `suffixes` in `join` with `lname`/`rname` BREAKING CHANGE: the `suffixes` argument in all join methods has been removed in favor of `lname`/`rname` args. The default renaming scheme for duplicate columns has also changed. To get the exact same behavior as before, pass in `lname="{name}_x", rname="{name}_y"`. --- docs/how_to/chain-expressions.md | 2 +- docs/how_to/memtable-join.md | 31 +- docs/ibis-for-pandas-users.ipynb | 2102 +---------------- ibis/backends/clickhouse/tests/test_select.py | 8 +- ibis/backends/tests/test_join.py | 8 +- ibis/expr/operations/relations.py | 8 +- ibis/expr/types/relations.py | 111 +- ibis/tests/expr/test_struct.py | 8 +- ibis/tests/expr/test_table.py | 57 +- .../test_limit_with_self_join/decompiled.py | 52 +- .../test_limit_with_self_join/out.sql | 35 +- .../test_multiple_joins/decompiled.py | 4 +- .../test_multiple_joins/out.sql | 4 +- .../test_subquery_used_for_self_join/out.sql | 6 +- .../test_no_cross_join/out.sql | 4 +- 15 files changed, 305 insertions(+), 2135 deletions(-) diff --git a/docs/how_to/chain-expressions.md b/docs/how_to/chain-expressions.md index 29614f99dd1a..652d8cad985d 100644 --- a/docs/how_to/chain-expressions.md +++ b/docs/how_to/chain-expressions.md @@ -59,7 +59,7 @@ join = ( # _ is the filtered result, and re-create xmod in t2 using modf: .join(t2, _.xmod == modf(t2)) # _ is the second join result: - .join(t1, _.xmod == modf(t1), suffixes=('', '_x')) + .join(t1, _.xmod == modf(t1)) # _ is the third join result: .select(_.x, _.y, _.z) # Finally, _ is the selection result: diff --git a/docs/how_to/memtable-join.md b/docs/how_to/memtable-join.md index 57725311823f..f67e7e52cfd1 100644 --- a/docs/how_to/memtable-join.md +++ b/docs/how_to/memtable-join.md @@ -87,24 +87,23 @@ and joining is the same as joining any two TableExpressions: ```python In [11]: # Join as you would two table expressions ...: measures.join( - ...: mem_events - ...: ,measures['event_id'] == mem_events['event_id'] - ...: ,suffixes=('', '__x') + ...: mem_events, + ...: measures['event_id'] == mem_events['event_id'] ...: ).execute() Out[11]: - event_id measured_on measurement event_id__x event_name - 0 0 2021-06-01 NaN 0 e0 - 1 0 2021-06-02 5.0 0 e0 - 2 1 2021-06-03 NaN 1 e1 - 3 1 2021-06-04 NaN 1 e1 - 4 1 2021-05-05 42.0 1 e1 - 5 2 2021-05-06 42.0 2 e2 - 6 2 2021-05-07 NaN 2 e2 - 7 2 2021-05-08 11.0 2 e2 - 8 2 2021-05-09 NaN 2 e2 - 9 2 2021-05-10 NaN 2 e2 - 10 3 2021-07-11 NaN 3 e3 - 11 3 2021-07-12 NaN 3 e3 + event_id measured_on measurement event_name + 0 0 2021-06-01 NaN e0 + 1 0 2021-06-02 5.0 e0 + 2 1 2021-06-03 NaN e1 + 3 1 2021-06-04 NaN e1 + 4 1 2021-05-05 42.0 e1 + 5 2 2021-05-06 42.0 e2 + 6 2 2021-05-07 NaN e2 + 7 2 2021-05-08 11.0 e2 + 8 2 2021-05-09 NaN e2 + 9 2 2021-05-10 NaN e2 + 10 3 2021-07-11 NaN e3 + 11 3 2021-07-12 NaN e3 ``` Note that the return result of the `join` is a TableExpression and that `execute` returns a pandas DataFrame. diff --git a/docs/ibis-for-pandas-users.ipynb b/docs/ibis-for-pandas-users.ipynb index 6752aa55157f..14d3c750e8f4 100644 --- a/docs/ibis-for-pandas-users.ipynb +++ b/docs/ibis-for-pandas-users.ipynb @@ -30,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "id": "bd23750c-bc6b-46db-a6d3-017f73a1d436", "metadata": {}, "outputs": [], @@ -51,64 +51,10 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "id": "ba8432fc-8423-459a-8b56-c4720db65407", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
onetwothree
5a12
6b34
\n", - "
" - ], - "text/plain": [ - " one two three\n", - "5 a 1 2\n", - "6 b 3 4" - ] - }, - "execution_count": 2, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "df = pd.DataFrame(\n", " [\n", @@ -122,7 +68,6 @@ ] }, { - "attachments": {}, "cell_type": "markdown", "id": "2a226ff0-f1b4-49d8-b6bd-8a8bf5cae109", "metadata": {}, @@ -136,39 +81,10 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": null, "id": "62e08de9-ad4b-453a-b862-429d11b0432a", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n",
-       "┃ one     two    three ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64int64 │\n",
-       "├────────┼───────┼───────┤\n",
-       "│ a      │     12 │\n",
-       "│ b      │     34 │\n",
-       "└────────┴───────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtwo\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mthree\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼───────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │ \u001b[1;36m2\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │ \u001b[1;36m4\u001b[0m │\n", - "└────────┴───────┴───────┘" - ] - }, - "execution_count": 3, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t = ibis.pandas.connect({'t': df}).table('t')\n", "t" @@ -187,24 +103,10 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "id": "94ddeaf0-efb9-4be8-9a60-af26dd657ff6", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "one object\n", - "two int64\n", - "three int64\n", - "dtype: object" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "df.dtypes" ] @@ -219,25 +121,10 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "id": "11770743-e66f-4001-988d-d5c7a5b40cd6", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "ibis.Schema {\n", - " one string\n", - " two int64\n", - " three int64\n", - "}" - ] - }, - "execution_count": 5, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t.schema()" ] @@ -252,21 +139,10 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": null, "id": "68da325b-d549-4564-845a-20e3d99b5df7", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "[('one', dtype('O')), ('two', dtype('int64')), ('three', dtype('int64'))]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t.schema().to_pandas()" ] @@ -285,21 +161,10 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": null, "id": "1d58bd48-1b20-4d06-917d-e10aa5ca5a62", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "3" - ] - }, - "execution_count": 7, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "len(t.schema())" ] @@ -314,31 +179,10 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": null, "id": "b1c45c64-9c2f-4d74-8c6b-847e6e94bf59", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n"
-      ],
-      "text/plain": []
-     },
-     "metadata": {},
-     "output_type": "display_data"
-    },
-    {
-     "data": {
-      "text/plain": [
-       "\u001b[1;36m2\u001b[0m"
-      ]
-     },
-     "execution_count": 8,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "t.count()"
    ]
@@ -354,42 +198,20 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 9,
+   "execution_count": null,
    "id": "21af7477-0f2a-4c3b-8d00-fcbe4a82bf71",
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "(2, 3)"
-      ]
-     },
-     "execution_count": 9,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "(t.count().execute(), len(t.schema()))"
    ]
   },
   {
    "cell_type": "code",
-   "execution_count": 10,
+   "execution_count": null,
    "id": "6970d109-a4ad-4f5a-9263-6361f71f2b2f",
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/plain": [
-       "(2, 3)"
-      ]
-     },
-     "execution_count": 10,
-     "metadata": {},
-     "output_type": "execute_result"
-    }
-   ],
+   "outputs": [],
    "source": [
     "df.shape"
    ]
@@ -406,39 +228,10 @@
   },
   {
    "cell_type": "code",
-   "execution_count": 11,
+   "execution_count": null,
    "id": "77d9bde4-8465-4ec4-b1a6-b69b32ea0398",
    "metadata": {},
-   "outputs": [
-    {
-     "data": {
-      "text/html": [
-       "
┏━━━━━━━━┳━━━━━━━┓\n",
-       "┃ one     two   ┃\n",
-       "┡━━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64 │\n",
-       "├────────┼───────┤\n",
-       "│ a      │     1 │\n",
-       "│ b      │     3 │\n",
-       "└────────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtwo\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │\n", - "└────────┴───────┘" - ] - }, - "execution_count": 11, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t[['one', 'two']]" ] @@ -453,39 +246,10 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "id": "9e9770c3-9aae-4aec-b426-84a435e74159", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┓\n",
-       "┃ one     two   ┃\n",
-       "┡━━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64 │\n",
-       "├────────┼───────┤\n",
-       "│ a      │     1 │\n",
-       "│ b      │     3 │\n",
-       "└────────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtwo\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │\n", - "└────────┴───────┘" - ] - }, - "execution_count": 12, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t['one', 'two']" ] @@ -503,39 +267,10 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "id": "7ce3128c-a722-4948-be5d-a2f38873acf5", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┓\n",
-       "┃ one    ┃\n",
-       "┡━━━━━━━━┩\n",
-       "│ string │\n",
-       "├────────┤\n",
-       "│ a      │\n",
-       "│ b      │\n",
-       "└────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │\n", - "├────────┤\n", - "│ a │\n", - "│ b │\n", - "└────────┘" - ] - }, - "execution_count": 13, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t['one']" ] @@ -550,39 +285,10 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "id": "7af612e6-dfee-40a5-a3df-788566fdd4eb", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┓\n",
-       "┃ one    ┃\n",
-       "┡━━━━━━━━┩\n",
-       "│ string │\n",
-       "├────────┤\n",
-       "│ a      │\n",
-       "│ b      │\n",
-       "└────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │\n", - "├────────┤\n", - "│ a │\n", - "│ b │\n", - "└────────┘" - ] - }, - "execution_count": 14, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t.one" ] @@ -612,39 +318,10 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "id": "6f1f91bb-ea6c-4d0f-9344-1dae83d8e40e", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ one     two    three  new_col ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━┩\n",
-       "│ stringint64int64int64   │\n",
-       "├────────┼───────┼───────┼─────────┤\n",
-       "│ a      │     124 │\n",
-       "│ b      │     348 │\n",
-       "└────────┴───────┴───────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtwo\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mthree\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mnew_col\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼───────┼─────────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │ \u001b[1;36m2\u001b[0m │ \u001b[1;36m4\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │ \u001b[1;36m4\u001b[0m │ \u001b[1;36m8\u001b[0m │\n", - "└────────┴───────┴───────┴─────────┘" - ] - }, - "execution_count": 15, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "mutated = t.mutate(new_col=t.three * 2)\n", "mutated" @@ -661,45 +338,15 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "84a0722d-2f84-4997-a4b6-ee44bb3dbcac", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n",
-       "┃ one     two    three ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64int64 │\n",
-       "├────────┼───────┼───────┤\n",
-       "│ a      │     12 │\n",
-       "│ b      │     34 │\n",
-       "└────────┴───────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtwo\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mthree\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼───────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │ \u001b[1;36m2\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │ \u001b[1;36m4\u001b[0m │\n", - "└────────┴───────┴───────┘" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t" ] }, { - "attachments": {}, "cell_type": "markdown", "id": "6cc7fb9f-6720-454c-87e3-e0aad3baa3a5", "metadata": {}, @@ -710,46 +357,16 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "cbb0190d-b9af-4d94-a395-254ef31854fe", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━━━━━━━┓\n",
-       "┃ Multiply(three, 2) ┃\n",
-       "┡━━━━━━━━━━━━━━━━━━━━┩\n",
-       "│ int64              │\n",
-       "├────────────────────┤\n",
-       "│                  4 │\n",
-       "│                  8 │\n",
-       "└────────────────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mMultiply(three, 2)\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━━━━━━━┩\n", - "│ \u001b[2mint64\u001b[0m │\n", - "├────────────────────┤\n", - "│ \u001b[1;36m4\u001b[0m │\n", - "│ \u001b[1;36m8\u001b[0m │\n", - "└────────────────────┘" - ] - }, - "execution_count": 17, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "unnamed = (t.three * 2)\n", "unnamed" ] }, { - "attachments": {}, "cell_type": "markdown", "id": "1a55f051", "metadata": {}, @@ -759,39 +376,10 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": null, "id": "2e5a51d8", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━┓\n",
-       "┃ new_col ┃\n",
-       "┡━━━━━━━━━┩\n",
-       "│ int64   │\n",
-       "├─────────┤\n",
-       "│       4 │\n",
-       "│       8 │\n",
-       "└─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mnew_col\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━┩\n", - "│ \u001b[2mint64\u001b[0m │\n", - "├─────────┤\n", - "│ \u001b[1;36m4\u001b[0m │\n", - "│ \u001b[1;36m8\u001b[0m │\n", - "└─────────┘" - ] - }, - "execution_count": 18, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "new_col = unnamed.name(\"new_col\")\n", "new_col" @@ -807,39 +395,10 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "id": "28dbf1e2-f6db-48d1-a61c-e174a8be79bf", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ one     two    new_col ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━━━┩\n",
-       "│ stringint64int64   │\n",
-       "├────────┼───────┼─────────┤\n",
-       "│ a      │     14 │\n",
-       "│ b      │     38 │\n",
-       "└────────┴───────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtwo\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mnew_col\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼─────────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │ \u001b[1;36m4\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │ \u001b[1;36m8\u001b[0m │\n", - "└────────┴───────┴─────────┘" - ] - }, - "execution_count": 19, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "proj = t['one', 'two', new_col]\n", "proj" @@ -857,42 +416,20 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": null, "id": "7abe3596-8eb7-480e-86f9-7303953c02ae", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['one', 'two', 'three']" - ] - }, - "execution_count": 20, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t.columns" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": null, "id": "e9ea485e-f433-4487-8c32-dac86fa19db2", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['three']" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "subset = t.drop('one', 'two')\n", "subset.columns" @@ -908,21 +445,10 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": null, "id": "b7d2b972-aa19-4647-8fb5-511062cfc8fd", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "['two', 'three']" - ] - }, - "execution_count": 22, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "subset = t['two', 'three']\n", "subset.columns" @@ -941,78 +467,20 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": null, "id": "5ba58de0-78a6-4c59-ab72-6a55355ef2cb", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n",
-       "┃ one     two    three ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64int64 │\n",
-       "├────────┼───────┼───────┤\n",
-       "│ a      │     12 │\n",
-       "│ b      │     34 │\n",
-       "└────────┴───────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtwo\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mthree\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼───────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │ \u001b[1;36m2\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │ \u001b[1;36m4\u001b[0m │\n", - "└────────┴───────┴───────┘" - ] - }, - "execution_count": 23, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t" ] }, { "cell_type": "code", - "execution_count": 24, + "execution_count": null, "id": "90bdae99-f2d1-4d81-bbe6-bc3de62923a0", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n",
-       "┃ one     two    three ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64int64 │\n",
-       "├────────┼───────┼───────┤\n",
-       "│ a      │     22 │\n",
-       "│ b      │     64 │\n",
-       "└────────┴───────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mone\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtwo\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mthree\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼───────┤\n", - "│ a │ \u001b[1;36m2\u001b[0m │ \u001b[1;36m2\u001b[0m │\n", - "│ b │ \u001b[1;36m6\u001b[0m │ \u001b[1;36m4\u001b[0m │\n", - "└────────┴───────┴───────┘" - ] - }, - "execution_count": 24, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "mutated = t.mutate(two=t.two * 2)\n", "mutated" @@ -1031,39 +499,10 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": null, "id": "8d5b4242-fb10-4574-88c6-d341826b8f6c", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n",
-       "┃ a       b      three ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64int64 │\n",
-       "├────────┼───────┼───────┤\n",
-       "│ a      │     12 │\n",
-       "│ b      │     34 │\n",
-       "└────────┴───────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1ma\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mb\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mthree\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼───────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │ \u001b[1;36m2\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │ \u001b[1;36m4\u001b[0m │\n", - "└────────┴───────┴───────┘" - ] - }, - "execution_count": 25, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "relabeled = t.relabel(dict(\n", " one='a',\n", @@ -1085,97 +524,10 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": null, "id": "8ce004ee-7723-4e97-a4c5-dff42693d6a0", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
05.13.51.40.2setosa
14.93.01.40.2setosa
24.73.21.30.2setosa
34.63.11.50.2setosa
45.03.61.40.2setosa
\n", - "
" - ], - "text/plain": [ - " sepal_length sepal_width petal_length petal_width 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": 26, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "df = pd.read_csv('https://raw.githubusercontent.com/mwaskom/seaborn-data/master/iris.csv')\n", "df.head()" @@ -1191,57 +543,10 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": null, "id": "3dd069d5-c2c6-4241-a648-76dcdf20cc37", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          5.13.51.40.2 │ setosa  │\n",
-       "│          4.93.01.40.2 │ setosa  │\n",
-       "│          4.73.21.30.2 │ setosa  │\n",
-       "│          4.63.11.50.2 │ setosa  │\n",
-       "│          5.03.61.40.2 │ setosa  │\n",
-       "│          5.43.91.70.4 │ setosa  │\n",
-       "│          4.63.41.40.3 │ setosa  │\n",
-       "│          5.03.41.50.2 │ setosa  │\n",
-       "│          4.42.91.40.2 │ setosa  │\n",
-       "│          4.93.11.50.1 │ setosa  │\n",
-       "│                   │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m5.1\u001b[0m │ \u001b[1;36m3.5\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.9\u001b[0m │ \u001b[1;36m3.0\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.7\u001b[0m │ \u001b[1;36m3.2\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.6\u001b[0m │ \u001b[1;36m3.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.6\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.4\u001b[0m │ \u001b[1;36m3.9\u001b[0m │ \u001b[1;36m1.7\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.6\u001b[0m │ \u001b[1;36m3.4\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.3\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.4\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m2.9\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.9\u001b[0m │ \u001b[1;36m3.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.1\u001b[0m │ setosa │\n", - "│ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 27, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t = ibis.pandas.connect({'t': df}).table('t')\n", "t" @@ -1261,45 +566,10 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": null, "id": "c668f96b-db88-4407-92da-06867024988b", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          5.13.51.40.2 │ setosa  │\n",
-       "│          4.93.01.40.2 │ setosa  │\n",
-       "│          4.73.21.30.2 │ setosa  │\n",
-       "│          4.63.11.50.2 │ setosa  │\n",
-       "│          5.03.61.40.2 │ setosa  │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m5.1\u001b[0m │ \u001b[1;36m3.5\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.9\u001b[0m │ \u001b[1;36m3.0\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.7\u001b[0m │ \u001b[1;36m3.2\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.6\u001b[0m │ \u001b[1;36m3.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.6\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 28, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t.head(5)" ] @@ -1326,45 +596,10 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": null, "id": "92455eef-6f15-48b9-b49b-2d3f8b38c6a7", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          5.13.51.40.2 │ setosa  │\n",
-       "│          4.93.01.40.2 │ setosa  │\n",
-       "│          4.73.21.30.2 │ setosa  │\n",
-       "│          4.63.11.50.2 │ setosa  │\n",
-       "│          5.03.61.40.2 │ setosa  │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m5.1\u001b[0m │ \u001b[1;36m3.5\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.9\u001b[0m │ \u001b[1;36m3.0\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.7\u001b[0m │ \u001b[1;36m3.2\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.6\u001b[0m │ \u001b[1;36m3.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.6\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 29, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t.limit(5)" ] @@ -1379,45 +614,10 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": null, "id": "8b1baecc-a88f-4415-9d64-9bc94cabdc20", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          5.03.61.40.2 │ setosa  │\n",
-       "│          5.43.91.70.4 │ setosa  │\n",
-       "│          4.63.41.40.3 │ setosa  │\n",
-       "│          5.03.41.50.2 │ setosa  │\n",
-       "│          4.42.91.40.2 │ setosa  │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.6\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.4\u001b[0m │ \u001b[1;36m3.9\u001b[0m │ \u001b[1;36m1.7\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.6\u001b[0m │ \u001b[1;36m3.4\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.3\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.4\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m2.9\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 30, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t.limit(5, offset=4)" ] @@ -1437,57 +637,10 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": null, "id": "ccf4e5da-06cd-4331-8ccf-897acc4405e2", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n",
-       "┃ Greater(sepal_width, 3.8) ┃\n",
-       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━┩\n",
-       "│ boolean                   │\n",
-       "├───────────────────────────┤\n",
-       "│ False                     │\n",
-       "│ False                     │\n",
-       "│ False                     │\n",
-       "│ False                     │\n",
-       "│ False                     │\n",
-       "│ True                      │\n",
-       "│ False                     │\n",
-       "│ False                     │\n",
-       "│ False                     │\n",
-       "│ False                     │\n",
-       "│                          │\n",
-       "└───────────────────────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mGreater(sepal_width, 3.8)\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━┩\n", - "│ \u001b[2mboolean\u001b[0m │\n", - "├───────────────────────────┤\n", - "│ False │\n", - "│ False │\n", - "│ False │\n", - "│ False │\n", - "│ False │\n", - "│ True │\n", - "│ False │\n", - "│ False │\n", - "│ False │\n", - "│ False │\n", - "│ \u001b[2m…\u001b[0m │\n", - "└───────────────────────────┘" - ] - }, - "execution_count": 31, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "expr = t.sepal_width > 3.8\n", "expr" @@ -1503,39 +656,10 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": null, "id": "180b2d01-84a0-4042-9d2e-07cbdbe5c8b5", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓\n",
-       "┃ Greater(sepal_width, 3.8)  count ┃\n",
-       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩\n",
-       "│ booleanint64 │\n",
-       "├───────────────────────────┼───────┤\n",
-       "│ False                     │   144 │\n",
-       "│ True                      │     6 │\n",
-       "└───────────────────────────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mGreater(sepal_width, 3.8)\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mcount\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mboolean\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├───────────────────────────┼───────┤\n", - "│ False │ \u001b[1;36m144\u001b[0m │\n", - "│ True │ \u001b[1;36m6\u001b[0m │\n", - "└───────────────────────────┴───────┘" - ] - }, - "execution_count": 32, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "expr.value_counts()" ] @@ -1551,47 +675,10 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": null, "id": "63ff3e0d-2775-432a-8ecb-947d2c8cc0a5", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          5.43.91.70.4 │ setosa  │\n",
-       "│          5.84.01.20.2 │ setosa  │\n",
-       "│          5.74.41.50.4 │ setosa  │\n",
-       "│          5.43.91.30.4 │ setosa  │\n",
-       "│          5.24.11.50.1 │ setosa  │\n",
-       "│          5.54.21.40.2 │ setosa  │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m5.4\u001b[0m │ \u001b[1;36m3.9\u001b[0m │ \u001b[1;36m1.7\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.8\u001b[0m │ \u001b[1;36m4.0\u001b[0m │ \u001b[1;36m1.2\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.7\u001b[0m │ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.4\u001b[0m │ \u001b[1;36m3.9\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.2\u001b[0m │ \u001b[1;36m4.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.1\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.5\u001b[0m │ \u001b[1;36m4.2\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 33, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "filtered = t[expr]\n", "filtered" @@ -1607,47 +694,10 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": null, "id": "240ca8c8-b8ba-4826-831e-e2390cb6fbbb", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          5.43.91.70.4 │ setosa  │\n",
-       "│          5.84.01.20.2 │ setosa  │\n",
-       "│          5.74.41.50.4 │ setosa  │\n",
-       "│          5.43.91.30.4 │ setosa  │\n",
-       "│          5.24.11.50.1 │ setosa  │\n",
-       "│          5.54.21.40.2 │ setosa  │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m5.4\u001b[0m │ \u001b[1;36m3.9\u001b[0m │ \u001b[1;36m1.7\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.8\u001b[0m │ \u001b[1;36m4.0\u001b[0m │ \u001b[1;36m1.2\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.7\u001b[0m │ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.4\u001b[0m │ \u001b[1;36m3.9\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.2\u001b[0m │ \u001b[1;36m4.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.1\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.5\u001b[0m │ \u001b[1;36m4.2\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 34, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "filtered = t[t.sepal_width > 3.8]\n", "filtered" @@ -1664,39 +714,10 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "id": "f971ed4e-c0de-4ebc-8be6-60eff433399f", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          5.84.01.20.2 │ setosa  │\n",
-       "│          5.74.41.50.4 │ setosa  │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m5.8\u001b[0m │ \u001b[1;36m4.0\u001b[0m │ \u001b[1;36m1.2\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.7\u001b[0m │ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 35, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "filtered = t[(t.sepal_width > 3.8) & (t.sepal_length > 5.5)]\n", "filtered" @@ -1712,39 +733,10 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "id": "827c5756-a770-4106-9fb5-8eb98050aed9", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          5.84.01.20.2 │ setosa  │\n",
-       "│          5.74.41.50.4 │ setosa  │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m5.8\u001b[0m │ \u001b[1;36m4.0\u001b[0m │ \u001b[1;36m1.2\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.7\u001b[0m │ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 36, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "filtered = t[t.sepal_width > 3.8][t.sepal_length > 5.5]\n", "filtered" @@ -1762,64 +754,16 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "id": "b33a1e2b-e297-46c5-a163-91ae8e62f7de", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          5.13.51.40.2 │ setosa  │\n",
-       "│          4.73.21.30.2 │ setosa  │\n",
-       "│          4.63.11.50.2 │ setosa  │\n",
-       "│          5.03.61.40.2 │ setosa  │\n",
-       "│          5.43.91.70.4 │ setosa  │\n",
-       "│          4.63.41.40.3 │ setosa  │\n",
-       "│          5.03.41.50.2 │ setosa  │\n",
-       "│          4.93.11.50.1 │ setosa  │\n",
-       "│          5.43.71.50.2 │ setosa  │\n",
-       "│          4.83.41.60.2 │ setosa  │\n",
-       "│                   │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m5.1\u001b[0m │ \u001b[1;36m3.5\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.7\u001b[0m │ \u001b[1;36m3.2\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.6\u001b[0m │ \u001b[1;36m3.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.6\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.4\u001b[0m │ \u001b[1;36m3.9\u001b[0m │ \u001b[1;36m1.7\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.6\u001b[0m │ \u001b[1;36m3.4\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.3\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.4\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.9\u001b[0m │ \u001b[1;36m3.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.1\u001b[0m │ setosa │\n", - "│ \u001b[1;36m5.4\u001b[0m │ \u001b[1;36m3.7\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.8\u001b[0m │ \u001b[1;36m3.4\u001b[0m │ \u001b[1;36m1.6\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 37, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "filtered = t[t.sepal_width > t.sepal_width.mean()]\n", "filtered" ] }, { - "attachments": {}, "cell_type": "markdown", "id": "441cc820", "metadata": {}, @@ -1835,57 +779,10 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "id": "85f7e6b5", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species  species_modified ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n",
-       "│ float64float64float64float64stringstring           │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┼──────────────────┤\n",
-       "│          5.13.51.40.2 │ setosa  │ wide             │\n",
-       "│          4.93.01.40.2 │ setosa  │ setosa           │\n",
-       "│          4.73.21.30.2 │ setosa  │ setosa           │\n",
-       "│          4.63.11.50.2 │ setosa  │ setosa           │\n",
-       "│          5.03.61.40.2 │ setosa  │ wide             │\n",
-       "│          5.43.91.70.4 │ setosa  │ wide             │\n",
-       "│          4.63.41.40.3 │ setosa  │ wide             │\n",
-       "│          5.03.41.50.2 │ setosa  │ wide             │\n",
-       "│          4.42.91.40.2 │ setosa  │ setosa           │\n",
-       "│          4.93.11.50.1 │ setosa  │ setosa           │\n",
-       "│                            │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┴──────────────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies_modified\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┼──────────────────┤\n", - "│ \u001b[1;36m5.1\u001b[0m │ \u001b[1;36m3.5\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │ wide │\n", - "│ \u001b[1;36m4.9\u001b[0m │ \u001b[1;36m3.0\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │ setosa │\n", - "│ \u001b[1;36m4.7\u001b[0m │ \u001b[1;36m3.2\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │ setosa │\n", - "│ \u001b[1;36m4.6\u001b[0m │ \u001b[1;36m3.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │ setosa │\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.6\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │ wide │\n", - "│ \u001b[1;36m5.4\u001b[0m │ \u001b[1;36m3.9\u001b[0m │ \u001b[1;36m1.7\u001b[0m │ \u001b[1;36m0.4\u001b[0m │ setosa │ wide │\n", - "│ \u001b[1;36m4.6\u001b[0m │ \u001b[1;36m3.4\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.3\u001b[0m │ setosa │ wide │\n", - "│ \u001b[1;36m5.0\u001b[0m │ \u001b[1;36m3.4\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │ wide │\n", - "│ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m2.9\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │ setosa │\n", - "│ \u001b[1;36m4.9\u001b[0m │ \u001b[1;36m3.1\u001b[0m │ \u001b[1;36m1.5\u001b[0m │ \u001b[1;36m0.1\u001b[0m │ setosa │ setosa │\n", - "│ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │ \u001b[2m…\u001b[0m │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┴──────────────────┘" - ] - }, - "execution_count": 38, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "wide_sepals = t.sepal_width > 3.3\n", "species_modified = wide_sepals.ifelse('wide', t.species)\n", @@ -1912,97 +809,10 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "id": "3fca2921-2f93-403e-aabd-ba941f374a02", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
sepal_lengthsepal_widthpetal_lengthpetal_widthspecies
134.33.01.10.1setosa
424.43.21.30.2setosa
384.43.01.30.2setosa
84.42.91.40.2setosa
414.52.31.30.3setosa
\n", - "
" - ], - "text/plain": [ - " sepal_length sepal_width petal_length petal_width species\n", - "13 4.3 3.0 1.1 0.1 setosa\n", - "42 4.4 3.2 1.3 0.2 setosa\n", - "38 4.4 3.0 1.3 0.2 setosa\n", - "8 4.4 2.9 1.4 0.2 setosa\n", - "41 4.5 2.3 1.3 0.3 setosa" - ] - }, - "execution_count": 39, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "df.sort_values(['sepal_length', 'sepal_width'], ascending=[True, False]).head(5)" ] @@ -2020,45 +830,10 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "id": "b984cc38-d235-431f-98bf-5cd3eaa401fd", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n",
-       "┃ sepal_length  sepal_width  petal_length  petal_width  species ┃\n",
-       "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n",
-       "│ float64float64float64float64string  │\n",
-       "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n",
-       "│          4.33.01.10.1 │ setosa  │\n",
-       "│          4.43.21.30.2 │ setosa  │\n",
-       "│          4.43.01.30.2 │ setosa  │\n",
-       "│          4.42.91.40.2 │ setosa  │\n",
-       "│          4.52.31.30.3 │ setosa  │\n",
-       "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┳━━━━━━━━━━━━━┳━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1msepal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1msepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_length\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mpetal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━━━━━━╇━━━━━━━━━━━━━╇━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mstring\u001b[0m │\n", - "├──────────────┼─────────────┼──────────────┼─────────────┼─────────┤\n", - "│ \u001b[1;36m4.3\u001b[0m │ \u001b[1;36m3.0\u001b[0m │ \u001b[1;36m1.1\u001b[0m │ \u001b[1;36m0.1\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m3.2\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m3.0\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.4\u001b[0m │ \u001b[1;36m2.9\u001b[0m │ \u001b[1;36m1.4\u001b[0m │ \u001b[1;36m0.2\u001b[0m │ setosa │\n", - "│ \u001b[1;36m4.5\u001b[0m │ \u001b[1;36m2.3\u001b[0m │ \u001b[1;36m1.3\u001b[0m │ \u001b[1;36m0.3\u001b[0m │ setosa │\n", - "└──────────────┴─────────────┴──────────────┴─────────────┴─────────┘" - ] - }, - "execution_count": 40, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "sorted = t.order_by(['sepal_length', ibis.desc('sepal_width')]).head(5)\n", "sorted" @@ -2076,55 +851,10 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "id": "fbd2705f-1fbb-4ba4-9273-ed6e9e89ec9c", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
total_sepal_widthavg.sepal_length
0458.65.843333
\n", - "
" - ], - "text/plain": [ - " total_sepal_width avg.sepal_length\n", - "0 458.6 5.843333" - ] - }, - "execution_count": 41, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "stats = [df.sepal_width.sum(), df.sepal_length.mean()]\n", "pd.DataFrame([stats], columns=['total_sepal_width', 'avg.sepal_length'])" @@ -2140,37 +870,10 @@ }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "id": "04090b90-3e2b-4cfe-ac57-52a652e45609", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n",
-       "┃ total_sepal_width  avg_sepal_length ┃\n",
-       "┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n",
-       "│ float64float64          │\n",
-       "├───────────────────┼──────────────────┤\n",
-       "│             458.65.843333 │\n",
-       "└───────────────────┴──────────────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mtotal_sepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mavg_sepal_length\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │\n", - "├───────────────────┼──────────────────┤\n", - "│ \u001b[1;36m458.6\u001b[0m │ \u001b[1;36m5.843333\u001b[0m │\n", - "└───────────────────┴──────────────────┘" - ] - }, - "execution_count": 42, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "stats = [t.sepal_width.sum().name('total_sepal_width'), t.sepal_length.mean().name('avg_sepal_length')]\n", "agged = t.aggregate(stats)\n", @@ -2187,37 +890,10 @@ }, { "cell_type": "code", - "execution_count": 43, + "execution_count": null, "id": "ac9dd0ba-fbe9-4a5f-b4d6-ab2b127e5a89", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n",
-       "┃ total_sepal_width  avg_sepal_length ┃\n",
-       "┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n",
-       "│ float64float64          │\n",
-       "├───────────────────┼──────────────────┤\n",
-       "│             458.65.843333 │\n",
-       "└───────────────────┴──────────────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mtotal_sepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mavg_sepal_length\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n", - "│ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │\n", - "├───────────────────┼──────────────────┤\n", - "│ \u001b[1;36m458.6\u001b[0m │ \u001b[1;36m5.843333\u001b[0m │\n", - "└───────────────────┴──────────────────┘" - ] - }, - "execution_count": 43, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "agged = t.aggregate(\n", " total_sepal_width=t.sepal_width.sum(),\n", @@ -2238,41 +914,10 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": null, "id": "3e773759-77ca-4eb5-a858-81d489399059", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n",
-       "┃ species     total_sepal_width  avg_sepal_length ┃\n",
-       "┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n",
-       "│ stringfloat64float64          │\n",
-       "├────────────┼───────────────────┼──────────────────┤\n",
-       "│ setosa     │             171.45.006 │\n",
-       "│ versicolor │             138.55.936 │\n",
-       "│ virginica  │             148.76.588 │\n",
-       "└────────────┴───────────────────┴──────────────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtotal_sepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mavg_sepal_length\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │\n", - "├────────────┼───────────────────┼──────────────────┤\n", - "│ setosa │ \u001b[1;36m171.4\u001b[0m │ \u001b[1;36m5.006\u001b[0m │\n", - "│ versicolor │ \u001b[1;36m138.5\u001b[0m │ \u001b[1;36m5.936\u001b[0m │\n", - "│ virginica │ \u001b[1;36m148.7\u001b[0m │ \u001b[1;36m6.588\u001b[0m │\n", - "└────────────┴───────────────────┴──────────────────┘" - ] - }, - "execution_count": 44, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "agged = t.aggregate(\n", " by='species',\n", @@ -2292,41 +937,10 @@ }, { "cell_type": "code", - "execution_count": 45, + "execution_count": null, "id": "ca4ed3a8-d788-40f1-ae8e-52f691eaeb40", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n",
-       "┃ species     total_sepal_width  avg_sepal_length ┃\n",
-       "┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n",
-       "│ stringfloat64float64          │\n",
-       "├────────────┼───────────────────┼──────────────────┤\n",
-       "│ setosa     │             171.45.006 │\n",
-       "│ versicolor │             138.55.936 │\n",
-       "│ virginica  │             148.76.588 │\n",
-       "└────────────┴───────────────────┴──────────────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mtotal_sepal_width\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mavg_sepal_length\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mfloat64\u001b[0m │ \u001b[2mfloat64\u001b[0m │\n", - "├────────────┼───────────────────┼──────────────────┤\n", - "│ setosa │ \u001b[1;36m171.4\u001b[0m │ \u001b[1;36m5.006\u001b[0m │\n", - "│ versicolor │ \u001b[1;36m138.5\u001b[0m │ \u001b[1;36m5.936\u001b[0m │\n", - "│ virginica │ \u001b[1;36m148.7\u001b[0m │ \u001b[1;36m6.588\u001b[0m │\n", - "└────────────┴───────────────────┴──────────────────┘" - ] - }, - "execution_count": 45, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "agged = t.group_by('species').aggregate(\n", " total_sepal_width=t.sepal_width.sum(),\n", @@ -2351,7 +965,7 @@ }, { "cell_type": "code", - "execution_count": 46, + "execution_count": null, "id": "170fd8e7-4c2d-4981-8969-e064b2d8b176", "metadata": {}, "outputs": [], @@ -2373,7 +987,7 @@ }, { "cell_type": "code", - "execution_count": 47, + "execution_count": null, "id": "a5eb4117-c843-401d-8ca6-3b29c00f62da", "metadata": {}, "outputs": [], @@ -2403,32 +1017,10 @@ }, { "cell_type": "code", - "execution_count": 48, + "execution_count": null, "id": "dc002f3f-efaf-43e5-9f1f-e3a0bf683baf", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "0 3.5\n", - "1 3.0\n", - "2 3.2\n", - "3 3.1\n", - "4 3.6\n", - " ... \n", - "145 3.0\n", - "146 2.5\n", - "147 3.0\n", - "148 3.4\n", - "149 3.0\n", - "Name: sepal_width, Length: 150, dtype: object" - ] - }, - "execution_count": 48, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "df.sepal_width.astype(str)" ] @@ -2443,57 +1035,10 @@ }, { "cell_type": "code", - "execution_count": 49, + "execution_count": null, "id": "4537f3eb-7b94-4605-b409-8926e16608de", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n",
-       "┃ Cast(sepal_width, int64) ┃\n",
-       "┡━━━━━━━━━━━━━━━━━━━━━━━━━━┩\n",
-       "│ int64                    │\n",
-       "├──────────────────────────┤\n",
-       "│                        3 │\n",
-       "│                        3 │\n",
-       "│                        3 │\n",
-       "│                        3 │\n",
-       "│                        3 │\n",
-       "│                        3 │\n",
-       "│                        3 │\n",
-       "│                        3 │\n",
-       "│                        2 │\n",
-       "│                        3 │\n",
-       "│                         │\n",
-       "└──────────────────────────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mCast(sepal_width, int64)\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━━━━━━━━━━━━━┩\n", - "│ \u001b[2mint64\u001b[0m │\n", - "├──────────────────────────┤\n", - "│ \u001b[1;36m3\u001b[0m │\n", - "│ \u001b[1;36m3\u001b[0m │\n", - "│ \u001b[1;36m3\u001b[0m │\n", - "│ \u001b[1;36m3\u001b[0m │\n", - "│ \u001b[1;36m3\u001b[0m │\n", - "│ \u001b[1;36m3\u001b[0m │\n", - "│ \u001b[1;36m3\u001b[0m │\n", - "│ \u001b[1;36m3\u001b[0m │\n", - "│ \u001b[1;36m2\u001b[0m │\n", - "│ \u001b[1;36m3\u001b[0m │\n", - "│ \u001b[2m…\u001b[0m │\n", - "└──────────────────────────┘" - ] - }, - "execution_count": 49, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t.sepal_width.cast('int')" ] @@ -2508,27 +1053,10 @@ }, { "cell_type": "code", - "execution_count": 50, + "execution_count": null, "id": "68dcb03c-6b97-4278-bb8a-13dda3da70dc", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "ibis.Schema {\n", - " sepal_length int64\n", - " sepal_width int64\n", - " petal_length float64\n", - " petal_width float64\n", - " species string\n", - "}" - ] - }, - "execution_count": 50, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "casted = t.mutate(\n", " sepal_width=t.sepal_width.cast('int'),\n", @@ -2550,7 +1078,7 @@ }, { "cell_type": "code", - "execution_count": 51, + "execution_count": null, "id": "1a280ac1-0639-4757-9941-fad657ee04a9", "metadata": {}, "outputs": [], @@ -2572,80 +1100,20 @@ }, { "cell_type": "code", - "execution_count": 52, + "execution_count": null, "id": "58f0795e-43d9-4497-b484-4f74f60b3d3a", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━┳━━━━━━━┓\n",
-       "┃ species     count ┃\n",
-       "┡━━━━━━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64 │\n",
-       "├────────────┼───────┤\n",
-       "│ setosa     │    50 │\n",
-       "│ versicolor │    50 │\n",
-       "│ virginica  │    50 │\n",
-       "└────────────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mspecies\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mcount\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────────┼───────┤\n", - "│ setosa │ \u001b[1;36m50\u001b[0m │\n", - "│ versicolor │ \u001b[1;36m50\u001b[0m │\n", - "│ virginica │ \u001b[1;36m50\u001b[0m │\n", - "└────────────┴───────┘" - ] - }, - "execution_count": 52, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t.species.value_counts()" ] }, { "cell_type": "code", - "execution_count": 53, + "execution_count": null, "id": "a942ae68-8cc6-42b6-9676-2e2c5bbc6633", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓\n",
-       "┃ Contains(species)  count ┃\n",
-       "┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩\n",
-       "│ booleanint64 │\n",
-       "├───────────────────┼───────┤\n",
-       "│ False             │    50 │\n",
-       "│ True              │   100 │\n",
-       "└───────────────────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━━━━━━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mContains(species)\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mcount\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━━━━━━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mboolean\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├───────────────────┼───────┤\n", - "│ False │ \u001b[1;36m50\u001b[0m │\n", - "│ True │ \u001b[1;36m100\u001b[0m │\n", - "└───────────────────┴───────┘" - ] - }, - "execution_count": 53, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "refined = t.species.isin(['versicolor', 'virginica'])\n", "refined.value_counts()" @@ -2659,12 +1127,7 @@ "## Merging tables\n", "\n", "While pandas uses the `merge` method to combine data from multiple `DataFrames`, Ibis uses the\n", - "`join` method. They both have similar capabilities. The signature for the `join` method in Ibis\n", - "is: `join(right, predicates=(), how='inner', *, suffixes=('_x', '_y'))`. The `merge` method on\n", - "pandas' `DataFrame` allows many more parameters, but the signature with the corresponding\n", - "parameters would be: `join(right, on=(), how='inner', *, suffixes=('_x', '_y'))`. The valid values\n", - "of the `how=` parameter will vary depending on the backend, but common values are 'inner', 'outer',\n", - "'left', and 'right'.\n", + "`join` method. They both have similar capabilities.\n", "\n", "The biggest difference between Ibis' `join` method and pandas' `merge` method is that pandas only\n", "accepts column names or index levels to join on, whereas Ibis can merge on expressions.\n", @@ -2674,7 +1137,7 @@ }, { "cell_type": "code", - "execution_count": 54, + "execution_count": null, "id": "1d244188-0e5d-441d-b9ed-e6bed6ebf287", "metadata": {}, "outputs": [], @@ -2694,158 +1157,20 @@ }, { "cell_type": "code", - "execution_count": 55, + "execution_count": null, "id": "25e4c74f-178b-4c77-877d-2057e91f393a", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namexyx_100y_100
0a12100200
\n", - "
" - ], - "text/plain": [ - " name x y x_100 y_100\n", - "0 a 1 2 100 200" - ] - }, - "execution_count": 55, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "df_left.merge(df_right, on='name')" ] }, { "cell_type": "code", - "execution_count": 56, + "execution_count": null, "id": "f28d2c44-1ec6-4e38-af40-527936db6a6d", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namexyx_100y_100
0a1.02.0100.0200.0
1b3.04.0NaNNaN
2c4.06.0NaNNaN
3mNaNNaN300.0400.0
4nNaNNaN400.0600.0
\n", - "
" - ], - "text/plain": [ - " name x y x_100 y_100\n", - "0 a 1.0 2.0 100.0 200.0\n", - "1 b 3.0 4.0 NaN NaN\n", - "2 c 4.0 6.0 NaN NaN\n", - "3 m NaN NaN 300.0 400.0\n", - "4 n NaN NaN 400.0 600.0" - ] - }, - "execution_count": 56, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "df_left.merge(df_right, on='name', how='outer')" ] @@ -2860,7 +1185,7 @@ }, { "cell_type": "code", - "execution_count": 57, + "execution_count": null, "id": "e1cbaa65-7c76-4e2f-bf29-dff02c05dc25", "metadata": {}, "outputs": [], @@ -2872,37 +1197,10 @@ }, { "cell_type": "code", - "execution_count": 58, + "execution_count": null, "id": "45cc37a6-601f-48e5-a266-39380c165bff", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┓\n",
-       "┃ name    x      y      x_100  y_100 ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64int64int64int64 │\n",
-       "├────────┼───────┼───────┼───────┼───────┤\n",
-       "│ a      │     12100200 │\n",
-       "└────────┴───────┴───────┴───────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mname\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mx\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1my\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mx_100\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1my_100\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼───────┼───────┼───────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │ \u001b[1;36m2\u001b[0m │ \u001b[1;36m100\u001b[0m │ \u001b[1;36m200\u001b[0m │\n", - "└────────┴───────┴───────┴───────┴───────┘" - ] - }, - "execution_count": 58, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t_left.join(t_right, t_left.name == t_right.name)" ] @@ -2912,54 +1210,15 @@ "id": "4597efd7-5bcf-4c78-9fa9-f60cbd893ea4", "metadata": {}, "source": [ - "You may notice that in Ibis joins, even if the predicate is an equality expression and both tables\n", - "have the same column name, you will still get multiple output columns with suffixes added.\n", - "This may change in a future version to match the pandas behavior.\n", - "\n", "Below is an outer join where missing values are filled with `NaN`." ] }, { "cell_type": "code", - "execution_count": 59, + "execution_count": null, "id": "6142e659-d60b-4f0c-8d37-7ac53d4a7a5b", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n",
-       "┃ name_x  x      y      name_y  x_100  y_100 ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64int64stringint64int64 │\n",
-       "├────────┼───────┼───────┼────────┼───────┼───────┤\n",
-       "│ a      │     12 │ a      │   100200 │\n",
-       "│ b      │     34 │ b      │      │\n",
-       "│ c      │     46 │ c      │      │\n",
-       "│ m      │      │ m      │   300400 │\n",
-       "│ n      │      │ n      │   400600 │\n",
-       "└────────┴───────┴───────┴────────┴───────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mname_x\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mx\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1my\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mname_y\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mx_100\u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1my_100\u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼───────┼────────┼───────┼───────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │ \u001b[1;36m2\u001b[0m │ a │ \u001b[1;36m100\u001b[0m │ \u001b[1;36m200\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │ \u001b[1;36m4\u001b[0m │ b │ \u001b[2m∅\u001b[0m │ \u001b[2m∅\u001b[0m │\n", - "│ c │ \u001b[1;36m4\u001b[0m │ \u001b[1;36m6\u001b[0m │ c │ \u001b[2m∅\u001b[0m │ \u001b[2m∅\u001b[0m │\n", - "│ m │ \u001b[2m∅\u001b[0m │ \u001b[2m∅\u001b[0m │ m │ \u001b[1;36m300\u001b[0m │ \u001b[1;36m400\u001b[0m │\n", - "│ n │ \u001b[2m∅\u001b[0m │ \u001b[2m∅\u001b[0m │ n │ \u001b[1;36m400\u001b[0m │ \u001b[1;36m600\u001b[0m │\n", - "└────────┴───────┴───────┴────────┴───────┴───────┘" - ] - }, - "execution_count": 59, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "t_left.join(t_right, t_left.name == t_right.name, how='outer')" ] @@ -2983,7 +1242,7 @@ }, { "cell_type": "code", - "execution_count": 60, + "execution_count": null, "id": "0aa28ac6-bf75-4b47-8986-0ecb1e7ff28e", "metadata": {}, "outputs": [], @@ -3003,92 +1262,10 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": null, "id": "19482224-2a86-4925-be2a-c5412f3d488d", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
\n", - "\n", - "\n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - " \n", - "
namexy
0a12
1b34
2c46
0a100200
1m300400
2n400600
\n", - "
" - ], - "text/plain": [ - " name x y\n", - "0 a 1 2\n", - "1 b 3 4\n", - "2 c 4 6\n", - "0 a 100 200\n", - "1 m 300 400\n", - "2 n 400 600" - ] - }, - "execution_count": 61, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "pd.concat([df_1, df_2])" ] @@ -3103,7 +1280,7 @@ }, { "cell_type": "code", - "execution_count": 62, + "execution_count": null, "id": "efbbb4b4-ef7e-4e8a-a8e2-359ffc70db58", "metadata": {}, "outputs": [], @@ -3115,47 +1292,10 @@ }, { "cell_type": "code", - "execution_count": 63, + "execution_count": null, "id": "56f6ab13-be06-4779-8289-dd838bde2ece", "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "
┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n",
-       "┃ name    x      y     ┃\n",
-       "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n",
-       "│ stringint64int64 │\n",
-       "├────────┼───────┼───────┤\n",
-       "│ a      │     12 │\n",
-       "│ b      │     34 │\n",
-       "│ c      │     46 │\n",
-       "│ a      │   100200 │\n",
-       "│ m      │   300400 │\n",
-       "│ n      │   400600 │\n",
-       "└────────┴───────┴───────┘\n",
-       "
\n" - ], - "text/plain": [ - "┏━━━━━━━━┳━━━━━━━┳━━━━━━━┓\n", - "┃\u001b[1m \u001b[0m\u001b[1mname\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1mx\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\u001b[1m \u001b[0m\u001b[1my\u001b[0m\u001b[1m \u001b[0m\u001b[1m \u001b[0m┃\n", - "┡━━━━━━━━╇━━━━━━━╇━━━━━━━┩\n", - "│ \u001b[2mstring\u001b[0m │ \u001b[2mint64\u001b[0m │ \u001b[2mint64\u001b[0m │\n", - "├────────┼───────┼───────┤\n", - "│ a │ \u001b[1;36m1\u001b[0m │ \u001b[1;36m2\u001b[0m │\n", - "│ b │ \u001b[1;36m3\u001b[0m │ \u001b[1;36m4\u001b[0m │\n", - "│ c │ \u001b[1;36m4\u001b[0m │ \u001b[1;36m6\u001b[0m │\n", - "│ a │ \u001b[1;36m100\u001b[0m │ \u001b[1;36m200\u001b[0m │\n", - "│ m │ \u001b[1;36m300\u001b[0m │ \u001b[1;36m400\u001b[0m │\n", - "│ n │ \u001b[1;36m400\u001b[0m │ \u001b[1;36m600\u001b[0m │\n", - "└────────┴───────┴───────┘" - ] - }, - "execution_count": 63, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ "unioned = ibis.union(t_1, t_2)\n", "unioned" @@ -3164,7 +1304,7 @@ ], "metadata": { "kernelspec": { - "display_name": ".venv", + "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, @@ -3178,7 +1318,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.10.10" }, "vscode": { "interpreter": { diff --git a/ibis/backends/clickhouse/tests/test_select.py b/ibis/backends/clickhouse/tests/test_select.py index c8a23b76c201..281b296a5818 100644 --- a/ibis/backends/clickhouse/tests/test_select.py +++ b/ibis/backends/clickhouse/tests/test_select.py @@ -373,9 +373,9 @@ def test_asof_join(time_left, time_right): time_left['key'] == time_right['key'], time_left['time'] >= time_right['time'], ], - ) + ).drop("time_right") result = expr.execute() - result['time'] = result['time_x'] - result.drop(['time_x', 'time_y'], axis=1, inplace=True) - expected = pd.merge_asof(time_left.execute(), time_right.execute(), on='time') + expected = pd.merge_asof( + time_left.execute(), time_right.execute(), on='time', suffixes=("", "_right") + ) tm.assert_frame_equal(result[expected.columns], expected) diff --git a/ibis/backends/tests/test_join.py b/ibis/backends/tests/test_join.py index 8df8bc4ecb46..754ff7154de0 100644 --- a/ibis/backends/tests/test_join.py +++ b/ibis/backends/tests/test_join.py @@ -101,12 +101,12 @@ def test_mutating_join(backend, batting, awards_players, how): expr.execute() .fillna(np.nan) .assign( - playerID=lambda df: df.playerID_x.where( - df.playerID_x.notnull(), - df.playerID_y, + playerID=lambda df: df.playerID.where( + df.playerID.notnull(), + df.playerID_right, ) ) - .drop(['playerID_x', 'playerID_y'], axis=1)[left.columns] + .drop(['playerID_right'], axis=1)[left.columns] .sort_values(result_order) .reset_index(drop=True) ) diff --git a/ibis/expr/operations/relations.py b/ibis/expr/operations/relations.py index 71e870ebb0a8..b0bebfeb940e 100644 --- a/ibis/expr/operations/relations.py +++ b/ibis/expr/operations/relations.py @@ -611,7 +611,7 @@ def schema(self): return backend._get_schema_using_query(self.query) -def _dedup_join_columns(expr, suffixes: tuple[str, str]): +def _dedup_join_columns(expr, lname: str, rname: str): op = expr.op() left = op.left.to_expr() right = op.right.to_expr() @@ -639,12 +639,10 @@ def _dedup_join_columns(expr, suffixes: tuple[str, str]): if not overlap: return expr - left_suffix, right_suffix = suffixes - # Rename columns in the left table that overlap, unless they're known to be # equal to a column in the right left_projections = [ - left[column].name(f"{column}{left_suffix}") + left[column].name(lname.format(name=column) if lname else column) if column in overlap and column not in equal else left[column] for column in left.columns @@ -653,7 +651,7 @@ def _dedup_join_columns(expr, suffixes: tuple[str, str]): # Rename columns in the right table that overlap, dropping any columns that # are known to be equal to those in the left table right_projections = [ - right[column].name(f"{column}{right_suffix}") + right[column].name(rname.format(name=column) if rname else column) if column in overlap else right[column] for column in right.columns diff --git a/ibis/expr/types/relations.py b/ibis/expr/types/relations.py index 71a227a522fb..a8c61dc788c9 100644 --- a/ibis/expr/types/relations.py +++ b/ibis/expr/types/relations.py @@ -6,7 +6,6 @@ import itertools import operator import re -import warnings from keyword import iskeyword from typing import TYPE_CHECKING, Callable, Iterable, Literal, Mapping, Sequence @@ -70,7 +69,9 @@ def f( # noqa: D417 | Sequence[ str | tuple[str | ir.Column, str | ir.Column] | ir.BooleanValue ] = (), - suffixes: tuple[str, str] = ("_x", "_y"), + *, + lname: str = "", + rname: str = "{name}_right", ) -> Table: """Perform a join between two tables. @@ -80,16 +81,19 @@ def f( # noqa: D417 Right table to join predicates Boolean or column names to join on - suffixes - Left and right suffixes that will be used to rename overlapping - columns. + lname + A format string to use to rename overlapping columns in the left + table (e.g. ``"left_{name}"``). + rname + A format string to use to rename overlapping columns in the right + table (e.g. ``"right_{name}"``). Returns ------- Table Joined table """ - return self.join(right, predicates, how=how, suffixes=suffixes) + return self.join(right, predicates, how=how, lname=lname, rname=rname) f.__name__ = name return f @@ -2366,7 +2370,8 @@ def join( 'left_semi', ] = 'inner', *, - suffixes: tuple[str, str] = ("_x", "_y"), + lname: str = "", + rname: str = "{name}_right", ) -> Table: """Perform a join between two tables. @@ -2380,9 +2385,12 @@ def join( Boolean or column names to join on how Join method - suffixes - Left and right suffixes that will be used to rename overlapping - columns. + lname + A format string to use to rename overlapping columns in the left + table (e.g. ``"left_{name}"``). + rname + A format string to use to rename overlapping columns in the right + table (e.g. ``"right_{name}"``). Examples -------- @@ -2484,7 +2492,7 @@ def join( if how in ("semi", "anti"): return expr - return ops.relations._dedup_join_columns(expr, suffixes=suffixes) + return ops.relations._dedup_join_columns(expr, lname=lname, rname=rname) def asof_join( left: Table, @@ -2493,7 +2501,8 @@ def asof_join( by: str | ir.Column | Sequence[str | ir.Column] = (), tolerance: str | ir.IntervalScalar | None = None, *, - suffixes: tuple[str, str] = ("_x", "_y"), + lname: str = "", + rname: str = "{name}_right", ) -> Table: """Perform an "as-of" join between `left` and `right`. @@ -2514,9 +2523,12 @@ def asof_join( column to group by before joining tolerance Amount of time to look behind when joining - suffixes - Left and right suffixes that will be used to rename overlapping - columns. + lname + A format string to use to rename overlapping columns in the left + table (e.g. ``"left_{name}"``). + rname + A format string to use to rename overlapping columns in the right + table (e.g. ``"right_{name}"``). Returns ------- @@ -2530,13 +2542,14 @@ def asof_join( by=by, tolerance=tolerance, ) - return ops.relations._dedup_join_columns(op.to_expr(), suffixes=suffixes) + return ops.relations._dedup_join_columns(op.to_expr(), lname=lname, rname=rname) def cross_join( left: Table, right: Table, *rest: Table, - suffixes: tuple[str, str] = ("_x", "_y"), + lname: str = "", + rname: str = "{name}_right", ) -> Table: """Compute the cross join of a sequence of tables. @@ -2548,9 +2561,12 @@ def cross_join( Right table rest Additional tables to cross join - suffixes - Left and right suffixes that will be used to rename overlapping - columns. + lname + A format string to use to rename overlapping columns in the left + table (e.g. ``"left_{name}"``). + rname + A format string to use to rename overlapping columns in the right + table (e.g. ``"right_{name}"``). Returns ------- @@ -2567,37 +2583,36 @@ def cross_join( >>> agg = t.drop("year").agg(s.across(s.numeric(), _.mean())) >>> expr = t.cross_join(agg) >>> expr - ┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━┳━━━┓ - ┃ species ┃ island ┃ bill_length_mm_x ┃ bill_depth_mm_x ┃ … ┃ - ┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━╇━━━┩ - │ string │ string │ float64 │ float64 │ … │ - ├─────────┼───────────┼──────────────────┼─────────────────┼───┤ - │ Adelie │ Torgersen │ 39.1 │ 18.7 │ … │ - │ Adelie │ Torgersen │ 39.5 │ 17.4 │ … │ - │ Adelie │ Torgersen │ 40.3 │ 18.0 │ … │ - │ Adelie │ Torgersen │ nan │ nan │ … │ - │ Adelie │ Torgersen │ 36.7 │ 19.3 │ … │ - │ Adelie │ Torgersen │ 39.3 │ 20.6 │ … │ - │ Adelie │ Torgersen │ 38.9 │ 17.8 │ … │ - │ Adelie │ Torgersen │ 39.2 │ 19.6 │ … │ - │ Adelie │ Torgersen │ 34.1 │ 18.1 │ … │ - │ Adelie │ Torgersen │ 42.0 │ 20.2 │ … │ - │ … │ … │ … │ … │ … │ - └─────────┴───────────┴──────────────────┴─────────────────┴───┘ - >>> from pprint import pprint - >>> pprint(expr.columns) + ┏━━━━━━━━━┳━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━┓ + ┃ species ┃ island ┃ bill_length_mm ┃ bill_depth_mm ┃ flipper_length_mm ┃ … ┃ + ┡━━━━━━━━━╇━━━━━━━━━━━╇━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━┩ + │ string │ string │ float64 │ float64 │ int64 │ … │ + ├─────────┼───────────┼────────────────┼───────────────┼───────────────────┼───┤ + │ Adelie │ Torgersen │ 39.1 │ 18.7 │ 181 │ … │ + │ Adelie │ Torgersen │ 39.5 │ 17.4 │ 186 │ … │ + │ Adelie │ Torgersen │ 40.3 │ 18.0 │ 195 │ … │ + │ Adelie │ Torgersen │ nan │ nan │ ∅ │ … │ + │ Adelie │ Torgersen │ 36.7 │ 19.3 │ 193 │ … │ + │ Adelie │ Torgersen │ 39.3 │ 20.6 │ 190 │ … │ + │ Adelie │ Torgersen │ 38.9 │ 17.8 │ 181 │ … │ + │ Adelie │ Torgersen │ 39.2 │ 19.6 │ 195 │ … │ + │ Adelie │ Torgersen │ 34.1 │ 18.1 │ 193 │ … │ + │ Adelie │ Torgersen │ 42.0 │ 20.2 │ 190 │ … │ + │ … │ … │ … │ … │ … │ … │ + └─────────┴───────────┴────────────────┴───────────────┴───────────────────┴───┘ + >>> expr.columns ['species', 'island', - 'bill_length_mm_x', - 'bill_depth_mm_x', - 'flipper_length_mm_x', - 'body_mass_g_x', + 'bill_length_mm', + 'bill_depth_mm', + 'flipper_length_mm', + 'body_mass_g', 'sex', 'year', - 'bill_length_mm_y', - 'bill_depth_mm_y', - 'flipper_length_mm_y', - 'body_mass_g_y'] + 'bill_length_mm_right', + 'bill_depth_mm_right', + 'flipper_length_mm_right', + 'body_mass_g_right'] >>> expr.count() 344 >>> t.count() @@ -2608,7 +2623,7 @@ def cross_join( functools.reduce(Table.cross_join, rest, right), [], ) - return ops.relations._dedup_join_columns(op.to_expr(), suffixes=suffixes) + return ops.relations._dedup_join_columns(op.to_expr(), lname=lname, rname=rname) inner_join = _regular_join_method("inner_join", "inner") left_join = _regular_join_method("left_join", "left") diff --git a/ibis/tests/expr/test_struct.py b/ibis/tests/expr/test_struct.py index cce3b9c1897f..56ffe7e65b5c 100644 --- a/ibis/tests/expr/test_struct.py +++ b/ibis/tests/expr/test_struct.py @@ -68,15 +68,15 @@ def test_unpack_from_table(t): def test_lift_join(t, s): join = t.join(s, t.d == s.a.g) - result = join.a_y.lift() - expected = join[_.a_y.f, _.a_y.g] + result = join.a_right.lift() + expected = join[_.a_right.f, _.a_right.g] assert result.equals(expected) def test_unpack_join_from_table(t, s): join = t.join(s, t.d == s.a.g) - result = join.unpack("a_y") - expected = join[_.a_x, _.d, _.a_y.f, _.a_y.g] + result = join.unpack("a_right") + expected = join[_.a, _.d, _.a_right.f, _.a_right.g] assert result.equals(expected) diff --git a/ibis/tests/expr/test_table.py b/ibis/tests/expr/test_table.py index f63c513fb92b..7029a074c51c 100644 --- a/ibis/tests/expr/test_table.py +++ b/ibis/tests/expr/test_table.py @@ -794,9 +794,9 @@ def test_asof_join(): joined = api.asof_join(left, right, 'time') assert joined.columns == [ - "time_x", + "time", "value", - "time_y", + "time_right", "value2", ] pred = joined.op().table.predicates[0] @@ -808,11 +808,11 @@ def test_asof_join_with_by(): right = ibis.table([('time', 'int32'), ('key', 'int32'), ('value2', 'double')]) joined = api.asof_join(left, right, 'time', by='key') assert joined.columns == [ - "time_x", - "key_x", + "time", + "key", "value", - "time_y", - "key_y", + "time_right", + "key_right", "value2", ] by = joined.op().table.by[0] @@ -931,8 +931,8 @@ def test_self_join_no_view_convenience(table): # column names to join on rather than referentially-valid expressions result = table.join(table, [('g', 'g')]) - expected_cols = [f"{c}_x" if c != 'g' else 'g' for c in table.columns] - expected_cols.extend(f"{c}_y" for c in table.columns if c != 'g') + expected_cols = list(table.columns) + expected_cols.extend(f"{c}_right" for c in table.columns if c != 'g') assert result.columns == expected_cols @@ -1027,7 +1027,7 @@ def test_inner_join_overlapping_column_names(): joined = t1.join(t2, 'foo') expected = t1.join(t2, t1.foo == t2.foo) assert_equal(joined, expected) - assert joined.columns == ["foo", "bar_x", "value1", "bar_y", "value2"] + assert joined.columns == ["foo", "bar", "value1", "bar_right", "value2"] joined = t1.join(t2, ['foo', 'bar']) expected = t1.join(t2, [t1.foo == t2.foo, t1.bar == t2.bar]) @@ -1036,11 +1036,25 @@ def test_inner_join_overlapping_column_names(): # Equality predicates don't have same name, need to rename joined = t1.join(t2, t1.foo == t2.bar) - assert joined.columns == ["foo_x", "bar_x", "value1", "foo_y", "bar_y", "value2"] + assert joined.columns == [ + "foo", + "bar", + "value1", + "foo_right", + "bar_right", + "value2", + ] # Not all predicates are equality, still need to rename joined = t1.join(t2, ["foo", t1.value1 < t2.value2]) - assert joined.columns == ["foo_x", "bar_x", "value1", "foo_y", "bar_y", "value2"] + assert joined.columns == [ + "foo", + "bar", + "value1", + "foo_right", + "bar_right", + "value2", + ] def test_join_key_alternatives(con): @@ -1542,10 +1556,10 @@ def test_merge_as_of_allows_overlapping_columns(): merged = ibis.api.asof_join(signal_one, signal_two, 'timestamp_received') assert merged.columns == [ 'current', - 'timestamp_received_x', + 'timestamp_received', 'signal_one', 'voltage', - 'timestamp_received_y', + 'timestamp_received_right', 'signal_two', ] @@ -1572,13 +1586,22 @@ def test_filter_applied_to_join(): @pytest.mark.parametrize("how", ["inner", "left", "outer", "right"]) -def test_join_suffixes(how): +def test_join_lname_rname(how): left = ibis.table([("id", "int64"), ("first_name", "string")]) right = ibis.table([("id", "int64"), ("last_name", "string")]) - method = getattr(left, f"{how}_join") - expr = method(right, suffixes=("_left", "_right")) - assert expr.columns == ["id_left", "first_name", "id_right", "last_name"] + + expr = method(right) + assert expr.columns == ["id", "first_name", "id_right", "last_name"] + + expr = method(right, rname="right_{name}") + assert expr.columns == ["id", "first_name", "right_id", "last_name"] + + expr = method(right, lname="left_{name}", rname="") + assert expr.columns == ["left_id", "first_name", "id", "last_name"] + + expr = method(right, rname="right_{name}", lname="left_{name}") + assert expr.columns == ["left_id", "first_name", "right_id", "last_name"] def test_drop(): diff --git a/ibis/tests/sql/snapshots/test_select_sql/test_limit_with_self_join/decompiled.py b/ibis/tests/sql/snapshots/test_select_sql/test_limit_with_self_join/decompiled.py index 41c57a5dbf7a..1acf1eee15a7 100644 --- a/ibis/tests/sql/snapshots/test_select_sql/test_limit_with_self_join/decompiled.py +++ b/ibis/tests/sql/snapshots/test_select_sql/test_limit_with_self_join/decompiled.py @@ -28,32 +28,32 @@ ) .select( [ - functional_alltypes.id.name("id_x"), - functional_alltypes.bool_col.name("bool_col_x"), - functional_alltypes.tinyint_col.name("tinyint_col_x"), - functional_alltypes.smallint_col.name("smallint_col_x"), - functional_alltypes.int_col.name("int_col_x"), - functional_alltypes.bigint_col.name("bigint_col_x"), - functional_alltypes.float_col.name("float_col_x"), - functional_alltypes.double_col.name("double_col_x"), - functional_alltypes.date_string_col.name("date_string_col_x"), - functional_alltypes.string_col.name("string_col_x"), - functional_alltypes.timestamp_col.name("timestamp_col_x"), - functional_alltypes.year.name("year_x"), - functional_alltypes.month.name("month_x"), - selfreference.id.name("id_y"), - selfreference.bool_col.name("bool_col_y"), - selfreference.tinyint_col.name("tinyint_col_y"), - selfreference.smallint_col.name("smallint_col_y"), - selfreference.int_col.name("int_col_y"), - selfreference.bigint_col.name("bigint_col_y"), - selfreference.float_col.name("float_col_y"), - selfreference.double_col.name("double_col_y"), - selfreference.date_string_col.name("date_string_col_y"), - selfreference.string_col.name("string_col_y"), - selfreference.timestamp_col.name("timestamp_col_y"), - selfreference.year.name("year_y"), - selfreference.month.name("month_y"), + functional_alltypes.id, + functional_alltypes.bool_col, + functional_alltypes.tinyint_col, + functional_alltypes.smallint_col, + functional_alltypes.int_col, + functional_alltypes.bigint_col, + functional_alltypes.float_col, + functional_alltypes.double_col, + functional_alltypes.date_string_col, + functional_alltypes.string_col, + functional_alltypes.timestamp_col, + functional_alltypes.year, + functional_alltypes.month, + selfreference.id.name("id_right"), + selfreference.bool_col.name("bool_col_right"), + selfreference.tinyint_col.name("tinyint_col_right"), + selfreference.smallint_col.name("smallint_col_right"), + selfreference.int_col.name("int_col_right"), + selfreference.bigint_col.name("bigint_col_right"), + selfreference.float_col.name("float_col_right"), + selfreference.double_col.name("double_col_right"), + selfreference.date_string_col.name("date_string_col_right"), + selfreference.string_col.name("string_col_right"), + selfreference.timestamp_col.name("timestamp_col_right"), + selfreference.year.name("year_right"), + selfreference.month.name("month_right"), ] ) .count() diff --git a/ibis/tests/sql/snapshots/test_select_sql/test_limit_with_self_join/out.sql b/ibis/tests/sql/snapshots/test_select_sql/test_limit_with_self_join/out.sql index dda04195721c..03e07fe224f3 100644 --- a/ibis/tests/sql/snapshots/test_select_sql/test_limit_with_self_join/out.sql +++ b/ibis/tests/sql/snapshots/test_select_sql/test_limit_with_self_join/out.sql @@ -1,25 +1,20 @@ SELECT count(1) AS `count` FROM ( - SELECT t1.`id` AS `id_x`, t1.`bool_col` AS `bool_col_x`, - t1.`tinyint_col` AS `tinyint_col_x`, - t1.`smallint_col` AS `smallint_col_x`, - t1.`int_col` AS `int_col_x`, t1.`bigint_col` AS `bigint_col_x`, - t1.`float_col` AS `float_col_x`, - t1.`double_col` AS `double_col_x`, - t1.`date_string_col` AS `date_string_col_x`, - t1.`string_col` AS `string_col_x`, - t1.`timestamp_col` AS `timestamp_col_x`, t1.`year` AS `year_x`, - t1.`month` AS `month_x`, t2.`id` AS `id_y`, - t2.`bool_col` AS `bool_col_y`, - t2.`tinyint_col` AS `tinyint_col_y`, - t2.`smallint_col` AS `smallint_col_y`, - t2.`int_col` AS `int_col_y`, t2.`bigint_col` AS `bigint_col_y`, - t2.`float_col` AS `float_col_y`, - t2.`double_col` AS `double_col_y`, - t2.`date_string_col` AS `date_string_col_y`, - t2.`string_col` AS `string_col_y`, - t2.`timestamp_col` AS `timestamp_col_y`, t2.`year` AS `year_y`, - t2.`month` AS `month_y` + SELECT t1.`id`, t1.`bool_col`, t1.`tinyint_col`, t1.`smallint_col`, + t1.`int_col`, t1.`bigint_col`, t1.`float_col`, t1.`double_col`, + t1.`date_string_col`, t1.`string_col`, t1.`timestamp_col`, + t1.`year`, t1.`month`, t2.`id` AS `id_right`, + t2.`bool_col` AS `bool_col_right`, + t2.`tinyint_col` AS `tinyint_col_right`, + t2.`smallint_col` AS `smallint_col_right`, + t2.`int_col` AS `int_col_right`, + t2.`bigint_col` AS `bigint_col_right`, + t2.`float_col` AS `float_col_right`, + t2.`double_col` AS `double_col_right`, + t2.`date_string_col` AS `date_string_col_right`, + t2.`string_col` AS `string_col_right`, + t2.`timestamp_col` AS `timestamp_col_right`, + t2.`year` AS `year_right`, t2.`month` AS `month_right` FROM functional_alltypes t1 INNER JOIN functional_alltypes t2 ON t1.`tinyint_col` < extract(t2.`timestamp_col`, 'minute') diff --git a/ibis/tests/sql/snapshots/test_select_sql/test_multiple_joins/decompiled.py b/ibis/tests/sql/snapshots/test_select_sql/test_multiple_joins/decompiled.py index 11ab2633cb61..da8275915ad4 100644 --- a/ibis/tests/sql/snapshots/test_select_sql/test_multiple_joins/decompiled.py +++ b/ibis/tests/sql/snapshots/test_select_sql/test_multiple_joins/decompiled.py @@ -16,9 +16,9 @@ [ star1.c, star1.f, - star1.foo_id.name("foo_id_x"), + star1.foo_id, star1.bar_id, - star2.foo_id.name("foo_id_y"), + star2.foo_id.name("foo_id_right"), star2.value1, star2.value3, ] diff --git a/ibis/tests/sql/snapshots/test_select_sql/test_multiple_joins/out.sql b/ibis/tests/sql/snapshots/test_select_sql/test_multiple_joins/out.sql index 51205b83304d..2e4276f4463e 100644 --- a/ibis/tests/sql/snapshots/test_select_sql/test_multiple_joins/out.sql +++ b/ibis/tests/sql/snapshots/test_select_sql/test_multiple_joins/out.sql @@ -1,7 +1,7 @@ SELECT *, `value1`, t1.`value2` FROM ( - SELECT t2.`c`, t2.`f`, t2.`foo_id` AS `foo_id_x`, t2.`bar_id`, - t3.`foo_id` AS `foo_id_y`, t3.`value1`, t3.`value3` + SELECT t2.`c`, t2.`f`, t2.`foo_id`, t2.`bar_id`, + t3.`foo_id` AS `foo_id_right`, t3.`value1`, t3.`value3` FROM star1 t2 LEFT OUTER JOIN star2 t3 ON t2.`foo_id` = t3.`foo_id` diff --git a/ibis/tests/sql/snapshots/test_select_sql/test_subquery_used_for_self_join/out.sql b/ibis/tests/sql/snapshots/test_select_sql/test_subquery_used_for_self_join/out.sql index 2db1cf1b6332..a59687794a8a 100644 --- a/ibis/tests/sql/snapshots/test_select_sql/test_subquery_used_for_self_join/out.sql +++ b/ibis/tests/sql/snapshots/test_select_sql/test_subquery_used_for_self_join/out.sql @@ -5,9 +5,9 @@ WITH t0 AS ( ) SELECT t0.`g`, max(t0.`total` - `total`) AS `metric` FROM ( - SELECT t0.`g` AS `g_x`, t0.`a` AS `a_x`, t0.`b` AS `b_x`, - t0.`total` AS `total_x`, t2.`g` AS `g_y`, t2.`a` AS `a_y`, - t2.`b` AS `b_y`, t2.`total` AS `total_y` + SELECT t0.`g`, t0.`a`, t0.`b`, t0.`total`, t2.`g` AS `g_right`, + t2.`a` AS `a_right`, t2.`b` AS `b_right`, + t2.`total` AS `total_right` FROM t0 INNER JOIN t0 t2 ON t0.`a` = t2.`b` diff --git a/ibis/tests/sql/snapshots/test_sqlalchemy/test_no_cross_join/out.sql b/ibis/tests/sql/snapshots/test_sqlalchemy/test_no_cross_join/out.sql index b2e37eefab1c..693af5a03d6c 100644 --- a/ibis/tests/sql/snapshots/test_sqlalchemy/test_no_cross_join/out.sql +++ b/ibis/tests/sql/snapshots/test_sqlalchemy/test_no_cross_join/out.sql @@ -1,12 +1,12 @@ SELECT - t0.id AS id_x, + t0.id, t0.personal, t0.family, t1.taken, t1.person, t1.quant, t1.reading, - t2.id AS id_y, + t2.id AS id_right, t2.site, t2.dated FROM person AS t0