Giter VIP home page Giter VIP logo

nishanthmuruganantham / points-table-simulator Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 92 KB

This package will simulate the points table based on different possible results in a sports tournament and generate the favorable outcomes needed to make your favorite team to be placed at your expected position in the points table

Home Page: https://pypi.org/project/points-table-simulator/

License: MIT License

Python 99.64% Shell 0.36%
cricket football indian-premier-league ipl playoff points-table sports tournament ipl-calculator points

points-table-simulator's Introduction

points-table-simulator🔢

During the later part of the league stages in many multi-team tournaments 🏆 such as 🏏 Indian Premier League(IPL), Australian Big Bash League (BBL), ets., the fans will look for possible match outcomes for the remaining league matches, which could lead their favourite team to get qualified for further stage in the tournament (Playoffs). Here, the fans calculate their points table📊 to see their favourite team being placed in the position needed to qualify for Playoffs🏃🏻.

This tool🛠️ come as handy for those Sports enthusiasts which would help them to forsee the necessary remaining match outcomes to see their favourite team qualifying for playoffs✅ with the necessary match outcomes along with the respective points table📊.


This python package📦 will simulate the points table📊 based on different possible results in a sports tournament.

The PointsTableSimulator package provides a powerful tool for simulating and analyzing points tables for sports tournaments. Whether you're organizing or following a tournament, this package offers the flexibility to input tournament schedules, define points systems, and explore various match outcome scenarios to understand team standings and qualification possibilities.

Installation

Install this package with pip

pip install points-table-simulator

Usage/Examples

Please find the example usage from the below python code

from points_table_simulator import PointsTableSimulator
import pandas as pd

# Load the tournament schedule DataFrame
tournament_schedule = pd.read_csv("tournament_schedule.csv")

# Note: 
# The tournament schedule DataFrame should have the following columns:
#   - "match_number" column containing the match number
#   - "home" column containing the home team names
#   - "away" column containing the away team names
#   - "winner" column containing the match result (winning_team_name, draw, or no result)

# If the tournament schedule DataFrame contains different names than this, you can use arguments in PointsTableSimulator class to
# specify the column names. 

# Instantiate the PointsTableSimulator object
simulator = PointsTableSimulator(
    tournament_schedule=tournament_schedule,
    points_for_a_win=3,
    points_for_a_no_result=1,
    points_for_a_draw=1
)

# Get the current points table
current_table = simulator.current_points_table      # current_points_table is an attribute of PointsTableSimulator class

# Simulate qualification scenarios for a specific team
points_tables, qualification_match_results = simulator.simulate_the_qualification_scenarios(
    team_name="Team A",
    top_x_position_in_the_table=4,
    desired_number_of_scenarios=5
)

# points_tables - will return the list of points_tables (pd.Dataframe) for different qualification scenarios
# qualification_match_results - will return the list of table containing remaining match outcomes which could favour their team to get qualified for the given position

This package can also be used in Football tournaments such as English Premier League (EPL), Laliga, etc., when you want to generate the scenarios in which your favourite team can be placed in your expected position in the pointstable.

License

MIT

points-table-simulator's People

Contributors

nishanthmuruganantham avatar

Watchers

 avatar

points-table-simulator's Issues

Return the remaining matches schedule dataframe with result instead of returning the df with results for all the matches

In the simulate_the_qualification_scenarios function of PointsTableSimulator class, while simulating the possible qualification scenarios, the full schedule df is being copied and considered for updating with possible results for remaining matches. Instead of updating a dataframe with all the matches, a new df should be formed with only the remaining schedule and the same has to be updated while simulating the winning scenarios

Update the Readme File

Remove the line
# Calculate the current points table current_table = simulator.current_points_table()

Add Cutoff Percentage for simulate_the_qualification_scenarios Function

In the simulate_the_qualification_scenarios function of the PointsTableSimulator class, the itertools.product function is currently being used to generate all possible outcomes of the remaining matches. However, this approach may lead to a large number of scenarios and iterations, especially when the number of remaining group stage matches is high. As a result, it can potentially increase memory consumption and complexity.

To address this issue and improve the efficiency of the function, we propose adding a cutoff percentage based on the completion of the tournament. Once the percentage of matches completed in the tournament exceeds this cutoff percentage, the function will become available for use. Otherwise, attempting to use the function will result in an exception being thrown, informing the user about this restriction.

This cutoff percentage will help prevent excessive memory usage and streamline the process of generating qualification scenarios, ensuring a better user experience. Additionally, it aligns with our goal of optimizing the function's performance while providing valuable insights for users.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.