Git Product home page Git Product logo

python_for_data_analysis's Introduction

##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

python_for_data_analysis's People

Contributors

harshilkorani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.