Skip to main content

Python library to calculate tables for football and handball

Project description

Python library to calculate tables for football and handball

Getting Started

pip install tablecalculation

Alternatively: copy the tablecalculation package to your project.

Prerequisites

Should work with Python 2.7 and up or 3. Possibly other versions (untested).

Usage

It’s best to see tablecalculationtest.py for reference.

Basic usage is as follows:

# Handball 3. Liga Herren, Saison 2015/16, 17. Spieltag
# Create table calculation oject with scope, sports type and mode
t1 = TableCalculation(TABLE_ALL, SPORTSTYPES.HANDBALL, CALCULATION_MODE_DIRECT_COMPARE)

# add your matches / fixtures (upto desired match day or all)
t1.add_match(_Match('DHK Flensborg', 35551, 'SC Magdeburg II', 35561, 41, 23))
t1.add_match(_Match('SV Meck.-Schwerin', 35651, 'TS Großburgwedel', 35661, 26, 17))
...

tb = t1.get_table()
# tb is now the sorted table

_Match may be replaced with your own object but as a minimum requires a team name and id for both participiants and goals for the home and away team.

The module supports two modes for calculation: CALCULATION_MODE_GOAL_DIFFERENCE and CALCULATION_MODE_DIRECT_COMPARE. The first one uses points, followed by goal difference and then goals scored as sort order (as used in German Bundesliga for example).

CALCULATION_MODE_DIRECT_COMPARE will first sort by points, then the result of direct comparison between teams with equal points (often used in handball or the Spanish La Liga).

Tests

Some tests are supplied and can be run like this:

python -m unittest tablecalculation
python -m unittest tablecalculation.teampoint

Authors

License

This project is licensed under the MIT License - see the LICENSE.txt file for details

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tablecalculation-1.0.3.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tablecalculation-1.0.3-py2.py3-none-any.whl (9.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file tablecalculation-1.0.3.tar.gz.

File metadata

  • Download URL: tablecalculation-1.0.3.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15

File hashes

Hashes for tablecalculation-1.0.3.tar.gz
Algorithm Hash digest
SHA256 c12b1bf81e81ce8595605e3a69e3f4d8f265ce9461b2fe86381e20983113247d
MD5 b4b4c0ec0f87ccbed9ea0c66d7cc1012
BLAKE2b-256 3c7d69a30f8c4cc529dd2289d9c3309a2729558de6c03acd365e83a15436429f

See more details on using hashes here.

File details

Details for the file tablecalculation-1.0.3-py2.py3-none-any.whl.

File metadata

  • Download URL: tablecalculation-1.0.3-py2.py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15

File hashes

Hashes for tablecalculation-1.0.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4a9ab267b1992621923fc60a87fc55cdd36a8f7d3c8d23e587dcf717df6eb4c5
MD5 82d2f09f91202f9ac19aa2471a139971
BLAKE2b-256 c02e2c7800ca69e41dfde69e828724e3e88bb40208015099f9067d0453d50f26

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page