{"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":"# This notebook has cool visualizations of the data\n\n⚽ Note: If you found this helpful, please leave an upvote! Thanks in advance! ⚽","metadata":{}},{"cell_type":"markdown","source":"# Importing Libraries","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns","metadata":{"_uuid":"cebdb83b-ec83-4e01-8e6c-a88aaf15fc66","_cell_guid":"591a2aed-e71f-4878-9cfa-d6151cd77749","collapsed":false,"jupyter":{"outputs_hidden":false},"execution":{"iopub.status.busy":"2022-07-31T23:39:34.858556Z","iopub.execute_input":"2022-07-31T23:39:34.859058Z","iopub.status.idle":"2022-07-31T23:39:35.597126Z","shell.execute_reply.started":"2022-07-31T23:39:34.858932Z","shell.execute_reply":"2022-07-31T23:39:35.596086Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Reading Data and EDA","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv('../input/dfl-bundesliga-data-shootout/train.csv')","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:39:35.599856Z","iopub.execute_input":"2022-07-31T23:39:35.600376Z","iopub.status.idle":"2022-07-31T23:39:35.634689Z","shell.execute_reply.started":"2022-07-31T23:39:35.600331Z","shell.execute_reply":"2022-07-31T23:39:35.633566Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.head()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:39:35.636160Z","iopub.execute_input":"2022-07-31T23:39:35.636492Z","iopub.status.idle":"2022-07-31T23:39:35.660650Z","shell.execute_reply.started":"2022-07-31T23:39:35.636462Z","shell.execute_reply":"2022-07-31T23:39:35.659402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df.isna().sum()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:39:35.662260Z","iopub.execute_input":"2022-07-31T23:39:35.662699Z","iopub.status.idle":"2022-07-31T23:39:35.677156Z","shell.execute_reply.started":"2022-07-31T23:39:35.662664Z","shell.execute_reply":"2022-07-31T23:39:35.676115Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(8,6), dpi=100)\nplt.title('Histogram of the Time Column')\nsns.histplot(df['time'], bins=30, kde=True)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:39:35.680333Z","iopub.execute_input":"2022-07-31T23:39:35.681238Z","iopub.status.idle":"2022-07-31T23:39:36.103440Z","shell.execute_reply.started":"2022-07-31T23:39:35.681191Z","shell.execute_reply":"2022-07-31T23:39:36.102189Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['event'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:39:36.105128Z","iopub.execute_input":"2022-07-31T23:39:36.105592Z","iopub.status.idle":"2022-07-31T23:39:36.119690Z","shell.execute_reply.started":"2022-07-31T23:39:36.105546Z","shell.execute_reply":"2022-07-31T23:39:36.118399Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(8,6), dpi=100)\nplt.title('Counting the number of occurences per event')\nsns.countplot(x=df['event'], order=['play', 'start', 'end', 'challenge', 'throwin'], palette='viridis')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:39:36.122331Z","iopub.execute_input":"2022-07-31T23:39:36.122826Z","iopub.status.idle":"2022-07-31T23:39:36.318823Z","shell.execute_reply.started":"2022-07-31T23:39:36.122775Z","shell.execute_reply":"2022-07-31T23:39:36.317635Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(10,7), dpi=100)\nplt.xticks(rotation=90)\nsns.countplot(data=df, x='video_id', hue='event', hue_order=['play', 'start', 'end', 'challenge', 'throwin'], palette='inferno')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:39:36.320330Z","iopub.execute_input":"2022-07-31T23:39:36.320802Z","iopub.status.idle":"2022-07-31T23:39:36.840201Z","shell.execute_reply.started":"2022-07-31T23:39:36.320757Z","shell.execute_reply":"2022-07-31T23:39:36.839087Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(8,6), dpi=100)\nplt.title('Pie Chart of Fraction of Datapoints per Video')\nplt.pie(df['video_id'].value_counts(), labels=df['video_id'].unique(), startangle=90, colors=['#ff0000', '#ff8000', '#ffc000', '#ffff00', '#c0ff00', '#00ff00', '#00ffff', '#0080ff', '#0000ff', '#8000ff', '#ff00ff', '#ff0080'])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:39:36.841598Z","iopub.execute_input":"2022-07-31T23:39:36.841968Z","iopub.status.idle":"2022-07-31T23:39:37.080652Z","shell.execute_reply.started":"2022-07-31T23:39:36.841934Z","shell.execute_reply":"2022-07-31T23:39:37.079256Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df['event_attributes'].value_counts()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:40:01.943313Z","iopub.execute_input":"2022-07-31T23:40:01.943857Z","iopub.status.idle":"2022-07-31T23:40:01.956048Z","shell.execute_reply.started":"2022-07-31T23:40:01.943802Z","shell.execute_reply":"2022-07-31T23:40:01.954861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"plt.figure(figsize=(12,8), dpi=100)\nplt.xticks(rotation=90)\nplt.title('Countplot of Event Attributes Column')\nsns.countplot(x=df['event_attributes'])\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:43:04.057917Z","iopub.execute_input":"2022-07-31T23:43:04.058344Z","iopub.status.idle":"2022-07-31T23:43:04.421759Z","shell.execute_reply.started":"2022-07-31T23:43:04.058310Z","shell.execute_reply":"2022-07-31T23:43:04.420856Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for event in df['event'].unique():\n    if event not in ['start', 'end']:\n        plt.figure(figsize=(9,6), dpi=100)\n        plt.xticks(rotation=90)\n        plt.title(f'Countplot of {event.title()} Attributes Column')\n        sns.countplot(data=df[df['event']==event].reset_index(), x='event_attributes')\n        plt.show()","metadata":{"execution":{"iopub.status.busy":"2022-07-31T23:50:26.378835Z","iopub.execute_input":"2022-07-31T23:50:26.379766Z","iopub.status.idle":"2022-07-31T23:50:27.097156Z","shell.execute_reply.started":"2022-07-31T23:50:26.379712Z","shell.execute_reply":"2022-07-31T23:50:27.096196Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Submission","metadata":{}},{"cell_type":"code","source":"sub = pd.read_csv('../input/dfl-bundesliga-data-shootout/sample_submission.csv')\nsub.to_csv('submission.csv')","metadata":{},"execution_count":null,"outputs":[]}]}