{"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-10T19:47:43.626951Z","iopub.execute_input":"2022-11-10T19:47:43.627371Z","iopub.status.idle":"2022-11-10T19:47:43.633381Z","shell.execute_reply.started":"2022-11-10T19:47:43.627337Z","shell.execute_reply":"2022-11-10T19:47:43.632632Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path_1 = '../input/horse-eff-and-pearson/horse_eff'\nparent_dirs = os.listdir(path_1)\nparent_dirs.remove('pearson_all')\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-10T19:47:43.635062Z","iopub.execute_input":"2022-11-10T19:47:43.635560Z","iopub.status.idle":"2022-11-10T19:47:43.672068Z","shell.execute_reply.started":"2022-11-10T19:47:43.635527Z","shell.execute_reply":"2022-11-10T19:47:43.671250Z"},"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    horse_eff = pd.read_csv(file_path_1) \n    file_path_2 = file_path_1.replace('../input/horse-eff-and-pearson/horse_eff', '../input/path-eff-and-fp/eff_pos')\n    finish_pos = pd.read_csv(file_path_2)\n    merged_df = pd.merge(horse_eff[['program_number', 'average_velocity_from_0']], finish_pos[['program_number', 'true_position_at_finish']], how='left', left_on=['program_number'], right_on = ['program_number'])\n\n    plt.scatter(x=\"true_position_at_finish\", y=\"average_velocity_from_0\", s=100.,  marker=\"*\", c='#FF0022', data=merged_df)\n    plt.xticks(ticks=merged_df.true_position_at_finish, labels=merged_df.true_position_at_finish)\n    plt.xlabel('position_at_finish')\n    plt.ylabel('average_velocity')\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-10T19:47:43.720349Z","iopub.execute_input":"2022-11-10T19:47:43.721312Z","iopub.status.idle":"2022-11-10T19:48:21.606845Z","shell.execute_reply.started":"2022-11-10T19:47:43.721246Z","shell.execute_reply":"2022-11-10T19:48:21.605442Z"},"collapsed":true,"jupyter":{"outputs_hidden":true},"trusted":true},"execution_count":null,"outputs":[]}]}