cricinfo package
cricinfo.cricinfo module
- class cricinfo.cricinfo.Cricinfo[source]
Bases:
objectLoads cricket statistics from ESPN Cricinfo into pandas DataFrames.
Example:
from cricinfo import Cricinfo, Team, MatchFormat, StatType df = Cricinfo.retrieve_stats( team=Team.Pakistan, match_format=MatchFormat.T20I, stat_type=StatType.BATTING, )
- static retrieve_stats(team: Team | None, match_format: MatchFormat, stat_type: StatType) DataFrame[source]
Retrieve statistics from ESPN Cricinfo.
- Parameters:
team – Filter by team, or
Nonefor all teams.match_format – The match format to filter by.
stat_type – The type of statistics to retrieve.
- Returns:
A DataFrame containing the requested statistics.
- Raises:
requests.HTTPError – If the HTTP request fails.
ValueError – If the response cannot be parsed.
cricinfo.stat_type module
- class cricinfo.stat_type.StatType(*values)[source]
Bases:
EnumThe type of statistics to retrieve.
Each type corresponds to a different statistics table on ESPN Cricinfo:
BATTING,BOWLING,FIELDING,ALLROUND: Career player statistics.PARTNERSHIP: Partnership records for a team.TEAM: Overall team records.AGGREGATE: Aggregated team statistics across matches.
- AGGREGATE = 'aggregate'
- ALLROUND = 'allround'
- BATTING = 'batting'
- BOWLING = 'bowling'
- FIELDING = 'fielding'
- PARTNERSHIP = 'fow'
- TEAM = 'team'
cricinfo.match_format module
cricinfo.team module
- class cricinfo.team.Team(*values)[source]
Bases:
EnumFilter statistics by team.
Pass
Noneto retrieve stats for all teams.- Afghanistan = '40'
- Australia = '2'
- Bangladesh = '25'
- England = '1'
- India = '6'
- Ireland = '29'
- NewZealand = '5'
- Pakistan = '7'
- SouthAfrica = '3'
- SriLanka = '8'
- WestIndies = '4'
- Zimbabwe = '9'