{"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":"markdown","source":"First we call the libraries that we will work on\n","metadata":{}},{"cell_type":"code","source":"import pandas as pd\t\nimport numpy as np \t\nimport seaborn as sns\t\nimport matplotlib.pyplot as plt\t\n%matplotlib inline\t\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:34.716507Z","iopub.execute_input":"2023-04-15T13:02:34.716955Z","iopub.status.idle":"2023-04-15T13:02:34.724742Z","shell.execute_reply.started":"2023-04-15T13:02:34.716923Z","shell.execute_reply":"2023-04-15T13:02:34.723640Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Read data files","metadata":{}},{"cell_type":"code","source":"df=pd.read_csv('../input/big-data-derby-2022/nyra_race_table.csv')\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:34.728177Z","iopub.execute_input":"2023-04-15T13:02:34.728555Z","iopub.status.idle":"2023-04-15T13:02:34.748724Z","shell.execute_reply.started":"2023-04-15T13:02:34.728524Z","shell.execute_reply":"2023-04-15T13:02:34.747421Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1=pd.read_csv('../input/big-data-derby-2022/nyra_start_table.csv')\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:34.750541Z","iopub.execute_input":"2023-04-15T13:02:34.751613Z","iopub.status.idle":"2023-04-15T13:02:34.772160Z","shell.execute_reply.started":"2023-04-15T13:02:34.751569Z","shell.execute_reply":"2023-04-15T13:02:34.770680Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2=pd.read_csv('../input/big-data-derby-2022/nyra_tracking_table.csv')\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:34.774168Z","iopub.execute_input":"2023-04-15T13:02:34.774587Z","iopub.status.idle":"2023-04-15T13:02:39.168729Z","shell.execute_reply.started":"2023-04-15T13:02:34.774550Z","shell.execute_reply":"2023-04-15T13:02:39.167420Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"We read the first rows\n","metadata":{}},{"cell_type":"code","source":"df.head()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.171512Z","iopub.execute_input":"2023-04-15T13:02:39.171888Z","iopub.status.idle":"2023-04-15T13:02:39.191592Z","shell.execute_reply.started":"2023-04-15T13:02:39.171858Z","shell.execute_reply":"2023-04-15T13:02:39.190368Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1.head()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.193109Z","iopub.execute_input":"2023-04-15T13:02:39.194271Z","iopub.status.idle":"2023-04-15T13:02:39.211193Z","shell.execute_reply.started":"2023-04-15T13:02:39.194230Z","shell.execute_reply":"2023-04-15T13:02:39.210327Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2.head()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.212759Z","iopub.execute_input":"2023-04-15T13:02:39.213433Z","iopub.status.idle":"2023-04-15T13:02:39.229714Z","shell.execute_reply.started":"2023-04-15T13:02:39.213387Z","shell.execute_reply":"2023-04-15T13:02:39.228887Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Review the number of columns and rows","metadata":{}},{"cell_type":"code","source":"df.shape\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.231103Z","iopub.execute_input":"2023-04-15T13:02:39.231778Z","iopub.status.idle":"2023-04-15T13:02:39.243463Z","shell.execute_reply.started":"2023-04-15T13:02:39.231742Z","shell.execute_reply":"2023-04-15T13:02:39.242247Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1.shape\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.248073Z","iopub.execute_input":"2023-04-15T13:02:39.249197Z","iopub.status.idle":"2023-04-15T13:02:39.257849Z","shell.execute_reply.started":"2023-04-15T13:02:39.249156Z","shell.execute_reply":"2023-04-15T13:02:39.256949Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2.shape\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.259068Z","iopub.execute_input":"2023-04-15T13:02:39.259617Z","iopub.status.idle":"2023-04-15T13:02:39.270304Z","shell.execute_reply.started":"2023-04-15T13:02:39.259581Z","shell.execute_reply":"2023-04-15T13:02:39.269103Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.dtypes\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.272572Z","iopub.execute_input":"2023-04-15T13:02:39.273440Z","iopub.status.idle":"2023-04-15T13:02:39.285761Z","shell.execute_reply.started":"2023-04-15T13:02:39.273391Z","shell.execute_reply":"2023-04-15T13:02:39.284409Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1.dtypes\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.287617Z","iopub.execute_input":"2023-04-15T13:02:39.288406Z","iopub.status.idle":"2023-04-15T13:02:39.300604Z","shell.execute_reply.started":"2023-04-15T13:02:39.288357Z","shell.execute_reply":"2023-04-15T13:02:39.299564Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2.dtypes\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.302049Z","iopub.execute_input":"2023-04-15T13:02:39.303552Z","iopub.status.idle":"2023-04-15T13:02:39.315442Z","shell.execute_reply.started":"2023-04-15T13:02:39.303459Z","shell.execute_reply":"2023-04-15T13:02:39.314414Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"We review data quality\nIs there missing data?","metadata":{}},{"cell_type":"code","source":"df.isnull().sum()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.317347Z","iopub.execute_input":"2023-04-15T13:02:39.318193Z","iopub.status.idle":"2023-04-15T13:02:39.328694Z","shell.execute_reply.started":"2023-04-15T13:02:39.318153Z","shell.execute_reply":"2023-04-15T13:02:39.327637Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1.isnull().sum()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.329775Z","iopub.execute_input":"2023-04-15T13:02:39.330859Z","iopub.status.idle":"2023-04-15T13:02:39.343815Z","shell.execute_reply.started":"2023-04-15T13:02:39.330825Z","shell.execute_reply":"2023-04-15T13:02:39.342441Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2.isnull().sum()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:39.345217Z","iopub.execute_input":"2023-04-15T13:02:39.345608Z","iopub.status.idle":"2023-04-15T13:02:40.047809Z","shell.execute_reply.started":"2023-04-15T13:02:39.345576Z","shell.execute_reply":"2023-04-15T13:02:40.046557Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"data information","metadata":{}},{"cell_type":"code","source":"df.info()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:40.049397Z","iopub.execute_input":"2023-04-15T13:02:40.049750Z","iopub.status.idle":"2023-04-15T13:02:40.065237Z","shell.execute_reply.started":"2023-04-15T13:02:40.049719Z","shell.execute_reply":"2023-04-15T13:02:40.063979Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1.info()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:40.066966Z","iopub.execute_input":"2023-04-15T13:02:40.067352Z","iopub.status.idle":"2023-04-15T13:02:40.086857Z","shell.execute_reply.started":"2023-04-15T13:02:40.067291Z","shell.execute_reply":"2023-04-15T13:02:40.085587Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2.info()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:40.088484Z","iopub.execute_input":"2023-04-15T13:02:40.088848Z","iopub.status.idle":"2023-04-15T13:02:40.104550Z","shell.execute_reply.started":"2023-04-15T13:02:40.088802Z","shell.execute_reply":"2023-04-15T13:02:40.103056Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"data description\n","metadata":{}},{"cell_type":"code","source":"df.describe()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:40.105879Z","iopub.execute_input":"2023-04-15T13:02:40.106250Z","iopub.status.idle":"2023-04-15T13:02:40.138056Z","shell.execute_reply.started":"2023-04-15T13:02:40.106215Z","shell.execute_reply":"2023-04-15T13:02:40.136861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df1.describe()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:40.143097Z","iopub.execute_input":"2023-04-15T13:02:40.143484Z","iopub.status.idle":"2023-04-15T13:02:40.171867Z","shell.execute_reply.started":"2023-04-15T13:02:40.143452Z","shell.execute_reply":"2023-04-15T13:02:40.170598Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2.describe()\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:40.173239Z","iopub.execute_input":"2023-04-15T13:02:40.173573Z","iopub.status.idle":"2023-04-15T13:02:40.932885Z","shell.execute_reply.started":"2023-04-15T13:02:40.173543Z","shell.execute_reply":"2023-04-15T13:02:40.931653Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Are there single values?","metadata":{}},{"cell_type":"code","source":"c=df.corr()","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:40.934415Z","iopub.execute_input":"2023-04-15T13:02:40.934757Z","iopub.status.idle":"2023-04-15T13:02:40.940799Z","shell.execute_reply.started":"2023-04-15T13:02:40.934725Z","shell.execute_reply":"2023-04-15T13:02:40.939830Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(c)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:40.941874Z","iopub.execute_input":"2023-04-15T13:02:40.942274Z","iopub.status.idle":"2023-04-15T13:02:40.958522Z","shell.execute_reply.started":"2023-04-15T13:02:40.942240Z","shell.execute_reply":"2023-04-15T13:02:40.957270Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(c)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:40.959882Z","iopub.execute_input":"2023-04-15T13:02:40.960229Z","iopub.status.idle":"2023-04-15T13:02:41.283243Z","shell.execute_reply.started":"2023-04-15T13:02:40.960199Z","shell.execute_reply":"2023-04-15T13:02:41.282035Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(c,annot=True)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:41.284723Z","iopub.execute_input":"2023-04-15T13:02:41.285093Z","iopub.status.idle":"2023-04-15T13:02:41.659059Z","shell.execute_reply.started":"2023-04-15T13:02:41.285058Z","shell.execute_reply":"2023-04-15T13:02:41.657639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.pairplot(df)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:41.660446Z","iopub.execute_input":"2023-04-15T13:02:41.660794Z","iopub.status.idle":"2023-04-15T13:02:47.666173Z","shell.execute_reply.started":"2023-04-15T13:02:41.660763Z","shell.execute_reply":"2023-04-15T13:02:47.664857Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c=df1.corr()","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:47.667860Z","iopub.execute_input":"2023-04-15T13:02:47.668286Z","iopub.status.idle":"2023-04-15T13:02:47.675807Z","shell.execute_reply.started":"2023-04-15T13:02:47.668248Z","shell.execute_reply":"2023-04-15T13:02:47.674511Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(c)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:47.677698Z","iopub.execute_input":"2023-04-15T13:02:47.678193Z","iopub.status.idle":"2023-04-15T13:02:47.690666Z","shell.execute_reply.started":"2023-04-15T13:02:47.678146Z","shell.execute_reply":"2023-04-15T13:02:47.689466Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(c)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:47.692366Z","iopub.execute_input":"2023-04-15T13:02:47.692850Z","iopub.status.idle":"2023-04-15T13:02:47.990129Z","shell.execute_reply.started":"2023-04-15T13:02:47.692804Z","shell.execute_reply":"2023-04-15T13:02:47.988692Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(c,annot=True)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:47.993510Z","iopub.execute_input":"2023-04-15T13:02:47.994050Z","iopub.status.idle":"2023-04-15T13:02:48.339998Z","shell.execute_reply.started":"2023-04-15T13:02:47.994001Z","shell.execute_reply":"2023-04-15T13:02:48.338496Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.pairplot(df1)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:48.341917Z","iopub.execute_input":"2023-04-15T13:02:48.342847Z","iopub.status.idle":"2023-04-15T13:02:53.638388Z","shell.execute_reply.started":"2023-04-15T13:02:48.342802Z","shell.execute_reply":"2023-04-15T13:02:53.637121Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c=df2.corr()","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:53.640123Z","iopub.execute_input":"2023-04-15T13:02:53.640917Z","iopub.status.idle":"2023-04-15T13:02:54.037916Z","shell.execute_reply.started":"2023-04-15T13:02:53.640879Z","shell.execute_reply":"2023-04-15T13:02:54.036468Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(c)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:54.039669Z","iopub.execute_input":"2023-04-15T13:02:54.040073Z","iopub.status.idle":"2023-04-15T13:02:54.050924Z","shell.execute_reply.started":"2023-04-15T13:02:54.040038Z","shell.execute_reply":"2023-04-15T13:02:54.049433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(c)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:54.052510Z","iopub.execute_input":"2023-04-15T13:02:54.052909Z","iopub.status.idle":"2023-04-15T13:02:54.363052Z","shell.execute_reply.started":"2023-04-15T13:02:54.052873Z","shell.execute_reply":"2023-04-15T13:02:54.361784Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.heatmap(c,annot=True)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:54.366122Z","iopub.execute_input":"2023-04-15T13:02:54.366544Z","iopub.status.idle":"2023-04-15T13:02:54.710227Z","shell.execute_reply.started":"2023-04-15T13:02:54.366507Z","shell.execute_reply":"2023-04-15T13:02:54.708994Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sns.pairplot(df2)\n","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:02:54.711847Z","iopub.execute_input":"2023-04-15T13:02:54.713060Z","iopub.status.idle":"2023-04-15T13:06:54.069961Z","shell.execute_reply.started":"2023-04-15T13:02:54.713011Z","shell.execute_reply":"2023-04-15T13:06:54.068423Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.to_csv(\"submission.csv\",index=False)","metadata":{"execution":{"iopub.status.busy":"2023-04-15T13:06:54.071683Z","iopub.execute_input":"2023-04-15T13:06:54.072074Z","iopub.status.idle":"2023-04-15T13:06:54.084719Z","shell.execute_reply.started":"2023-04-15T13:06:54.072038Z","shell.execute_reply":"2023-04-15T13:06:54.083421Z"},"trusted":true},"execution_count":null,"outputs":[]}]}