{"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\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport os\nimport datetime\nimport math\nimport gc\nimport seaborn as sns\nimport matplotlib.pyplot as plt\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":"2022-11-10T18:00:32.166953Z","iopub.execute_input":"2022-11-10T18:00:32.168064Z","iopub.status.idle":"2022-11-10T18:00:33.565095Z","shell.execute_reply.started":"2022-11-10T18:00:32.167894Z","shell.execute_reply":"2022-11-10T18:00:33.563949Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path_1 = '../input/path-eff-and-fp/eff_pos'\nparent_dirs = os.listdir(path_1)\nwinner_eff = []\nfor x in parent_dirs:\n    files_list = os.listdir(os.path.join(path_1, x))\n    for y in files_list:\n        path_2 = os.path.join(path_1, x, y)\n        df_1 = pd.read_csv(path_2)\n        eff_1 = (df_1.path_efficiency >=1.)\n        if (sum(eff_1)>=1.0):\n            winner_eff.append(path_2)\nprint('there are {} races with path efficiency greater than 1.'.format(len(winner_eff)))\nwinner_eff","metadata":{"execution":{"iopub.status.busy":"2022-11-10T18:00:33.567475Z","iopub.execute_input":"2022-11-10T18:00:33.568307Z","iopub.status.idle":"2022-11-10T18:00:48.637644Z","shell.execute_reply.started":"2022-11-10T18:00:33.568254Z","shell.execute_reply":"2022-11-10T18:00:48.636603Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path_1 = '../input/path-eff-and-fp/eff_pos'\nparent_dirs = os.listdir(path_1)\nall_races = []\nfor x in parent_dirs:\n    files_list = os.listdir(os.path.join(path_1, x))\n    for y in files_list:\n        path_2 = os.path.join(path_1, x, y)\n        all_races.append(path_2)","metadata":{"execution":{"iopub.status.busy":"2022-11-10T18:00:48.639046Z","iopub.execute_input":"2022-11-10T18:00:48.639645Z","iopub.status.idle":"2022-11-10T18:00:48.663672Z","shell.execute_reply.started":"2022-11-10T18:00:48.639608Z","shell.execute_reply":"2022-11-10T18:00:48.662398Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for i in range(len(all_races)):\n    file_path_1 = all_races[i]\n    path_eff_1 = pd.read_csv(file_path_1)    \n    plt.scatter(x=\"true_position_at_finish\", y=\"path_efficiency\", s=100.,  marker=\"*\", c='#FF0022', data=path_eff_1)\n    plt.xticks(ticks=path_eff_1.true_position_at_finish, labels=path_eff_1.true_position_at_finish)\n    plt.xlabel('position_at_finish')\n    plt.ylabel('Path_Efficiency')\n    plt.title(file_path_1)\n    plt.grid(visible=True)    \n    plt.figure(figsize = (20,20))\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T18:00:48.666717Z","iopub.execute_input":"2022-11-10T18:00:48.667305Z","iopub.status.idle":"2022-11-10T18:07:37.139595Z","shell.execute_reply.started":"2022-11-10T18:00:48.667251Z","shell.execute_reply":"2022-11-10T18:07:37.138432Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"raw","source":"plt.scatter(x=\"true_position_at_finish\", y=\"path_efficiency\", s=100.,  marker=\"*\", c='#FF0022', data=path_eff)\nplt.xticks(ticks=path_eff.true_position_at_finish, labels=path_eff.true_position_at_finish)\nplt.xlabel('position_at_finish')\nplt.ylabel('Path_Efficiency')\nplt.grid(visible=True)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-11-05T09:36:03.609460Z","iopub.execute_input":"2022-11-05T09:36:03.609908Z","iopub.status.idle":"2022-11-05T09:36:03.632719Z","shell.execute_reply.started":"2022-11-05T09:36:03.609865Z","shell.execute_reply":"2022-11-05T09:36:03.631050Z"}}},{"cell_type":"raw","source":"path_1 = '../input/path-eff-and-fp/eff_pos'\nparent_dirs = os.listdir(path_1)\nall_races = []\nfor x in parent_dirs:\n    files_list = os.listdir(os.path.join(path_1, x))\n    for y in files_list:\n        path_2 = os.path.join(path_1, x, y)\n        all_races.append(path_2)\nprint(len(all_races))","metadata":{"execution":{"iopub.status.busy":"2022-11-05T09:36:03.634373Z","iopub.status.idle":"2022-11-05T09:36:03.634932Z","shell.execute_reply.started":"2022-11-05T09:36:03.634647Z","shell.execute_reply":"2022-11-05T09:36:03.634674Z"}}}]}