Package: cricguru
CricguruOverviewCricguru is a data extraction module for extracting data from the Statsguru data query on Cricinfo. I was inspired to build a simple tool to extract dataframes from statsguru for analyzing cricket data and was finding it difficult to obtain overall figures from the website as they did not have an API for it. Cricinfo has a large variety of cricket data for all classes of cricket matches and also in-depth player data. However without an API it is impossible to extract any useful information from it. Hence this module has functions to easily get the cricket data we want without having to manually scrape the website. The data output is currently returned in the form of Pandas dataframes. You can find the full documentationhere.Team DataData by team can be obtained for the three main classes of cricket formats which areTest,One-dayandT20. Excluding the class argument would return the overall data. In order to filter by teams and opposition you must provide one of the following ids to the team and opposition arguments respectively for some popular teams.{"all teams": "", "Afghanistan": "40", "Australia": "2", "Bangladesh": "25", "England": "1", "ICC World XI": "140", "India": "6", "Ireland": "29", "New Zealand": "5", "Pakistan": "7", "South Africa": "3", "Sri Lanka": "8", "West Indies": "4", "Zimbabwe": "9"}Player DataData by player can be obtained for the same classes mentioned above. The player class however requires a player id which can be obtained from Cricinfo by selecting a team followed by a player from that team. For exampleAngelo Mathew'sid is 49764 which can be found appended to the url of the player's stats page on Cricinfo.Built WithThis project primarily uses Python 3.8 in combination with Pandas. Pandas is used to get the tables directly from the Statsguru query pages and convert them to dataframes. Urllib is used to format the url and append the query parameters. Poetry is used for packaging and publishing.Getting StartedYou can install the package using the following command.pipinstallcricguruUsageYou can get overall figures for all teams with the following. You must pass in the query parameters in a dictionary as shown. The "template" key with a "results" value is required along with the "class" variable which specifies which format of cricket you require data from. The classes for each format are as follows.1 - Test2 - ODI3 - T2011 - All10 - Women's T20i8 - Women's Test9 - Women's ODI20 - Youth Test21 - Youth ODI22 - Youth T20fromcricguruimportteamteam=team.Team()query_params={"template":"results","class":"2"}cric_data=team.overall(query_params)#Returns a pandas dataframecric_data.head()For player data you have to provide the player id to initialize the player object and then call the function for the type of data you require. You have to specify what type of player data you need such as allround, batting or bowling.fromcricguruimportplayerplayer=player.Player(49764)query_params={'class':'1','type':'allround'}cric_data=player.career_summary(query_params)print(cric_data.head())ContributingThis is an amateur project at best and I am still a complete beginner to Python and would greatly welcome any suggestions, advice, constructive criticism, best practices or contributions to the project.  Simply open a pull request or issue and I will check it out.ContactYou can also contact me atpavithranthilakanathan@gmail.comor on twitter -@pavin_v1LicenseDistributed under the MIT license. See `LICENSE.md' for more information.AcknowledgementsESPN CricinfoTodo100% code coverageAdditional data formats