Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

schetudiante/Python_For_Data_Analysis

Open more actions menu
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

##PYTHON FINAL PROJECT

IPL Data Analysis

vivo-ipl-2016-logos

Content:

  • Introduction about data

  • Pre-processing steps

  • Analysis 1 : Season wise wins for each team at different venue

  • Result : Stacked Bar Chart

  • Analysis 2 : Toss Impact on different teams across seasons

  • Result : Grouped Bar Plot

  • Analysis 3a : Teams handling their nerves successfully

  • Result : Bar Plot

  • Analysis 3b : Teams dominating their opposition

  • Result : Bar Plot

  • Analysis 4 : Top 5 batsman performances across seasons

  • Result : Point Plot Chart

  • Analysis 5 : Dynamic Player Comparison against runs scored, strike rate

  • Result : Grouped Bar Chart

Introduction


  • Raw data is collected from http://cricsheet.org/
  • Raw data consists of 2 files matches.csv & deliveries.csv
  • Matches.csv consists of following columns & data for all 577 matches held till date:

####Matches.csv matches

  • Deliveries.csv consists of following columns & ball by ball data for each match held till date:

####Deliveries.csv deliveries

  • Sample code to read csv data into a data frame.
sample code:
path = "C:/PYTHON/pythonFinalProject/rawDataPythonIPL"
all_matches_df = pd.read_csv(path+"\matches.csv")
all_matches_df.head(2)
  • Aggregate Total scores, team extras for each match

####Total Team Score aggregate_score

####Total Team Extras team_extras

  • Merge the team scores for each match with the matches, so adding new columns to the all matches data

  • Adding new column which identifies the match type for each match as a Pre-qualifier, Qualifier, Eliminator & Final

sample code:
for year in range(2008,2017):
    fourth_last_match_in_each_season = all_matches_df[all_matches_df["season"] == year][-4:].index.values[0]
    third_last_match_in_each_season = fourth_last_match_in_each_season + 1
    second_last_match_in_each_season = third_last_match_in_each_season + 1
    last_match_in_each_season = second_last_match_in_each_season + 1
    
    all_matches_df = all_matches_df.set_value(fourth_last_match_in_each_season, "match-type" , "Qualifier-1")
    all_matches_df = all_matches_df.set_value(third_last_match_in_each_season, "match-type" , "Eliminator")
    all_matches_df = all_matches_df.set_value(second_last_match_in_each_season, "match-type" , "Qualifier-2")
    all_matches_df = all_matches_df.set_value(last_match_in_each_season, "match-type" , "Final")

ANALYSIS 1: Team Wins in different Cities in various IPL Seasons


####Code to get team wins per city data: wins_per_city

####Graph: total_wins_per_city

ANALYSIS 2: Toss Decision & Impact in IPL across seasons for various teams


####Code to get toss winners data: toss

####Graph 1: toss1

####Graph 2: toss_winner_is_match_winner_for_teams

ANALYSIS 3a : Team which handle their nerves under pressure ?


####Code to get teams which won close matches: close_matches

####Graph: team_winning_close_matches

ANALYSIS 3b: No. of times, Teams dominated their opposition with big victories


####Code to get teams winning with big margins big_margins

####Graph: team_winning_big_margins

ANALYSIS 4: Top 5 Batsman


####Code to get top 5 batsman: top5

####Graph: top_5_batsman_runs_per_season

ANALYSIS 5: Player Comparison (Player 1 vs Player 2, in terms of runs scored, balls faced, strike rate)


  • Calculated all the batsman aggregates like runs scored per match, balls face, 4s scored, 6s scored, strike rate, dismissal-kind
match_id inning batting_team batsman batsman_runs balls_faced Strike-Rate More-Than-30 More-Than-50 More-Than-100 4s 6s dismissal_kind fielder
1 1 Kolkata Knight Riders BB McCullum 158 73.0 216.44 1 1 1 10 13 0 0
1 1 Kolkata Knight Riders DJ Hussey 12 12.0 100.00 0 0 0 1 0 caught CL White

####Graph 1: Player Comparison By Runs players_comparison_by_balls_faced

####Graph 2: Player Comparison By Balls Faced players_comparison_by_runs

####Graph 3: Player Comparison By Strike_Rate players_comparison_by_strike_rate

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Jupyter Notebook 98.5%
  • Python 1.5%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.