Unveiling Cricket Insights: T20 World Cup Data Analytics Project

Hemang Parmar
3 min readNov 9, 2023

--

Cricket has always been more than just a sport; it’s a passion, an emotion, and a way of life for millions of fans around the world. The T20 World Cup is one of the most eagerly awaited cricket tournaments, and what better way to celebrate it than by delving into data analytics? In this blog, we will walk you through a T20 World Cup data analytics project that includes data scraping from ESPN Cricinfo, creating a Power BI dashboard, and using DAX (Data Analysis Expressions) to extract valuable insights.

Web Scraping from ESPN Cricinfo

Before diving into data analytics, we need to gather data. ESPN CricInfo is a treasure trove of cricket statistics. To start, let’s extract data from the T20 World Cup. We’ll use Python for web scraping and pandas to structure the data.

  1. Python Libraries: Ensure you have installed pandas, beautifulsoup4, and requests.
  2. Code Implementation:
import pandas as pd
import requests
from bs4 import BeautifulSoup
url = "https://www.espncricinfo.com/live-cricket-score"
page = requests.get(url)
soup = BeautifulSoup(page.content, 'html.parser')
# Scrape and structure the data
# Save data as a CSV file for further analysis
data.to_csv("T20_World_Cup_Data.csv")

Creating a Power BI Dashboard

Now that we have our data, it’s time to visualize it using Power BI, a powerful data analysis tool. If you haven’t already, download and install Power BI Desktop.

  1. Data Import: Open Power BI Desktop, click “Get Data,” and import the CSV file we scraped.
  2. Data Transformation: Use Power BI’s data transformation capabilities to clean, transform, and shape your data as needed.
  3. Visualizations: Create compelling visualizations like bar charts, pie charts, and line graphs to showcase different aspects of the T20 World Cup data.
  4. Filters: Add filters to focus on specific teams, players, or years within the tournament.

Key Measures

Batting Avg = DIVIDE([Total Runs],[Total Innings Dismissed],0)
Strike rate = DIVIDE([Total Runs],[total balls faced],0)*100
Average Balls Faced = AVERAGE(fact_batting_summary[balls])
Total Runs = SUM(fact_batting_summary[runs])
Bowling Average = DIVIDE([Runs Conceded],[wickets],0)
Economy = DIVIDE( [Runs Conceded], ([Balls Bowled]/6),0)
Total Innings Bowled = DISTINCTCOUNT(fact_bowling_summary[match_id])
Dashboard Snippet 1
Dashboard Snippet 2
Dashboard Snippet 3

Conclusion

The T20 World Cup Data Analytics Project with the PowerBI Dashboard is a prime example of how data analytics can enhance our understanding of a popular sporting event. By collecting, cleaning, and analyzing data, we uncovered insights that go beyond the surface-level statistics. The PowerBI dashboard took these insights and made them accessible to cricket enthusiasts, researchers, and fans around the world, providing an engaging way to explore the rich data behind the tournament.

Such projects not only enrich our appreciation of the game but also showcase the power of data analytics and visualization tools in various domains. Whether you are a cricket fan or just a data enthusiast, this project is a testament to the exciting possibilities that data analytics can offer in unraveling the secrets hidden in numbers.

As we continue to witness the evolution of data analytics in sports, one thing is clear: it’s not just about the numbers; it’s about the stories they tell. The T20 World Cup Data Analytics Project with PowerBI Dashboard is one such captivating story, and it’s just the beginning of what’s possible in the world of sports analytics.

Hemang | Data Analyst | Data portfolio (datascienceportfol.io)

--

--