{"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 pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport gc","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-11-12T02:54:24.651261Z","iopub.execute_input":"2022-11-12T02:54:24.652100Z","iopub.status.idle":"2022-11-12T02:54:39.158992Z","shell.execute_reply.started":"2022-11-12T02:54:24.651994Z","shell.execute_reply":"2022-11-12T02:54:39.157460Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tem_1 = pd.read_parquet('../input/otto-eda/tem_0.parquet')\ntem_2 = pd.read_parquet('../input/otto-eda/tem_1.parquet')\ntem_3 = pd.read_parquet('../input/otto-eda/tem_2.parquet')\ntem_4 = pd.read_parquet('../input/otto-eda/tem_3.parquet')\n\nmerged_data = pd.concat([tem_1, tem_2, tem_3, tem_4])\ndisplay(merged_data)\n\ndel tem_1\ndel tem_2\ndel tem_3\ndel tem_4\ngc.collect()","metadata":{"execution":{"iopub.status.busy":"2022-11-12T02:54:39.161156Z","iopub.execute_input":"2022-11-12T02:54:39.161552Z","iopub.status.idle":"2022-11-12T02:55:33.166837Z","shell.execute_reply.started":"2022-11-12T02:54:39.161503Z","shell.execute_reply":"2022-11-12T02:55:33.165154Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"merged_data.sort_values(by=['aid'])","metadata":{"execution":{"iopub.status.busy":"2022-11-12T02:55:33.169127Z","iopub.execute_input":"2022-11-12T02:55:33.170134Z","iopub.status.idle":"2022-11-12T02:57:27.448319Z","shell.execute_reply.started":"2022-11-12T02:55:33.170054Z","shell.execute_reply":"2022-11-12T02:57:27.447032Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"count = merged_data.groupby(['time'])['session', 'aid', 'type'].count()\ncount_unique = merged_data.groupby(['time'])['session', 'aid'].nunique()","metadata":{"execution":{"iopub.status.busy":"2022-11-12T02:57:27.451446Z","iopub.execute_input":"2022-11-12T02:57:27.452638Z","iopub.status.idle":"2022-11-12T03:01:08.995310Z","shell.execute_reply.started":"2022-11-12T02:57:27.452581Z","shell.execute_reply":"2022-11-12T03:01:08.993946Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"count_type = merged_data[(merged_data['type']==1) | (merged_data['type']==2)].groupby(['time'])['type'].count()","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"time_list = merged_data['time'].unique()\ntime_list.sort()\ntime_list = [time[5:] for time in time_list]","metadata":{"execution":{"iopub.status.busy":"2022-11-12T03:01:32.577034Z","iopub.execute_input":"2022-11-12T03:01:32.577537Z","iopub.status.idle":"2022-11-12T03:01:49.335606Z","shell.execute_reply.started":"2022-11-12T03:01:32.577472Z","shell.execute_reply":"2022-11-12T03:01:49.334111Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20, 5))\nplt.plot(time_list, count_type, label='count_type')\nplt.plot(time_list, count_unique['session'], label='session')\nplt.xlabel(\"time\")\nplt.ylabel(\"article\")\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-12T03:13:47.536123Z","iopub.execute_input":"2022-11-12T03:13:47.536591Z","iopub.status.idle":"2022-11-12T03:13:47.900073Z","shell.execute_reply.started":"2022-11-12T03:13:47.536551Z","shell.execute_reply":"2022-11-12T03:13:47.898607Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(20, 5))\nplt.plot(time_list, count_unique['aid'], label='aid')\nplt.plot(time_list, count_unique['session'], label='session')\nplt.xlabel(\"time\")\nplt.ylabel(\"article\")\nplt.legend()\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-12T03:03:38.804077Z","iopub.execute_input":"2022-11-12T03:03:38.804559Z","iopub.status.idle":"2022-11-12T03:03:39.166677Z","shell.execute_reply.started":"2022-11-12T03:03:38.804520Z","shell.execute_reply":"2022-11-12T03:03:39.165318Z"},"trusted":true},"execution_count":null,"outputs":[]}]}