pyETT package¶
Submodules¶
pyETT.ett module¶
- class pyETT.ett.Cohort(players)[source]¶
Bases:
object
A Class to represent a cohort of players
- describe() pandas.core.frame.DataFrame [source]¶
Returns a dataframe with descriptive statistics of the players in the cohort considering only matches among themselves, such as win, losses and win rate. Additional player specific attributes are added to the dataframe, such as name, elo and rank.
- Returns
Players matchup stats in the cohort.
- Return type
pd.DataFrame
- get_matches(unranked: bool = False) List[pyETT.ett.Match] [source]¶
Returns matches among players in the cohort
- class pyETT.ett.ETT[source]¶
Bases:
object
A class to represent Eleven Table Tennis (ETT).
- get_leaderboard(num_players: int = 10) List[pyETT.ett.Player] [source]¶
Returns a list of players from the leaderboard.
- Parameters
num_players (int, optional) – Max number of players to return. Defaults to 10.
- Returns
Top players in ETT’s leaderboard.
- Return type
List[Player]
- get_leaderboard_dataframe(num_players: int = 10) pandas.core.frame.DataFrame [source]¶
Returns a pandas dataframe with players from the leaderboard.
- Parameters
num_players (int, optional) – Max number of players to return. Defaults to 10.
- Returns
Top players in ETT’s leaderboard.
- Return type
pd.DataFrame
- user_search(username: str, perfect_match: bool = False) List[pyETT.ett.Player] [source]¶
Returns a list of players whose name contains
username
, ifperfect_match
is False. Otherwise, it returns a list of players whose username is a perfect match withusername
.- Parameters
username (str) – Username
perfect_match (bool, optional) – Whether to perform perfect match in string matching. Defaults to False.
- Returns
List of players whose names match with username.
- Return type
List[Player]
- user_search_dataframe(username: str, perfect_match: bool = False) pandas.core.frame.DataFrame [source]¶
Returns a list of players whose name contains username, if perfect_match is False. Otherwise, it returns a list of players whose usernames is a perfect match with username.
- Parameters
username (str) – Username
perfect_match (bool, optional) – Whether to perform perfect match in string matching. Defaults to False.
- Returns
A dataframe of players whose names match with username.
- Return type
pd.DataFrame
- class pyETT.ett.Match(match_id, match)[source]¶
Bases:
object
A class to represent a Match.
- class pyETT.ett.Player(user_id, player=None, legacy_api=False)[source]¶
Bases:
object
A class to represent a Player.
- AWAY = 1¶
- HOME = 0¶
- get_elo_history() pandas.core.frame.DataFrame [source]¶
Returns player’s elo score history.
- Returns
[description]
- Return type
pd.DataFrame
- get_friends() List[pyETT.ett.Player] [source]¶
Return a player’s friends list
- get_friends_dataframe() pandas.core.frame.DataFrame [source]¶
Return a player’s friends list in a dataframe
- get_matches(unranked: bool = False) List[pyETT.ett.Match] [source]¶
Return player’s matches.
- get_matches_dataframe(unranked: bool = False) pandas.core.frame.DataFrame [source]¶
Return player’s matches in a pandas dataframe.
- get_matches_revertible() List[numpy.int64] [source]¶
Returns player’s lost matches that are eligible to be reverted/cancelled. If you have an incomplete match because of connection issues or because your opponent left in the middle of the play, you can request an Eleven Moderator (Discord) to revert/cancel the match and hence update your Elo rating.
- Returns
List of matches ids that are eligible to be reverted/cancelled.
- Return type
List[np.int64]
- print_matches_revertible()[source]¶
Pretty print player’s lost matches that are eligible to be reverted/cancelled. If you have an incomplete match because of connection issues or because your opponent left in the middle of the play, you can request an Eleven Moderator (Discord) to revert/cancel the match and hence update your Elo rating
- class pyETT.ett.Tournament(players)[source]¶
Bases:
object
A Class to handle ETT official tournaments
- qualify(elo_min: float, start: str, end: str) pandas.core.frame.DataFrame [source]¶
Implements logic to enter or qualify to ETT’s official monthly tournament. Players with an Elo rating exceeding
elo_min
at any point betweenstart
andend
date have direct entry to the tournament. Otherwise, they can enter a Qualifying Tournament to try and qualify. This method returns a dataframe indicating which players have direct entry or can qualify.- Parameters
elo_min (float) – Elo threshold to have direct entry to the Tournament.
start (str) – Start date (YYYY-MM-DD)
end (str) – End date (YYYY-MM-DD)
- Returns
- Data frame of players with the following information:
mean: Player’s mean Elo between
start
andend
min: Player’s min Elo between
start
and end`max: Player’s max Elo between
start
and end`direct_entry: Boolean indicating whether player have direct entry to the Tournament
can_qualify: Boolean indicating whether player can enter Qualifying Tournament
id: Player’s id
name: Player’s username
- Return type
pd.DataFrame
- pyETT.ett.official_tournament_leaderboard_dataframe() pandas.core.frame.DataFrame [source]¶
Returns a pandas dataframe with the leaderboard of the Eleven official tournaments available at http://lavadesignstudio.co.uk/eleven-rankings/.
- Returns
A dataframe with the leaderboard of Eleven official tournaments.
- Return type
pd.DataFrame
- pyETT.ett.print_match(match: pyETT.ett.Match)[source]¶
Pretty print a match with rounds.
- Parameters
match (Match) – A match.