{"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":"import numpy as np\nimport pandas as pd\nimport seaborn as sns\nimport matplotlib as mpl\nimport matplotlib.pyplot as plt\n","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-10-06T21:22:01.683716Z","iopub.execute_input":"2021-10-06T21:22:01.684041Z","iopub.status.idle":"2021-10-06T21:22:02.628777Z","shell.execute_reply.started":"2021-10-06T21:22:01.683955Z","shell.execute_reply":"2021-10-06T21:22:02.627827Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Lets Talk about Games dataset and understand what actually it wanna to say.","metadata":{}},{"cell_type":"code","source":"games = pd.read_csv('../input/nfl-big-data-bowl-2022/games.csv')\ngames.head(5)","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:02.630366Z","iopub.execute_input":"2021-10-06T21:22:02.630804Z","iopub.status.idle":"2021-10-06T21:22:02.664299Z","shell.execute_reply.started":"2021-10-06T21:22:02.630764Z","shell.execute_reply":"2021-10-06T21:22:02.663385Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"**Description of Game Data** : Primary Key is gameId\n\n* **gameId**: Game identifier, unique (numeric)\n\n* **gameDate**: Game Date (time, mm/dd/yyyy)\n\n* **gameTimeEastern**: Start time of game (time, HH:MM:SS, EST)\n\n* **homeTeamAbbr**: Home team three-letter code (text)\n\n* **visitorTeamAbbr**: Visiting team three-letter code (text)\n\n* **week**: Week of game (numeric)","metadata":{}},{"cell_type":"code","source":"games.rename(columns={'gameId': 'gane_id', \n                     'homeTeamAbbr':'Home_team_sign',\n                     'visitorTeamAbbr':'Away_team_sign'\n                    }, inplace=True)\ngames.head()","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:02.665477Z","iopub.execute_input":"2021-10-06T21:22:02.665716Z","iopub.status.idle":"2021-10-06T21:22:02.683223Z","shell.execute_reply.started":"2021-10-06T21:22:02.665690Z","shell.execute_reply":"2021-10-06T21:22:02.682348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"games.tail(5)","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:02.685350Z","iopub.execute_input":"2021-10-06T21:22:02.686239Z","iopub.status.idle":"2021-10-06T21:22:02.705822Z","shell.execute_reply.started":"2021-10-06T21:22:02.686196Z","shell.execute_reply":"2021-10-06T21:22:02.704681Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"games.info()","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:02.706998Z","iopub.execute_input":"2021-10-06T21:22:02.707336Z","iopub.status.idle":"2021-10-06T21:22:02.737721Z","shell.execute_reply.started":"2021-10-06T21:22:02.707290Z","shell.execute_reply":"2021-10-06T21:22:02.736728Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"games.describe","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:02.739025Z","iopub.execute_input":"2021-10-06T21:22:02.739317Z","iopub.status.idle":"2021-10-06T21:22:02.758310Z","shell.execute_reply.started":"2021-10-06T21:22:02.739282Z","shell.execute_reply":"2021-10-06T21:22:02.757402Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Familiar with feature of Games dataframe.","metadata":{}},{"cell_type":"code","source":"games.shape","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:02.760066Z","iopub.execute_input":"2021-10-06T21:22:02.760463Z","iopub.status.idle":"2021-10-06T21:22:02.765725Z","shell.execute_reply.started":"2021-10-06T21:22:02.760429Z","shell.execute_reply":"2021-10-06T21:22:02.765034Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def Familiar_with_feature(data):\n    df=pd.DataFrame(data.dtypes, columns=['Data Type'])\n    df = df.reset_index()\n    df= df.rename(columns={'index ': 'features'})\n    df['Total Null'] = data.isnull().sum().values\n    df['Unique Values'] =data.nunique().values\n    df['First Value'] = data.iloc[0].values\n    df['Lasrt Values'] = data.iloc[len(data)-1].values\n    return df\n\nFamiliar_with_feature(games)","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:02.766712Z","iopub.execute_input":"2021-10-06T21:22:02.767227Z","iopub.status.idle":"2021-10-06T21:22:02.798402Z","shell.execute_reply.started":"2021-10-06T21:22:02.767192Z","shell.execute_reply":"2021-10-06T21:22:02.797389Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"It consists of 272 games, with each of the NFL's 32 teams playing 17 games during an 18-week period with one \"bye\" week off. Since 2012, the NFL generally schedules games in five time slots during the week","metadata":{}},{"cell_type":"code","source":"colors = ['gold','lightskyblue', 'green']\ngames['season'].value_counts().plot.pie(figsize=(10,14),colors=colors,shadow=True,explode=(0.2,0.1,0.2),autopct=\"%1.1f%%\")\nplt.title('Number of game playing for each season',fontsize=15)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:02.799688Z","iopub.execute_input":"2021-10-06T21:22:02.799902Z","iopub.status.idle":"2021-10-06T21:22:03.022208Z","shell.execute_reply.started":"2021-10-06T21:22:02.799877Z","shell.execute_reply":"2021-10-06T21:22:03.021306Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Basically, game start September and end on Januay, so in ","metadata":{}},{"cell_type":"code","source":"import plotly.express as px\ncheck = games['gameDate'].value_counts().reset_index()\n\ncheck.columns = [\n    'date', \n    'games'\n]\n\ncheck = check.sort_values('games')\n\nfig = px.bar(\n    check, \n    y='date', \n    x=\"games\", \n    orientation='h', \n    color='date',\n    title='Number of games for every date', \n    height=900, \n    width=800\n)\nfig.show()","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-10-06T21:22:03.025056Z","iopub.execute_input":"2021-10-06T21:22:03.025716Z","iopub.status.idle":"2021-10-06T21:22:06.437324Z","shell.execute_reply.started":"2021-10-06T21:22:03.025666Z","shell.execute_reply":"2021-10-06T21:22:06.436434Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import plotly.express as px\ncheck = games['week'].value_counts().reset_index()\n\ncheck.columns = [\n    'date', \n    'games'\n]\n\ncheck = check.sort_values('games')\n\nfig = px.bar(\n    check, \n    y='date', \n    x=\"games\", \n    orientation='h', \n    color='date',\n    text='games',\n    title='Number of games for per week', \n    height=900, \n    width=800\n)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:06.438521Z","iopub.execute_input":"2021-10-06T21:22:06.438785Z","iopub.status.idle":"2021-10-06T21:22:06.530380Z","shell.execute_reply.started":"2021-10-06T21:22:06.438752Z","shell.execute_reply":"2021-10-06T21:22:06.529535Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import plotly.express as px\ncheck = games['Home_team_sign'].value_counts().reset_index()\n\ncheck.columns = [\n    'date', \n    'games'\n]\n\ncheck = check.sort_values('games')\n\nfig = px.bar(\n    check, \n    y='date', \n    x=\"games\", \n    orientation='h', \n    color='date',\n    title='Number of home games', \n    text='games',\n    height=900, \n    width=800\n)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:06.531723Z","iopub.execute_input":"2021-10-06T21:22:06.532545Z","iopub.status.idle":"2021-10-06T21:22:06.747593Z","shell.execute_reply.started":"2021-10-06T21:22:06.532497Z","shell.execute_reply":"2021-10-06T21:22:06.746732Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import plotly.express as px\ncheck = games['Away_team_sign'].value_counts().reset_index()\n\ncheck.columns = [\n    'date', \n    'games'\n]\n\ncheck = check.sort_values('games')\n\nfig = px.bar(\n    check, \n    y='date', \n    x=\"games\", \n    orientation='h', \n    color='date',\n    title='Number of away games', \n    height=900, \n    width=800\n)\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2021-10-06T21:22:06.748973Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = px.line(check, x=\"games\", y=\"date\", \n              title=\"Game played increasing over the time\", \n              color_discrete_sequence=['#F61067'],\n              height=500\n             )\nfig.show()","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# **Still updating..... and please upvote if you like it.**","metadata":{}},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}