{"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"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":59093,"databundleVersionId":7469972,"sourceType":"competition"}],"dockerImageVersionId":30635,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-01-12T13:37:36.329969Z","iopub.execute_input":"2024-01-12T13:37:36.330434Z","iopub.status.idle":"2024-01-12T13:37:55.985103Z","shell.execute_reply.started":"2024-01-12T13:37:36.330397Z","shell.execute_reply":"2024-01-12T13:37:55.983921Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%time\ndf = pd.read_csv('/kaggle/input/hms-harmful-brain-activity-classification/train.csv')\n\nnan_list = []\nlist_of_unique_eeg_id = df['eeg_id'].unique()\nfor eeg in list_of_unique_eeg_id:\n    filepath = f'/kaggle/input/hms-harmful-brain-activity-classification/train_eegs/{eeg}.parquet'\n    matrix = pd.read_parquet(filepath).values\n    if np.isnan(matrix).any():\n        nan_list.append(eeg)\n        #print(eeg)\n        \nprint(f'There are {len(nan_list)} eegs containing at least a NaN.  ')","metadata":{"execution":{"iopub.status.busy":"2024-01-12T13:39:58.639155Z","iopub.execute_input":"2024-01-12T13:39:58.640077Z","iopub.status.idle":"2024-01-12T13:39:58.963531Z","shell.execute_reply.started":"2024-01-12T13:39:58.640012Z","shell.execute_reply":"2024-01-12T13:39:58.962219Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(nan_list[:3])\nnp.save('eeg_containing_nan.npy', nan_list)","metadata":{"execution":{"iopub.status.busy":"2024-01-12T14:24:13.507463Z","iopub.execute_input":"2024-01-12T14:24:13.507892Z","iopub.status.idle":"2024-01-12T14:24:13.516130Z","shell.execute_reply.started":"2024-01-12T14:24:13.507860Z","shell.execute_reply":"2024-01-12T14:24:13.514627Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"retrieved = np.load('/kaggle/working/eeg_containing_nan.npy')\nretrieved[:3]","metadata":{"execution":{"iopub.status.busy":"2024-01-12T14:23:17.549932Z","iopub.execute_input":"2024-01-12T14:23:17.550406Z","iopub.status.idle":"2024-01-12T14:23:17.562413Z","shell.execute_reply.started":"2024-01-12T14:23:17.550368Z","shell.execute_reply":"2024-01-12T14:23:17.561301Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"execution":{"iopub.status.busy":"2024-01-12T14:23:37.433373Z","iopub.execute_input":"2024-01-12T14:23:37.433808Z","iopub.status.idle":"2024-01-12T14:23:37.442693Z","shell.execute_reply.started":"2024-01-12T14:23:37.433777Z","shell.execute_reply":"2024-01-12T14:23:37.441658Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}