diff --git a/example/Online Retail Analysis.ipynb b/example/Online Retail Analysis.ipynb index 1cdb001..4b78125 100644 --- a/example/Online Retail Analysis.ipynb +++ b/example/Online Retail Analysis.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 97, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -30,7 +30,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -611,7 +611,146 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# add isin example" + "we can also filter the data frame using a list of values." + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{'terms': {'country': ['Germany', 'United States']}}\n" + ] + }, + { + "data": { + "text/html": [ + "
\n", + " | country | \n", + "customer_id | \n", + "description | \n", + "invoice_date | \n", + "invoice_no | \n", + "quantity | \n", + "stock_code | \n", + "unit_price | \n", + "
---|---|---|---|---|---|---|---|---|
wXcVa24BUkfJ5hz0pRsL | \n", + "United Kingdom | \n", + "17850 | \n", + "WHITE HANGING HEART T-LIGHT HOLDER | \n", + "2010-12-01 08:26:00 | \n", + "536365 | \n", + "6 | \n", + "85123A | \n", + "2.55 | \n", + "
wncVa24BUkfJ5hz0pRsL | \n", + "United Kingdom | \n", + "17850 | \n", + "WHITE METAL LANTERN | \n", + "2010-12-01 08:26:00 | \n", + "536365 | \n", + "6 | \n", + "71053 | \n", + "3.39 | \n", + "
w3cVa24BUkfJ5hz0pRsL | \n", + "United Kingdom | \n", + "17850 | \n", + "CREAM CUPID HEARTS COAT HANGER | \n", + "2010-12-01 08:26:00 | \n", + "536365 | \n", + "8 | \n", + "84406B | \n", + "2.75 | \n", + "
xHcVa24BUkfJ5hz0pRsL | \n", + "United Kingdom | \n", + "17850 | \n", + "KNITTED UNION FLAG HOT WATER BOTTLE | \n", + "2010-12-01 08:26:00 | \n", + "536365 | \n", + "6 | \n", + "84029G | \n", + "3.39 | \n", + "
xXcVa24BUkfJ5hz0pRsL | \n", + "United Kingdom | \n", + "17850 | \n", + "RED WOOLLY HOTTIE WHITE HEART | \n", + "2010-12-01 08:26:00 | \n", + "536365 | \n", + "6 | \n", + "84029E | \n", + "3.39 | \n", + "
5 rows x 8 columns
" + ], + "text/plain": [ + " country customer_id \\\n", + "wXcVa24BUkfJ5hz0pRsL United Kingdom 17850 \n", + "wncVa24BUkfJ5hz0pRsL United Kingdom 17850 \n", + "w3cVa24BUkfJ5hz0pRsL United Kingdom 17850 \n", + "xHcVa24BUkfJ5hz0pRsL United Kingdom 17850 \n", + "xXcVa24BUkfJ5hz0pRsL United Kingdom 17850 \n", + "\n", + " description invoice_date \\\n", + "wXcVa24BUkfJ5hz0pRsL WHITE HANGING HEART T-LIGHT HOLDER 2010-12-01 08:26:00 \n", + "wncVa24BUkfJ5hz0pRsL WHITE METAL LANTERN 2010-12-01 08:26:00 \n", + "w3cVa24BUkfJ5hz0pRsL CREAM CUPID HEARTS COAT HANGER 2010-12-01 08:26:00 \n", + "xHcVa24BUkfJ5hz0pRsL KNITTED UNION FLAG HOT WATER BOTTLE 2010-12-01 08:26:00 \n", + "xXcVa24BUkfJ5hz0pRsL RED WOOLLY HOTTIE WHITE HEART 2010-12-01 08:26:00 \n", + "\n", + " invoice_no quantity stock_code unit_price \n", + "wXcVa24BUkfJ5hz0pRsL 536365 6 85123A 2.55 \n", + "wncVa24BUkfJ5hz0pRsL 536365 6 71053 3.39 \n", + "w3cVa24BUkfJ5hz0pRsL 536365 8 84406B 2.75 \n", + "xHcVa24BUkfJ5hz0pRsL 536365 6 84029G 3.39 \n", + "xXcVa24BUkfJ5hz0pRsL 536365 6 84029E 3.39 \n", + "\n", + "[5 rows x 8 columns]" + ] + }, + "execution_count": 7, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "print(df['country'].isin(['Germany', 'United States']))\n", + "df[df['country'].isin(['Germany', 'United Kingdom'])].head(5)" ] }, { @@ -1072,13 +1211,6 @@ " (df['unit_price']>0) & \n", " (df['unit_price']<100)].select_dtypes(include=[np.number]).hist(figsize=[12,4], bins=30)" ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] } ], "metadata": {