# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import tensorflow as tf
import keras
import numpy as np
import pandas as pd

nRowsRead = 194354 # specify 'None' if want to read whole file
# deliveries.csv has 150460 rows in reality, but we are only loading/previewing the first 1000 rows
df = pd.read_csv('all_matches.csv', delimiter=',', nrows = nRowsRead)
df.dataframeName = 'deliveries.csv'
nRow, nCol = df.shape
print(f'There are {nRow} rows and {nCol} columns')

df.head(10)

from mpl_toolkits.mplot3d import Axes3D
from sklearn.preprocessing import StandardScaler
import matplotlib.pyplot as plt # plotting
import os # accessing directory structure

df.info()

df.isnull().sum()

s = pd.value_counts(df['wides'])
s1 = pd.Series({'nunique': len(s), 'unique values': s.index.tolist()})
s.append(s1)

s = pd.value_counts(df['noballs'])
s1 = pd.Series({'nunique': len(s), 'unique values': s.index.tolist()})
s.append(s1)

s = pd.value_counts(df['byes'])
s1 = pd.Series({'nunique': len(s), 'unique values': s.index.tolist()})
s.append(s1)

s = pd.value_counts(df['legbyes'])
s1 = pd.Series({'nunique': len(s), 'unique values': s.index.tolist()})
s.append(s1)

s = pd.value_counts(df['penalty'])
s1 = pd.Series({'nunique': len(s), 'unique values': s.index.tolist()})
s.append(s1)

s = pd.value_counts(df['wicket_type'])
s1 = pd.Series({'nunique': len(s), 'unique values': s.index.tolist()})
s.append(s1)

#player_dismissed
s = pd.value_counts(df['player_dismissed'])
s1 = pd.Series({'nunique': len(s), 'unique values': s.index.tolist()})
s.append(s1)

#other_wicket_type
s = pd.value_counts(df['other_wicket_type'])
s1 = pd.Series({'nunique': len(s), 'unique values': s.index.tolist()})
s.append(s1)

#other_player_dismissed
s = pd.value_counts(df['other_player_dismissed'])
s1 = pd.Series({'nunique': len(s), 'unique values': s.index.tolist()})
s.append(s1)

import seaborn as sns
plt.rcParams['figure.figsize']=70,54
sns.countplot(x=df['striker'], hue='extras', data=df, linewidth=7, palette = "Set2")
plt.ylabel('Number of matches')
plt.xticks(rotation=90)
plt.xlabel('striker')
plt.title('striker V/s extras',size=50, fontweight="bold")

sns.countplot(x=df['season'], hue='extras', data=df, linewidth=7, palette = "Set2")
plt.ylabel('Number of matches')
plt.xticks(rotation=90)
plt.xlabel('year')
plt.title('Season V/s extras',size=50, fontweight="bold")

sns.countplot(x=df['season'], hue='wides', data=df, linewidth=7, palette = "Set2")
plt.ylabel('Number of matches')
plt.xticks(rotation=90)
plt.xlabel('year')
plt.title('Season V/s Wides',size=50, fontweight="bold")

sns.countplot(x=df['season'], hue='legbyes', data=df, linewidth=7, palette = "Set2")
plt.ylabel('Number of matches')
plt.xticks(rotation=90)
plt.xlabel('year')
plt.title('Season V/s legbyes',size=50, fontweight="bold")

sns.countplot(x=df['season'], hue='byes', data=df, linewidth=7, palette = "Set2")
plt.ylabel('Number of matches')
plt.xticks(rotation=90)
plt.xlabel('year')
plt.title('Season V/s byes',size=50, fontweight="bold")



StarcoderdataJupyterScriptsDedupFiltered