Skip to main content

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

Release files for elopy 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elopy 0.1.4
File Size Uploaded
elopy-0.1.4.tar.gz 2.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elopy 0.1.4
File Interpreter ABI Platform
elopy-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 6.3 kB

Release files / elopy-0.1.4.tar.gz

Download URL elopy-0.1.4.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9d7bde23d3c0aefec001da02be50ba67e8f6b9e2ec1199c406ff8399942dd4e9
BLAKE2b-256 checksum
How to use checksums
008ec20fb8670dc4ac61c61b4f19828ba54065609ea98b4a2d56443b02b0fe2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.1

Release files / elopy-0.1.4-py3-none-any.whl

Download URL elopy-0.1.4-py3-none-any.whl
Size 3.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6a627e60ee29c6b30b16fbba0abadee317db91ababdd355e2e19a3eb442e92b
BLAKE2b-256 checksum
How to use checksums
7c106e8e888849ec7b277b5e114700e44167b4a125a0aacaf6f3c2419068c814
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.1

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page