{"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":"# 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\n!pip install fastparquet\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\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":"2023-04-13T06:03:18.177148Z","iopub.execute_input":"2023-04-13T06:03:18.177872Z","iopub.status.idle":"2023-04-13T06:03:32.116545Z","shell.execute_reply.started":"2023-04-13T06:03:18.177828Z","shell.execute_reply":"2023-04-13T06:03:32.115101Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# IMPORTS\nfrom matplotlib.animation import FuncAnimation\nfrom IPython.display import HTML\nimport matplotlib.pyplot as plt\nfrom fastparquet import write \nimport time","metadata":{"execution":{"iopub.status.busy":"2023-04-13T06:05:04.046314Z","iopub.execute_input":"2023-04-13T06:05:04.047637Z","iopub.status.idle":"2023-04-13T06:05:04.053347Z","shell.execute_reply.started":"2023-04-13T06:05:04.047584Z","shell.execute_reply":"2023-04-13T06:05:04.052027Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Global Data\ndir = '/kaggle/input/asl-signs'\n# df = pd.read_csv('/kaggle/input/asl-signs/train.csv')","metadata":{"execution":{"iopub.status.busy":"2023-04-13T06:05:06.659841Z","iopub.execute_input":"2023-04-13T06:05:06.660289Z","iopub.status.idle":"2023-04-13T06:05:06.665261Z","shell.execute_reply.started":"2023-04-13T06:05:06.660223Z","shell.execute_reply":"2023-04-13T06:05:06.664316Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# # Preprocess:\n# # Add Insights about the parquet file into the main data\n# def add_insights(data):\n#     df = pd.read_parquet(f\"{dir}/{data['path']}\")\n#     data['min_frame'], data['max_frame'], data['frames'] = min(df['frame']), max(df['frame']), df['frame'].nunique()\n#     for data_type in ['face', 'pose', 'right_hand', 'left_hand']:\n#         data[f'{data_type}_frame'] = df[df['type']==data_type]['frame'].nunique()\n#         data[f'{data_type}_data'] = df[df['type']==data_type]['row_id'].nunique()\n#     return data\n\n# start = time.time()\n# df = df.apply(add_insights, axis = 1)\n# print(time.time() - start)\n# write('./data_insights.parq', df)","metadata":{"execution":{"iopub.status.busy":"2023-04-13T02:23:03.396207Z","iopub.execute_input":"2023-04-13T02:23:03.397207Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_parquet(\"/kaggle/input/asl-with-insights\")\n\ndfs = df.groupby('sign')\n","metadata":{"execution":{"iopub.status.busy":"2023-04-13T06:20:12.714705Z","iopub.execute_input":"2023-04-13T06:20:12.715121Z","iopub.status.idle":"2023-04-13T06:20:12.816084Z","shell.execute_reply.started":"2023-04-13T06:20:12.715084Z","shell.execute_reply":"2023-04-13T06:20:12.815016Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dfss = dfs.agg({\n    'participant_id': ['nunique'], \n    'min_frame': ['median', 'min'],\n    'max_frame': ['median', 'max'],\n    'frames': ['median', 'max', 'min'],\n    'face_frame': ['median', 'max', 'min'],\n    'pose_frame': ['median', 'max', 'min'],\n    'right_hand_frame': ['median', 'max', 'min'],\n    'left_hand_frame': ['median', 'max', 'min'],\n   })\n","metadata":{"execution":{"iopub.status.busy":"2023-04-13T06:21:54.238517Z","iopub.execute_input":"2023-04-13T06:21:54.239781Z","iopub.status.idle":"2023-04-13T06:21:54.308175Z","shell.execute_reply.started":"2023-04-13T06:21:54.239714Z","shell.execute_reply":"2023-04-13T06:21:54.306823Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(df.columns)\nprint(dfss.columns)","metadata":{"execution":{"iopub.status.busy":"2023-04-13T06:22:34.566916Z","iopub.execute_input":"2023-04-13T06:22:34.567381Z","iopub.status.idle":"2023-04-13T06:22:34.574164Z","shell.execute_reply.started":"2023-04-13T06:22:34.567338Z","shell.execute_reply":"2023-04-13T06:22:34.573067Z"},"trusted":true},"execution_count":null,"outputs":[]}]}