{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import numpy as np\nimport pandas as pd","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-01-31T02:35:47.728592Z","iopub.execute_input":"2023-01-31T02:35:47.728957Z","iopub.status.idle":"2023-01-31T02:35:47.734735Z","shell.execute_reply.started":"2023-01-31T02:35:47.728926Z","shell.execute_reply":"2023-01-31T02:35:47.733449Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_path = \"../input/otto-chunk-data-inparquet-format/train_parquet\"","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:31:57.382621Z","iopub.execute_input":"2023-01-31T02:31:57.382990Z","iopub.status.idle":"2023-01-31T02:31:57.387966Z","shell.execute_reply.started":"2023-01-31T02:31:57.382962Z","shell.execute_reply":"2023-01-31T02:31:57.386859Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ndf = pd.read_parquet(train_path)","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:31:57.389653Z","iopub.execute_input":"2023-01-31T02:31:57.390345Z","iopub.status.idle":"2023-01-31T02:32:09.935757Z","shell.execute_reply.started":"2023-01-31T02:31:57.390299Z","shell.execute_reply":"2023-01-31T02:32:09.934844Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ndf_carts = df[df.type == \"carts\"]\ndf_orders = df[df.type == \"orders\"]","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:09.937426Z","iopub.execute_input":"2023-01-31T02:32:09.938968Z","iopub.status.idle":"2023-01-31T02:32:40.922297Z","shell.execute_reply.started":"2023-01-31T02:32:09.938913Z","shell.execute_reply":"2023-01-31T02:32:40.920666Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ds_carts = df_carts.aid.value_counts()\nds_carts.describe()","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:40.923761Z","iopub.execute_input":"2023-01-31T02:32:40.924134Z","iopub.status.idle":"2023-01-31T02:32:41.856359Z","shell.execute_reply.started":"2023-01-31T02:32:40.924098Z","shell.execute_reply":"2023-01-31T02:32:41.854572Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ds_orders = df_orders.aid.value_counts()\nds_orders.describe()","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:41.857808Z","iopub.execute_input":"2023-01-31T02:32:41.858107Z","iopub.status.idle":"2023-01-31T02:32:42.162101Z","shell.execute_reply.started":"2023-01-31T02:32:41.858082Z","shell.execute_reply":"2023-01-31T02:32:42.160637Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(ds_carts), len(ds_orders)","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:42.163315Z","iopub.execute_input":"2023-01-31T02:32:42.163612Z","iopub.status.idle":"2023-01-31T02:32:42.171371Z","shell.execute_reply.started":"2023-01-31T02:32:42.163585Z","shell.execute_reply":"2023-01-31T02:32:42.170200Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ds_carts.quantile([.25, .5, .75])","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:42.173919Z","iopub.execute_input":"2023-01-31T02:32:42.174453Z","iopub.status.idle":"2023-01-31T02:32:42.205178Z","shell.execute_reply.started":"2023-01-31T02:32:42.174427Z","shell.execute_reply":"2023-01-31T02:32:42.204056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ds_orders.quantile([.25, .5, .75])","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:42.206709Z","iopub.execute_input":"2023-01-31T02:32:42.207084Z","iopub.status.idle":"2023-01-31T02:32:42.227559Z","shell.execute_reply.started":"2023-01-31T02:32:42.207049Z","shell.execute_reply":"2023-01-31T02:32:42.226327Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ndf_carts_session = df_carts.session.value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:42.229150Z","iopub.execute_input":"2023-01-31T02:32:42.229506Z","iopub.status.idle":"2023-01-31T02:32:43.308430Z","shell.execute_reply.started":"2023-01-31T02:32:42.229473Z","shell.execute_reply":"2023-01-31T02:32:43.306865Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ndf_orders_session = df_orders.session.value_counts()","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:43.310110Z","iopub.execute_input":"2023-01-31T02:32:43.310481Z","iopub.status.idle":"2023-01-31T02:32:43.681075Z","shell.execute_reply.started":"2023-01-31T02:32:43.310453Z","shell.execute_reply":"2023-01-31T02:32:43.679786Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_carts_session.quantile([.25, .5, .75])","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:43.682847Z","iopub.execute_input":"2023-01-31T02:32:43.683229Z","iopub.status.idle":"2023-01-31T02:32:43.762559Z","shell.execute_reply.started":"2023-01-31T02:32:43.683195Z","shell.execute_reply":"2023-01-31T02:32:43.760939Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_orders_session.quantile([.25, .5, .75])","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:32:43.763867Z","iopub.execute_input":"2023-01-31T02:32:43.764188Z","iopub.status.idle":"2023-01-31T02:32:43.799588Z","shell.execute_reply.started":"2023-01-31T02:32:43.764160Z","shell.execute_reply":"2023-01-31T02:32:43.798179Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"carts = ds_carts.index.values","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:35:34.830012Z","iopub.execute_input":"2023-01-31T02:35:34.830424Z","iopub.status.idle":"2023-01-31T02:35:34.836423Z","shell.execute_reply.started":"2023-01-31T02:35:34.830392Z","shell.execute_reply":"2023-01-31T02:35:34.834529Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"orders = ds_orders.index.values","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:35:34.926100Z","iopub.execute_input":"2023-01-31T02:35:34.926502Z","iopub.status.idle":"2023-01-31T02:35:34.931548Z","shell.execute_reply.started":"2023-01-31T02:35:34.926472Z","shell.execute_reply":"2023-01-31T02:35:34.930434Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"carts_only = np.setdiff1d(carts, orders)","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:36:09.392851Z","iopub.execute_input":"2023-01-31T02:36:09.393256Z","iopub.status.idle":"2023-01-31T02:36:09.563841Z","shell.execute_reply.started":"2023-01-31T02:36:09.393224Z","shell.execute_reply":"2023-01-31T02:36:09.562164Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"len(carts), len(carts_only)","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:36:18.129101Z","iopub.execute_input":"2023-01-31T02:36:18.129506Z","iopub.status.idle":"2023-01-31T02:36:18.138293Z","shell.execute_reply.started":"2023-01-31T02:36:18.129470Z","shell.execute_reply":"2023-01-31T02:36:18.136732Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ds_carts[carts_only].sort_values()","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:38:19.839664Z","iopub.execute_input":"2023-01-31T02:38:19.840110Z","iopub.status.idle":"2023-01-31T02:38:19.917450Z","shell.execute_reply.started":"2023-01-31T02:38:19.840076Z","shell.execute_reply":"2023-01-31T02:38:19.916122Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"candidates_orders = ds_orders.index.values","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:44:03.774145Z","iopub.execute_input":"2023-01-31T02:44:03.774652Z","iopub.status.idle":"2023-01-31T02:44:03.782876Z","shell.execute_reply.started":"2023-01-31T02:44:03.774609Z","shell.execute_reply":"2023-01-31T02:44:03.780065Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"np.save(\"candidates_orders.npy\", candidates_orders)","metadata":{"execution":{"iopub.status.busy":"2023-01-31T02:46:12.563200Z","iopub.execute_input":"2023-01-31T02:46:12.563709Z","iopub.status.idle":"2023-01-31T02:46:12.574464Z","shell.execute_reply.started":"2023-01-31T02:46:12.563670Z","shell.execute_reply":"2023-01-31T02:46:12.572984Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}