{"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":"**As part of this notebook, we are using matplotlob library to understand the Rocket League competition data.**","metadata":{}},{"cell_type":"code","source":"import numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport os\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport plotly.express as px\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-10-06T05:46:51.736495Z","iopub.execute_input":"2022-10-06T05:46:51.736997Z","iopub.status.idle":"2022-10-06T05:46:54.120525Z","shell.execute_reply.started":"2022-10-06T05:46:51.736894Z","shell.execute_reply":"2022-10-06T05:46:54.119527Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dtypes = pd.read_csv(\"../input/tabular-playground-series-oct-2022/train_dtypes.csv\")\ntrain_data = pd.read_csv(\"../input/tabular-playground-series-oct-2022/train_5.csv\")","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:46:54.122367Z","iopub.execute_input":"2022-10-06T05:46:54.123048Z","iopub.status.idle":"2022-10-06T05:47:22.927169Z","shell.execute_reply.started":"2022-10-06T05:46:54.123006Z","shell.execute_reply":"2022-10-06T05:47:22.926171Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dtypes","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:47:22.932527Z","iopub.execute_input":"2022-10-06T05:47:22.935326Z","iopub.status.idle":"2022-10-06T05:47:22.964586Z","shell.execute_reply.started":"2022-10-06T05:47:22.935288Z","shell.execute_reply":"2022-10-06T05:47:22.963337Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"dtypes.dtype.value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:47:22.970324Z","iopub.execute_input":"2022-10-06T05:47:22.973108Z","iopub.status.idle":"2022-10-06T05:47:22.990075Z","shell.execute_reply.started":"2022-10-06T05:47:22.973071Z","shell.execute_reply":"2022-10-06T05:47:22.988820Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"We have 61 columns in our dataset, out of which 60 are numerical, one is categorical column name--> team_scoring_next","metadata":{}},{"cell_type":"markdown","source":"# Let's visualize the data! For visualization we are using train_5.csv.","metadata":{}},{"cell_type":"code","source":"fig = sns.histplot(train_data,x='ball_pos_x')\n","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:47:22.994215Z","iopub.execute_input":"2022-10-06T05:47:22.996598Z","iopub.status.idle":"2022-10-06T05:47:24.037380Z","shell.execute_reply.started":"2022-10-06T05:47:22.996558Z","shell.execute_reply":"2022-10-06T05:47:24.036449Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = sns.histplot(train_data,x='ball_pos_y')\n","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:47:24.038843Z","iopub.execute_input":"2022-10-06T05:47:24.040824Z","iopub.status.idle":"2022-10-06T05:47:24.729226Z","shell.execute_reply.started":"2022-10-06T05:47:24.040784Z","shell.execute_reply":"2022-10-06T05:47:24.728308Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = sns.histplot(train_data,x='ball_pos_z')","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:47:24.731324Z","iopub.execute_input":"2022-10-06T05:47:24.732014Z","iopub.status.idle":"2022-10-06T05:47:25.447959Z","shell.execute_reply.started":"2022-10-06T05:47:24.731975Z","shell.execute_reply":"2022-10-06T05:47:25.447002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Insights:\n\nOn the X and Y axis, mode is 0. As highlighted by other kernels, this could be because the ball is centered at 0,0 location after every goal is scored. \n\nOn the Z axis, the data is right skewed","metadata":{}},{"cell_type":"markdown","source":"# Viewing the ball position on a 3D frame.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure()\nax = fig.add_subplot(projection='3d')\nax.plot(train_data.ball_pos_x,train_data.ball_pos_y,train_data.ball_pos_z)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:50:24.338445Z","iopub.execute_input":"2022-10-06T05:50:24.338850Z","iopub.status.idle":"2022-10-06T05:50:27.538707Z","shell.execute_reply.started":"2022-10-06T05:50:24.338816Z","shell.execute_reply":"2022-10-06T05:50:27.537584Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = sns.histplot(train_data,x='ball_vel_x')\n","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:47:25.449588Z","iopub.execute_input":"2022-10-06T05:47:25.450001Z","iopub.status.idle":"2022-10-06T05:47:26.597824Z","shell.execute_reply.started":"2022-10-06T05:47:25.449946Z","shell.execute_reply":"2022-10-06T05:47:26.596912Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = sns.histplot(train_data,x='ball_vel_y')\n","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:47:26.599383Z","iopub.execute_input":"2022-10-06T05:47:26.599756Z","iopub.status.idle":"2022-10-06T05:47:27.653995Z","shell.execute_reply.started":"2022-10-06T05:47:26.599719Z","shell.execute_reply":"2022-10-06T05:47:27.652997Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = sns.histplot(train_data,x='ball_vel_z')\n","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:47:27.657032Z","iopub.execute_input":"2022-10-06T05:47:27.657962Z","iopub.status.idle":"2022-10-06T05:47:29.040006Z","shell.execute_reply.started":"2022-10-06T05:47:27.657924Z","shell.execute_reply":"2022-10-06T05:47:29.038906Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Insights:\n\nThe ball velocity on the X axis follows a somewhat normal distribution with the peak at 0.\n\nIn all the three graphs above we can see the peak velocity to be at 0.\n","metadata":{}},{"cell_type":"markdown","source":"# Visualizing the velocity data from a 3D viewpoint","metadata":{}},{"cell_type":"code","source":"fig = plt.figure()\nax = fig.add_subplot(projection='3d')\nax.plot(train_data.ball_vel_x,train_data.ball_vel_y,train_data.ball_vel_z)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:48:45.384981Z","iopub.execute_input":"2022-10-06T05:48:45.386159Z","iopub.status.idle":"2022-10-06T05:48:48.081826Z","shell.execute_reply.started":"2022-10-06T05:48:45.386091Z","shell.execute_reply":"2022-10-06T05:48:48.080701Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Next we look at the player's position and velocity across the game field.","metadata":{}},{"cell_type":"markdown","source":"We plot 3D graphs of players 1, 2 and 3 which comprise of Team A.","metadata":{}},{"cell_type":"code","source":"fig = plt.figure()\nax = fig.add_subplot(131,projection='3d')\nax.plot(train_data.p0_pos_x,train_data.p0_pos_y,train_data.p0_pos_z)\nax1 = fig.add_subplot(132,projection='3d')\nax.plot(train_data.p1_pos_x,train_data.p1_pos_y,train_data.p1_pos_z)\nax = fig.add_subplot(133,projection='3d')\nax.plot(train_data.p2_pos_x,train_data.p2_pos_y,train_data.p2_pos_z)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-06T05:59:26.595576Z","iopub.execute_input":"2022-10-06T05:59:26.595996Z","iopub.status.idle":"2022-10-06T05:59:31.061986Z","shell.execute_reply.started":"2022-10-06T05:59:26.595960Z","shell.execute_reply":"2022-10-06T05:59:31.061033Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = plt.figure()\nax = fig.add_subplot(131,projection='3d')\nax.plot(train_data.p3_pos_x,train_data.p3_pos_y,train_data.p3_pos_z)\nax1 = fig.add_subplot(132,projection='3d')\nax.plot(train_data.p4_pos_x,train_data.p4_pos_y,train_data.p4_pos_z)\nax = fig.add_subplot(133,projection='3d')\nax.plot(train_data.p5_pos_x,train_data.p5_pos_y,train_data.p5_pos_z)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-06T06:01:03.346206Z","iopub.execute_input":"2022-10-06T06:01:03.346925Z","iopub.status.idle":"2022-10-06T06:01:07.782050Z","shell.execute_reply.started":"2022-10-06T06:01:03.346889Z","shell.execute_reply":"2022-10-06T06:01:07.780916Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = plt.figure()\nax = fig.add_subplot(131,projection='3d')\nax.plot(train_data.p0_vel_x,train_data.p0_vel_y,train_data.p0_vel_z)\nax1 = fig.add_subplot(132,projection='3d')\nax.plot(train_data.p1_vel_x,train_data.p1_vel_y,train_data.p1_vel_z)\nax = fig.add_subplot(133,projection='3d')\nax.plot(train_data.p2_vel_x,train_data.p2_vel_y,train_data.p2_vel_z)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-06T06:02:17.985867Z","iopub.execute_input":"2022-10-06T06:02:17.986257Z","iopub.status.idle":"2022-10-06T06:02:25.424019Z","shell.execute_reply.started":"2022-10-06T06:02:17.986225Z","shell.execute_reply":"2022-10-06T06:02:25.421879Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = plt.figure()\nax = fig.add_subplot(131,projection='3d')\nax.plot(train_data.p3_vel_x,train_data.p3_vel_y,train_data.p3_vel_z)\nax1 = fig.add_subplot(132,projection='3d')\nax.plot(train_data.p4_vel_x,train_data.p4_vel_y,train_data.p4_vel_z)\nax = fig.add_subplot(133,projection='3d')\nax.plot(train_data.p5_vel_x,train_data.p5_vel_y,train_data.p5_vel_z)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-06T06:04:03.747152Z","iopub.execute_input":"2022-10-06T06:04:03.747794Z","iopub.status.idle":"2022-10-06T06:04:10.812780Z","shell.execute_reply.started":"2022-10-06T06:04:03.747754Z","shell.execute_reply":"2022-10-06T06:04:10.811787Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Insights:\n\nThe velocity of the players seem to be the highest near the center of the field and concentrated in the same area, wheras position of the players takes up the entire field area.\n\nPlayer 1 and 4 seem to have NaN values, as stated by the competition it seems that the players have been demolished.","metadata":{}},{"cell_type":"markdown","source":"","metadata":{}},{"cell_type":"code","source":"px.histogram(train_data,x = 'player_scoring_next')","metadata":{"execution":{"iopub.status.busy":"2022-10-06T06:10:21.562568Z","iopub.execute_input":"2022-10-06T06:10:21.562926Z","iopub.status.idle":"2022-10-06T06:10:22.556608Z","shell.execute_reply.started":"2022-10-06T06:10:21.562895Z","shell.execute_reply":"2022-10-06T06:10:22.555347Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Insights:\n\nMost of the times, the match ends with no goals being made.\n\nOut of all the players, player 1 seems to be making the most number of goals.","metadata":{}},{"cell_type":"code","source":"px.histogram(train_data,x = 'team_scoring_next')","metadata":{"execution":{"iopub.status.busy":"2022-10-06T06:12:12.844181Z","iopub.execute_input":"2022-10-06T06:12:12.845163Z","iopub.status.idle":"2022-10-06T06:12:19.552060Z","shell.execute_reply.started":"2022-10-06T06:12:12.845090Z","shell.execute_reply":"2022-10-06T06:12:19.551057Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"As part of this event it seems team A has made more goals than team B.","metadata":{}},{"cell_type":"code","source":"def plot_boost(i):\n    column_name = 'p'+str(i)+'_boost'\n    fig = px.histogram(train_data,x = column_name)\n    fig.show()\nplot_boost(0)","metadata":{"execution":{"iopub.status.busy":"2022-10-06T06:17:24.462518Z","iopub.execute_input":"2022-10-06T06:17:24.462907Z","iopub.status.idle":"2022-10-06T06:17:24.893980Z","shell.execute_reply.started":"2022-10-06T06:17:24.462877Z","shell.execute_reply":"2022-10-06T06:17:24.891980Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_boost(1)","metadata":{"execution":{"iopub.status.busy":"2022-10-06T06:17:36.829494Z","iopub.execute_input":"2022-10-06T06:17:36.829873Z","iopub.status.idle":"2022-10-06T06:17:37.263217Z","shell.execute_reply.started":"2022-10-06T06:17:36.829843Z","shell.execute_reply":"2022-10-06T06:17:37.262174Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plot_boost(2)","metadata":{"execution":{"iopub.status.busy":"2022-10-06T06:17:54.004812Z","iopub.execute_input":"2022-10-06T06:17:54.005193Z","iopub.status.idle":"2022-10-06T06:17:54.437715Z","shell.execute_reply.started":"2022-10-06T06:17:54.005161Z","shell.execute_reply":"2022-10-06T06:17:54.435731Z"},"trusted":true},"execution_count":null,"outputs":[]}]}