Skip to content

Instantly share code, notes, and snippets.

@aravindpai

aravindpai/cc_18.py

Last active Feb 19, 2020
Embed
What would you like to do?
num1=powerplay_batting_df.shape[0]/powerplay_batting_df['runs'].value_counts()[4]
num2=middle_batting_df.shape[0]/middle_batting_df['runs'].value_counts()[4]
num3=last_batting_df.shape[0]/last_batting_df['runs'].value_counts()[4]
x_axis = ['PP','Middle','Last']
y_axis = [num1, num2, num3]
dataframe= pd.DataFrame({'overs':x_axis,'4':y_axis})
num1=powerplay_batting_df.shape[0]/powerplay_batting_df['runs'].value_counts()[6]
num2=middle_batting_df.shape[0]/middle_batting_df['runs'].value_counts()[6]
num3=last_batting_df.shape[0]/last_batting_df['runs'].value_counts()[6]
dataframe['6'] = [num1,num2,num3]
data = {"4":dataframe['4'].values,
"6":dataframe['6'].values
};
index = dataframe['overs'].values
# Dictionary loaded into a DataFrame
dataFrame = pd.DataFrame(data=data, index=index);
# Draw a vertical bar chart
fig = dataFrame.plot.bar(rot=0, title="Avg no. of balls to score boundary(overs wise)",figsize=(10,8)).get_figure()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.