{"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 matplotlib.pyplot as plt\nimport seaborn as sns\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\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\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":"2022-11-10T17:49:49.778897Z","iopub.execute_input":"2022-11-10T17:49:49.779350Z","iopub.status.idle":"2022-11-10T17:49:50.883898Z","shell.execute_reply.started":"2022-11-10T17:49:49.779234Z","shell.execute_reply":"2022-11-10T17:49:50.882896Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"start_table = pd.read_csv(\"../input/big-data-derby-2022/nyra_start_table.csv\")\nrace_table = pd.read_csv(\"../input/big-data-derby-2022/nyra_race_table.csv\")\ntracking_table = pd.read_csv(\"../input/big-data-derby-2022/nyra_tracking_table.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:50.885461Z","iopub.execute_input":"2022-11-10T17:49:50.885951Z","iopub.status.idle":"2022-11-10T17:49:58.254115Z","shell.execute_reply.started":"2022-11-10T17:49:50.885923Z","shell.execute_reply":"2022-11-10T17:49:58.252970Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"start_table.columns = ['track_id','race_date','race_number','program_number','weight_carried','jockey','odds','position_at_finish']\nstart_table.head(20)","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:58.255224Z","iopub.execute_input":"2022-11-10T17:49:58.255493Z","iopub.status.idle":"2022-11-10T17:49:58.279458Z","shell.execute_reply.started":"2022-11-10T17:49:58.255470Z","shell.execute_reply":"2022-11-10T17:49:58.278343Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Start table","metadata":{}},{"cell_type":"code","source":"start_table.head()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:58.282264Z","iopub.execute_input":"2022-11-10T17:49:58.282655Z","iopub.status.idle":"2022-11-10T17:49:58.296526Z","shell.execute_reply.started":"2022-11-10T17:49:58.282623Z","shell.execute_reply":"2022-11-10T17:49:58.295080Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"start_table.tail()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:58.297927Z","iopub.execute_input":"2022-11-10T17:49:58.298233Z","iopub.status.idle":"2022-11-10T17:49:58.313765Z","shell.execute_reply.started":"2022-11-10T17:49:58.298207Z","shell.execute_reply":"2022-11-10T17:49:58.312734Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"start_table.info()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:58.315245Z","iopub.execute_input":"2022-11-10T17:49:58.315996Z","iopub.status.idle":"2022-11-10T17:49:58.348627Z","shell.execute_reply.started":"2022-11-10T17:49:58.315968Z","shell.execute_reply":"2022-11-10T17:49:58.346855Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"start_table.describe()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:58.350312Z","iopub.execute_input":"2022-11-10T17:49:58.350794Z","iopub.status.idle":"2022-11-10T17:49:58.378036Z","shell.execute_reply.started":"2022-11-10T17:49:58.350754Z","shell.execute_reply":"2022-11-10T17:49:58.376708Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"start_table['program_number'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:58.379417Z","iopub.execute_input":"2022-11-10T17:49:58.379763Z","iopub.status.idle":"2022-11-10T17:49:58.390463Z","shell.execute_reply.started":"2022-11-10T17:49:58.379730Z","shell.execute_reply":"2022-11-10T17:49:58.388634Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(data= start_table, y='program_number')","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:58.392125Z","iopub.execute_input":"2022-11-10T17:49:58.392493Z","iopub.status.idle":"2022-11-10T17:49:58.667219Z","shell.execute_reply.started":"2022-11-10T17:49:58.392453Z","shell.execute_reply":"2022-11-10T17:49:58.665685Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# weight distribution\n\nsns.distplot(start_table['weight_carried'])","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:58.671273Z","iopub.execute_input":"2022-11-10T17:49:58.671613Z","iopub.status.idle":"2022-11-10T17:49:58.987481Z","shell.execute_reply.started":"2022-11-10T17:49:58.671586Z","shell.execute_reply":"2022-11-10T17:49:58.986761Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Most jockeys weight is around 120 ","metadata":{}},{"cell_type":"code","source":"sns.distplot(start_table['odds'])","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:58.988575Z","iopub.execute_input":"2022-11-10T17:49:58.988973Z","iopub.status.idle":"2022-11-10T17:49:59.296949Z","shell.execute_reply.started":"2022-11-10T17:49:58.988947Z","shell.execute_reply":"2022-11-10T17:49:59.295810Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"start_table['position_at_finish'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:59.298692Z","iopub.execute_input":"2022-11-10T17:49:59.299135Z","iopub.status.idle":"2022-11-10T17:49:59.308545Z","shell.execute_reply.started":"2022-11-10T17:49:59.299098Z","shell.execute_reply":"2022-11-10T17:49:59.307351Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(data = start_table,y='position_at_finish')","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:59.310038Z","iopub.execute_input":"2022-11-10T17:49:59.310426Z","iopub.status.idle":"2022-11-10T17:49:59.512814Z","shell.execute_reply.started":"2022-11-10T17:49:59.310393Z","shell.execute_reply":"2022-11-10T17:49:59.511609Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Univariate Analysis","metadata":{}},{"cell_type":"code","source":"sns.countplot(data = start_table,x='track_id')","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:59.514052Z","iopub.execute_input":"2022-11-10T17:49:59.514491Z","iopub.status.idle":"2022-11-10T17:49:59.650636Z","shell.execute_reply.started":"2022-11-10T17:49:59.514467Z","shell.execute_reply":"2022-11-10T17:49:59.649728Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.countplot(data = start_table, y = 'race_number')","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:59.651857Z","iopub.execute_input":"2022-11-10T17:49:59.652137Z","iopub.status.idle":"2022-11-10T17:49:59.848491Z","shell.execute_reply.started":"2022-11-10T17:49:59.652111Z","shell.execute_reply":"2022-11-10T17:49:59.847343Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Race table","metadata":{}},{"cell_type":"code","source":"race_table.head()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:59.849634Z","iopub.execute_input":"2022-11-10T17:49:59.849871Z","iopub.status.idle":"2022-11-10T17:49:59.862378Z","shell.execute_reply.started":"2022-11-10T17:49:59.849849Z","shell.execute_reply":"2022-11-10T17:49:59.861640Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking_table.head()","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:59.863552Z","iopub.execute_input":"2022-11-10T17:49:59.863993Z","iopub.status.idle":"2022-11-10T17:49:59.879817Z","shell.execute_reply.started":"2022-11-10T17:49:59.863959Z","shell.execute_reply":"2022-11-10T17:49:59.878639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# table_complete.columns = ['track_id','race_date','race_number','program_number','trakus_index','latitude','longitude','distance_id','course_type','track_condition','run_up_distance','race_type','purse','post_time','weight_carried','jockey','odds']\n# table_complete.head(20)","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:59.881376Z","iopub.execute_input":"2022-11-10T17:49:59.881636Z","iopub.status.idle":"2022-11-10T17:49:59.886047Z","shell.execute_reply.started":"2022-11-10T17:49:59.881614Z","shell.execute_reply":"2022-11-10T17:49:59.885111Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"tracking_table.to_csv('submission.csv', index=False)\nprint(\"Your submission was successfully saved!\")","metadata":{"execution":{"iopub.status.busy":"2022-11-10T17:49:59.887085Z","iopub.execute_input":"2022-11-10T17:49:59.887404Z","iopub.status.idle":"2022-11-10T17:50:15.353807Z","shell.execute_reply.started":"2022-11-10T17:49:59.887380Z","shell.execute_reply":"2022-11-10T17:50:15.352736Z"},"trusted":true},"execution_count":null,"outputs":[]}]}