{"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\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-09-22T04:13:31.052514Z","iopub.execute_input":"2023-09-22T04:13:31.052959Z","iopub.status.idle":"2023-09-22T04:13:31.427614Z","shell.execute_reply.started":"2023-09-22T04:13:31.052925Z","shell.execute_reply":"2023-09-22T04:13:31.426725Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train = pd.read_csv('/kaggle/input/child-mind-institute-detect-sleep-states/train_events.csv')\ntrain_series = pd.read_parquet('/kaggle/input/child-mind-institute-detect-sleep-states/train_series.parquet')\n","metadata":{"execution":{"iopub.status.busy":"2023-09-22T04:13:38.800425Z","iopub.execute_input":"2023-09-22T04:13:38.800946Z","iopub.status.idle":"2023-09-22T04:14:29.59016Z","shell.execute_reply.started":"2023-09-22T04:13:38.800911Z","shell.execute_reply":"2023-09-22T04:14:29.589082Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"test_series1=pd.read_parquet('/kaggle/input/child-mind-institute-detect-sleep-states/test_series.parquet')","metadata":{"execution":{"iopub.status.busy":"2023-09-22T04:14:36.562599Z","iopub.execute_input":"2023-09-22T04:14:36.56309Z","iopub.status.idle":"2023-09-22T04:14:36.57802Z","shell.execute_reply.started":"2023-09-22T04:14:36.563041Z","shell.execute_reply":"2023-09-22T04:14:36.57676Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"combined_data = pd.concat([train_series, test_series1], axis=0, ignore_index=True)","metadata":{"execution":{"iopub.status.busy":"2023-09-22T04:14:52.459625Z","iopub.execute_input":"2023-09-22T04:14:52.460341Z","iopub.status.idle":"2023-09-22T04:15:02.117238Z","shell.execute_reply.started":"2023-09-22T04:14:52.460305Z","shell.execute_reply":"2023-09-22T04:15:02.116362Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2023-09-22T04:15:18.819414Z","iopub.execute_input":"2023-09-22T04:15:18.819794Z","iopub.status.idle":"2023-09-22T04:15:18.831991Z","shell.execute_reply.started":"2023-09-22T04:15:18.819762Z","shell.execute_reply":"2023-09-22T04:15:18.830893Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df_train['step'].fillna(method='ffill', inplace=True)\ndf_train['timestamp'].fillna(method='ffill', inplace=True)","metadata":{"execution":{"iopub.status.busy":"2023-09-22T04:15:25.228621Z","iopub.execute_input":"2023-09-22T04:15:25.229043Z","iopub.status.idle":"2023-09-22T04:15:25.239076Z","shell.execute_reply.started":"2023-09-22T04:15:25.229009Z","shell.execute_reply":"2023-09-22T04:15:25.238154Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\ncombined_data_final = pd.merge(combined_data, df_train, on='series_id', how='inner')\n","metadata":{"execution":{"iopub.status.busy":"2023-09-22T04:15:38.378252Z","iopub.execute_input":"2023-09-22T04:15:38.378638Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}