{"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)\n\nimport warnings\nwarnings.filterwarnings('ignore')\n\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\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-10-18T17:57:01.958129Z","iopub.execute_input":"2022-10-18T17:57:01.959664Z","iopub.status.idle":"2022-10-18T17:57:01.996124Z","shell.execute_reply.started":"2022-10-18T17:57:01.959508Z","shell.execute_reply":"2022-10-18T17:57:01.994946Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_track = pd.read_csv('../input/big-data-derby-2022/nyra_tracking_table.csv')\nnyra_start = pd.read_csv('../input/big-data-derby-2022/nyra_start_table.csv')\nnyra_race = pd.read_csv('../input/big-data-derby-2022/nyra_race_table.csv')\nnyra_complete = pd.read_csv('../input/big-data-derby-2022/nyra_2019_complete.csv')","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:01.998139Z","iopub.execute_input":"2022-10-18T17:57:01.998604Z","iopub.status.idle":"2022-10-18T17:57:30.251256Z","shell.execute_reply.started":"2022-10-18T17:57:01.998532Z","shell.execute_reply":"2022-10-18T17:57:30.249807Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print('Count of Track Table : ',nyra_track.shape)\nprint('Count of Start Table : ',nyra_start.shape)\nprint('Count of Race Table : ',nyra_race.shape)\nprint('Count of Complete Race Table : ',nyra_complete.shape)","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.253050Z","iopub.execute_input":"2022-10-18T17:57:30.253512Z","iopub.status.idle":"2022-10-18T17:57:30.260243Z","shell.execute_reply.started":"2022-10-18T17:57:30.253466Z","shell.execute_reply":"2022-10-18T17:57:30.259010Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_track.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.263506Z","iopub.execute_input":"2022-10-18T17:57:30.264332Z","iopub.status.idle":"2022-10-18T17:57:30.294074Z","shell.execute_reply.started":"2022-10-18T17:57:30.264271Z","shell.execute_reply":"2022-10-18T17:57:30.292764Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_race.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.295544Z","iopub.execute_input":"2022-10-18T17:57:30.295927Z","iopub.status.idle":"2022-10-18T17:57:30.312152Z","shell.execute_reply.started":"2022-10-18T17:57:30.295894Z","shell.execute_reply":"2022-10-18T17:57:30.310828Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_start.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.313417Z","iopub.execute_input":"2022-10-18T17:57:30.313751Z","iopub.status.idle":"2022-10-18T17:57:30.329029Z","shell.execute_reply.started":"2022-10-18T17:57:30.313722Z","shell.execute_reply":"2022-10-18T17:57:30.327746Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_complete.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.330449Z","iopub.execute_input":"2022-10-18T17:57:30.330802Z","iopub.status.idle":"2022-10-18T17:57:30.351451Z","shell.execute_reply.started":"2022-10-18T17:57:30.330770Z","shell.execute_reply":"2022-10-18T17:57:30.350291Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# no column name is added on start and complete table\n#adding column name for both tables","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.353341Z","iopub.execute_input":"2022-10-18T17:57:30.353697Z","iopub.status.idle":"2022-10-18T17:57:30.360671Z","shell.execute_reply.started":"2022-10-18T17:57:30.353666Z","shell.execute_reply":"2022-10-18T17:57:30.359626Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"start_columns = ['track_id',\n                 'race_date',\n'race_number',\n'program_number',\n'weight_carried',\n'jockey',\n'odds',\n'position_at_finish']","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.361852Z","iopub.execute_input":"2022-10-18T17:57:30.362181Z","iopub.status.idle":"2022-10-18T17:57:30.371391Z","shell.execute_reply.started":"2022-10-18T17:57:30.362151Z","shell.execute_reply":"2022-10-18T17:57:30.370482Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_start.columns = start_columns","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.375253Z","iopub.execute_input":"2022-10-18T17:57:30.375623Z","iopub.status.idle":"2022-10-18T17:57:30.383812Z","shell.execute_reply.started":"2022-10-18T17:57:30.375590Z","shell.execute_reply":"2022-10-18T17:57:30.382330Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_start.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.385173Z","iopub.execute_input":"2022-10-18T17:57:30.385745Z","iopub.status.idle":"2022-10-18T17:57:30.404209Z","shell.execute_reply.started":"2022-10-18T17:57:30.385708Z","shell.execute_reply":"2022-10-18T17:57:30.402980Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"complete_columns = ['track_id',\n                 'race_date',\n'race_number',\n'program_number',\n'trakus_index','latitude','longitude','distance_id','course_type','track_condition','run_up_distance','race_type','purse','post_time',\n'weight_carried',\n'jockey',\n'odds',\n'position_at_finish']","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.405982Z","iopub.execute_input":"2022-10-18T17:57:30.406456Z","iopub.status.idle":"2022-10-18T17:57:30.414399Z","shell.execute_reply.started":"2022-10-18T17:57:30.406411Z","shell.execute_reply":"2022-10-18T17:57:30.413128Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_complete.columns= complete_columns","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.415885Z","iopub.execute_input":"2022-10-18T17:57:30.416270Z","iopub.status.idle":"2022-10-18T17:57:30.431231Z","shell.execute_reply.started":"2022-10-18T17:57:30.416234Z","shell.execute_reply":"2022-10-18T17:57:30.429927Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_complete.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.432235Z","iopub.execute_input":"2022-10-18T17:57:30.432587Z","iopub.status.idle":"2022-10-18T17:57:30.459837Z","shell.execute_reply.started":"2022-10-18T17:57:30.432540Z","shell.execute_reply":"2022-10-18T17:57:30.458629Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_complete.isnull().sum()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:30.461252Z","iopub.execute_input":"2022-10-18T17:57:30.461626Z","iopub.status.idle":"2022-10-18T17:57:32.055318Z","shell.execute_reply.started":"2022-10-18T17:57:30.461589Z","shell.execute_reply":"2022-10-18T17:57:32.054110Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_complete.nunique()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:32.056757Z","iopub.execute_input":"2022-10-18T17:57:32.057103Z","iopub.status.idle":"2022-10-18T17:57:36.325857Z","shell.execute_reply.started":"2022-10-18T17:57:32.057071Z","shell.execute_reply":"2022-10-18T17:57:36.324652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_complete.describe(include='all')","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:36.327197Z","iopub.execute_input":"2022-10-18T17:57:36.327525Z","iopub.status.idle":"2022-10-18T17:57:41.307129Z","shell.execute_reply.started":"2022-10-18T17:57:36.327494Z","shell.execute_reply":"2022-10-18T17:57:41.305912Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.options.display.float_format = '{:.2f}'.format\n\nnyra_complete.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:41.308801Z","iopub.execute_input":"2022-10-18T17:57:41.309147Z","iopub.status.idle":"2022-10-18T17:57:41.328658Z","shell.execute_reply.started":"2022-10-18T17:57:41.309117Z","shell.execute_reply":"2022-10-18T17:57:41.327500Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_complete.describe(include='all')","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:41.330360Z","iopub.execute_input":"2022-10-18T17:57:41.330769Z","iopub.status.idle":"2022-10-18T17:57:46.276743Z","shell.execute_reply.started":"2022-10-18T17:57:41.330734Z","shell.execute_reply":"2022-10-18T17:57:46.275325Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import seaborn as sns\nimport matplotlib.pyplot as plt","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:46.277983Z","iopub.execute_input":"2022-10-18T17:57:46.278329Z","iopub.status.idle":"2022-10-18T17:57:46.940093Z","shell.execute_reply.started":"2022-10-18T17:57:46.278298Z","shell.execute_reply":"2022-10-18T17:57:46.938827Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,10))\n\nsns.boxplot(nyra_complete.groupby(\"jockey\").weight_carried.mean())","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:46.941403Z","iopub.execute_input":"2022-10-18T17:57:46.941782Z","iopub.status.idle":"2022-10-18T17:57:47.661839Z","shell.execute_reply.started":"2022-10-18T17:57:46.941747Z","shell.execute_reply":"2022-10-18T17:57:47.660721Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"weight_carried_kg = (nyra_complete.weight_carried)*.45","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:47.663243Z","iopub.execute_input":"2022-10-18T17:57:47.663980Z","iopub.status.idle":"2022-10-18T17:57:47.676002Z","shell.execute_reply.started":"2022-10-18T17:57:47.663941Z","shell.execute_reply":"2022-10-18T17:57:47.674625Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"raw","source":"","metadata":{}},{"cell_type":"code","source":"nyra_complete['weight_carried_kg'] = weight_carried_kg","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:47.677754Z","iopub.execute_input":"2022-10-18T17:57:47.678223Z","iopub.status.idle":"2022-10-18T17:57:47.693857Z","shell.execute_reply.started":"2022-10-18T17:57:47.678178Z","shell.execute_reply":"2022-10-18T17:57:47.692624Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_complete.head()","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:47.695439Z","iopub.execute_input":"2022-10-18T17:57:47.695919Z","iopub.status.idle":"2022-10-18T17:57:47.717649Z","shell.execute_reply.started":"2022-10-18T17:57:47.695872Z","shell.execute_reply":"2022-10-18T17:57:47.716502Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(15,10))\n\nsns.boxplot(nyra_complete.groupby(\"jockey\").weight_carried_kg.mean())","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:47.719423Z","iopub.execute_input":"2022-10-18T17:57:47.720117Z","iopub.status.idle":"2022-10-18T17:57:48.413933Z","shell.execute_reply.started":"2022-10-18T17:57:47.720078Z","shell.execute_reply":"2022-10-18T17:57:48.412430Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"nyra_complete.hist(alpha=.5, rwidth=1, ec='black', figsize=(20,15));\nplt.suptitle('Big Data Derby 2022', x=0.5, y=1, fontsize='xx-large');\nplt.ticklabel_format(style='plain', useOffset=True)","metadata":{"execution":{"iopub.status.busy":"2022-10-18T17:57:48.415614Z","iopub.execute_input":"2022-10-18T17:57:48.416080Z","iopub.status.idle":"2022-10-18T17:57:52.356939Z","shell.execute_reply.started":"2022-10-18T17:57:48.416036Z","shell.execute_reply":"2022-10-18T17:57:52.355652Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}