# Elopy
This is a module to allow you to maintain state for teams as you progress them
through games played against opponents. This uses the the constants set out
from [538's NBA Elo](https://fivethirtyeight.com/features/how-we-calculate-nba-elo-ratings/). But
you could inherit and overload the functions to work for any sport you wanted.
To Install:
```
pip install elopy
```
Code Examples:
```
from elopy.elo import Elo
team_a = Elo(start_elo=1600, k=20, hca = 100)
team_b = Elo(start_elo=1400, k=20, hca = 100)
#To get the win probability of team_a beating team_b at home
team_a_probs = team_a.win_probs(team_b, is_home=True)
#To get the win probability of team_b beating team_a at home
team_b_probs = team_b.win_probs(team_a, is_home=True)
#If you want to get away probabilities then set is_home to False
#To get the point spread of team_a vs. team_b. Positive represents an underdog
#negative represents a favorite
#at home
point_spread_home = team_a.point_spread(team_b, is_home=True)
#not at home. Will return a value
point_spread_away = team_a.point_spread(team_b, is_home=False)
#update elo's after a team has played the other. Let's say team a beat team b
#by 15 points as a visitor
team_a.play_game(team_b, 15, is_home=False)
#This will update both team a and team b's Elo ratings. If you run the same line
as above again it will be as if both teams are playing a second game
team_a.play_game(team_b, 15, is_home=False)
#This means that team a played team b again and beat them by 15 points again as
the visitor
#Then to get each team's Elo rating just access the elo attribute
print(team_a.elo)
print(team_b.elo)
Raw data
{
"_id": null,
"home_page": "https://github.com/mcbarlowe/elopy",
"name": "elopy",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6,<4.0",
"maintainer_email": "",
"keywords": "elo,sports,basketball,nba",
"author": "Matt Barlowe",
"author_email": "mcbarlowe@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/00/8e/c20fb8670dc4ac61c61b4f19828ba54065609ea98b4a2d56443b02b0fe2e/elopy-0.1.4.tar.gz",
"platform": null,
"description": "# Elopy\n\nThis is a module to allow you to maintain state for teams as you progress them\nthrough games played against opponents. This uses the the constants set out\nfrom [538's NBA Elo](https://fivethirtyeight.com/features/how-we-calculate-nba-elo-ratings/). But\nyou could inherit and overload the functions to work for any sport you wanted.\n\nTo Install:\n```\npip install elopy\n```\n\nCode Examples:\n\n```\nfrom elopy.elo import Elo\n\nteam_a = Elo(start_elo=1600, k=20, hca = 100)\nteam_b = Elo(start_elo=1400, k=20, hca = 100)\n\n#To get the win probability of team_a beating team_b at home\n\nteam_a_probs = team_a.win_probs(team_b, is_home=True)\n\n#To get the win probability of team_b beating team_a at home\n\nteam_b_probs = team_b.win_probs(team_a, is_home=True)\n\n#If you want to get away probabilities then set is_home to False\n\n#To get the point spread of team_a vs. team_b. Positive represents an underdog\n#negative represents a favorite\n\n#at home\npoint_spread_home = team_a.point_spread(team_b, is_home=True)\n\n#not at home. Will return a value\npoint_spread_away = team_a.point_spread(team_b, is_home=False)\n\n#update elo's after a team has played the other. Let's say team a beat team b\n#by 15 points as a visitor\n\nteam_a.play_game(team_b, 15, is_home=False)\n\n#This will update both team a and team b's Elo ratings. If you run the same line\nas above again it will be as if both teams are playing a second game\n\nteam_a.play_game(team_b, 15, is_home=False)\n\n#This means that team a played team b again and beat them by 15 points again as\nthe visitor\n\n#Then to get each team's Elo rating just access the elo attribute\nprint(team_a.elo)\nprint(team_b.elo)\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A package to simplify Elo calculations",
"version": "0.1.4",
"project_urls": {
"Homepage": "https://github.com/mcbarlowe/elopy",
"Repository": "https://github.com/mcbarlowe/elopy"
},
"split_keywords": [
"elo",
"sports",
"basketball",
"nba"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7c106e8e888849ec7b277b5e114700e44167b4a125a0aacaf6f3c2419068c814",
"md5": "286e6c4c381c8959254626146e3a410b",
"sha256": "e6a627e60ee29c6b30b16fbba0abadee317db91ababdd355e2e19a3eb442e92b"
},
"downloads": -1,
"filename": "elopy-0.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "286e6c4c381c8959254626146e3a410b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6,<4.0",
"size": 3394,
"upload_time": "2023-09-06T17:55:40",
"upload_time_iso_8601": "2023-09-06T17:55:40.654819Z",
"url": "https://files.pythonhosted.org/packages/7c/10/6e8e888849ec7b277b5e114700e44167b4a125a0aacaf6f3c2419068c814/elopy-0.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "008ec20fb8670dc4ac61c61b4f19828ba54065609ea98b4a2d56443b02b0fe2e",
"md5": "e5117d6112d7a172888f76fd87e90bc0",
"sha256": "9d7bde23d3c0aefec001da02be50ba67e8f6b9e2ec1199c406ff8399942dd4e9"
},
"downloads": -1,
"filename": "elopy-0.1.4.tar.gz",
"has_sig": false,
"md5_digest": "e5117d6112d7a172888f76fd87e90bc0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6,<4.0",
"size": 2874,
"upload_time": "2023-09-06T17:55:42",
"upload_time_iso_8601": "2023-09-06T17:55:42.396207Z",
"url": "https://files.pythonhosted.org/packages/00/8e/c20fb8670dc4ac61c61b4f19828ba54065609ea98b4a2d56443b02b0fe2e/elopy-0.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-06 17:55:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mcbarlowe",
"github_project": "elopy",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "elopy"
}