Summary
Learn how to scrape data from ESPN Cricinfo’s Stats Guru using Power BI and Python, allowing you to extract and analyze match results.
Highlights
00:20 Open ESPN Cricinfo and navigate to Stats Guru.
00:45 Choose your desired format (Tests, ODI, T20I) and set date ranges.
01:15 Submit the query and retrieve the data.
02:00 Use Python to read the data, but encounter a 403 Forbidden error.
02:30 Switch to Power BI to collect and clean the data.
03:10 Find the pattern of the URL to retrieve multiple pages of data.
04:00 Create a new source in Power BI and specify the range of pages you want to scrape.
04:45 Clean the data, remove unwanted fields, and rearrange columns.
05:30 Close and apply the changes, then extract the data into a CSV file.
Key Insights
📊 Power BI provides a solution when direct web scraping is restricted, like in the case of ESPN Cricinfo’s Stats Guru.
🐍 Python’s pandas library can be used to read HTML data, but it may encounter access restrictions.
💻 Power BI allows you to import web data by specifying the URL and performing data transformations.
🔍 Understanding the URL pattern is crucial for scraping multiple pages of data from a website like Stats Guru.
⚙️ Power BI’s M code can be modified to include the page number in the URL, allowing you to scrape data from multiple pages.
📑 Convert the query into a table, clean the data, and remove any unnecessary fields for better analysis.
💡 Power BI’s export data feature enables you to save the extracted data into a CSV file for further use.