{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"import pandas as pd\nimport seaborn as sns\npd.set_option('display.max_rows', 500)","metadata":{"execution":{"iopub.status.busy":"2023-09-07T04:36:18.075403Z","iopub.execute_input":"2023-09-07T04:36:18.075831Z","iopub.status.idle":"2023-09-07T04:36:18.081463Z","shell.execute_reply.started":"2023-09-07T04:36:18.075796Z","shell.execute_reply":"2023-09-07T04:36:18.080260Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_events = pd.read_csv(\"/kaggle/input/child-mind-institute-detect-sleep-states/train_events.csv\")\ntrain_events = train_events.dropna()","metadata":{"execution":{"iopub.status.busy":"2023-09-07T04:36:18.453423Z","iopub.execute_input":"2023-09-07T04:36:18.453895Z","iopub.status.idle":"2023-09-07T04:36:18.487405Z","shell.execute_reply.started":"2023-09-07T04:36:18.453858Z","shell.execute_reply":"2023-09-07T04:36:18.485719Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"series_ids = train_events['series_id'].unique().tolist()","metadata":{"execution":{"iopub.status.busy":"2023-09-07T04:36:18.871695Z","iopub.execute_input":"2023-09-07T04:36:18.872753Z","iopub.status.idle":"2023-09-07T04:36:18.878919Z","shell.execute_reply.started":"2023-09-07T04:36:18.872692Z","shell.execute_reply":"2023-09-07T04:36:18.877590Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"onset = []\nwakeup = []\n\nfor series_id in series_ids:\n    onset.append(train_events[train_events['series_id'] == series_id]['event'].value_counts()['onset'])\n    wakeup.append(train_events[train_events['series_id'] == series_id]['event'].value_counts()['wakeup'])\n    ","metadata":{"execution":{"iopub.status.busy":"2023-09-07T04:37:11.914280Z","iopub.execute_input":"2023-09-07T04:37:11.914671Z","iopub.status.idle":"2023-09-07T04:37:13.316505Z","shell.execute_reply.started":"2023-09-07T04:37:11.914632Z","shell.execute_reply":"2023-09-07T04:37:13.315454Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_ = pd.DataFrame()\ntrain_['series_id'] = series_ids\ntrain_['onset'] = onset\ntrain_['wakeup'] = wakeup\ntrain_","metadata":{"execution":{"iopub.status.busy":"2023-09-07T04:37:13.318303Z","iopub.execute_input":"2023-09-07T04:37:13.318616Z","iopub.status.idle":"2023-09-07T04:37:13.362650Z","shell.execute_reply.started":"2023-09-07T04:37:13.318589Z","shell.execute_reply":"2023-09-07T04:37:13.361526Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.histplot(train_['onset']);","metadata":{"execution":{"iopub.status.busy":"2023-09-07T04:38:44.539604Z","iopub.execute_input":"2023-09-07T04:38:44.540045Z","iopub.status.idle":"2023-09-07T04:38:44.878137Z","shell.execute_reply.started":"2023-09-07T04:38:44.540006Z","shell.execute_reply":"2023-09-07T04:38:44.875956Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.histplot(train_['wakeup']);","metadata":{"execution":{"iopub.status.busy":"2023-09-07T04:39:04.461386Z","iopub.execute_input":"2023-09-07T04:39:04.461853Z","iopub.status.idle":"2023-09-07T04:39:04.801494Z","shell.execute_reply.started":"2023-09-07T04:39:04.461814Z","shell.execute_reply":"2023-09-07T04:39:04.800582Z"},"trusted":true},"execution_count":null,"outputs":[]}],"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"}}