0% found this document useful (0 votes)
16 views8 pages

Hands On 1 Data Visualization

The document outlines a series of data visualization tasks using Python libraries such as pandas, seaborn, and matplotlib. It includes instructions for creating various plots, including bar plots, count plots, histograms, and scatter plots, to analyze cricket match data from a CSV file. The tasks focus on visualizing match statistics, team performances, and player metrics based on specific criteria.

Uploaded by

aditibansal0907
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views8 pages

Hands On 1 Data Visualization

The document outlines a series of data visualization tasks using Python libraries such as pandas, seaborn, and matplotlib. It includes instructions for creating various plots, including bar plots, count plots, histograms, and scatter plots, to analyze cricket match data from a CSV file. The tasks focus on visualizing match statistics, team performances, and player metrics based on specific criteria.

Uploaded by

aditibansal0907
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODT, PDF, TXT or read online on Scribd
You are on page 1/ 8

import pandas as pd

import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import matplotlib.cm as cm
import warnings
import datetime as dt
warnings.filterwarnings('ignore')

df_matches=pd.read_csv('matches.csv')

df_plot1 = df_matches.groupby('season')
['id'].count().reset_index(name='matches')

Draw a bar plot on the total number of matches across every season.
- use seaborn.barplot()

fig1,ax1=plt.subplots(figsize=(15,8))
###Start code here

#plt.scatter(df_plot1['season'], df_plot1['matches'])
df_plot1.plot(x='season', y=['matches'], kind='bar')
plt.xlabel('Season')
plt.ylabel('Matches')
plt.title('Total number of matches hosted season wise')
plt.show()
===============
Draw a count plot on the total number of games hosted in each
stadium

===================
Draw a bar plot on matches won by team batting first.
Hint - Here batting first means team who won the toss and chose to bat.
- use seaborn.barplot()
=================
Draw a histogram plot on runs scored by batsmen on each match with
respect to number of times
- Hint- For getting batsmen runs on each match sum batsmen runs with respect to match id.
===================
Draw a scatter plot on runs scored by batsmen on each match with
respect to balls faced .
- Minimum number of balls faced should be greater than 20

====================
Draw a scatter plot on strike rate progression of batsmen with respect
to balls faced .
- Along with this plot add two more line plots on the same plot representing minimum and
maximum strikerate progressions with respect to balls faced
- Formula for Strike Rate calculation - (Batsmen Runs per match / balls faced) * 100

===================
Draw a bar plot on strike rate of all batsmen having minimum runs of
2500 in overall Tournament .
=============
Draw a bar plot on average of all batsmen having minimum 2500 runs
in overall tournament .
- Formula for batsmen average- (batsmen runs per match / player dismissed)

===================
Draw a bar plot on Strike rate of top 10 innings by a batsman when
they score 100 in a particular match.¶
- Formula for Strike Rate calculation - (Batsmen Runs per match / balls faced) * 100
- Here kindly try using dataframe plotting.

==============
Draw a stacked bar plot on home city matches and wins for currently
playing 8 teams.
- Home Cities for the 8 teams are-
Teams City
-Mumbai Indians - Mumbai
-Chennai Super Kings - Chennai
-King XI Punjab - Chandigarh
-Rajasthan Royals - Jaipur
-Sunrisers Hyderabad - Hyderabad
-Royal Challengers Banglore - Banglore
-Kolkata Knight Riders - Kolkata
-Delhi Capitals - Delhi
from test_viz import viz_mod
viz_mod.save_answer(fig1,fig2,fig3,fig4,fig5,fig6,fig7,fig8,fig9,fig10)

You might also like