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_elo_history()[source]

Returns Elo history of the players in the cohort

get_matches(unranked: bool = False) List[pyETT.ett.Match][source]

Returns matches among players in the cohort

get_matches_dataframe(unranked: bool = False) pandas.core.frame.DataFrame[source]

Returns a dataframe containing all matches of the players in the cohort.

players_dataframe()[source]

Returns cohort’s players in a dataframe

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

Returns a list of players whose name contains username, if perfect_match is False. Otherwise, it returns a list of players whose username 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

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 Round(round_attributes)[source]

Bases: object

A class to represent a round of a Match.

get_rounds_dataframe() pandas.core.frame.DataFrame[source]

Converts a list of rounds to a DataFrame :param rounds: List of rounds. :type rounds: List[“Round”]

Returns

Dataframe with rounds, one per row.

Return type

pd.DataFrame

print()[source]

Pretty-print match’s information

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 between start and end 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 and end

  • 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.

pyETT.ett_parser module

pyETT.ett_parser.get_elo_history(user_id) List[source]
pyETT.ett_parser.get_friends(user_id) List[source]
pyETT.ett_parser.get_leaderboard(num_players=10)[source]
pyETT.ett_parser.get_leaderboard_official_tournament() List[source]
pyETT.ett_parser.get_matches(user_id, unranked=False) List[source]
pyETT.ett_parser.get_matchup(user_id1, user_id2) Iterator[source]
pyETT.ett_parser.get_or_create_eventloop()[source]
pyETT.ett_parser.get_user(user_id) List[source]

Module contents