当前位置: 首页>>代码示例>>Python>>正文


Python Misc.get_tournament_year方法代码示例

本文整理汇总了Python中Misc.get_tournament_year方法的典型用法代码示例。如果您正苦于以下问题:Python Misc.get_tournament_year方法的具体用法?Python Misc.get_tournament_year怎么用?Python Misc.get_tournament_year使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Misc的用法示例。


在下文中一共展示了Misc.get_tournament_year方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: raw_input

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import get_tournament_year [as 别名]
    user_input = raw_input(prompt)
    # check user input
    if user_input.isdigit() and (int(user_input) in range(num_kaggle_output_options)):
        kaggle_output = kaggle_output_options[int(user_input)]
    else:
        raise Exception("Invalid entry '%s', please enter one of following values %s." % (user_input, range(num_kaggle_output_options)))


    # create TeamFactory
    team_factory = Basketball.TeamFactory()
    team_factory.add_all_teams()

    # analyze each available season
    Misc.check_input_data("Kaggle", "seasons")
    for _, row in Constants.INPUT_DATA['Kaggle']['seasons'].iterrows():
        year = Misc.get_tournament_year(row.years)
        print("Predicting %s NCAA Tournament" % year)

        season_id = Constants.SEASON_YEAR_TO_ID[year]
        if analysis.data_available(season_id):
            tournament = Basketball.Tournament(team_factory, season_id)

            tournament.generate_matchup_probabilities(analysis)
            tournament.generate_bracket(analysis)

            tournaments[row.season] = tournament



    # if necessary make output directory
    if not os.path.isdir(Constants.OUTPUT_DIR):
开发者ID:davidcasterton,项目名称:PyMarchMadness,代码行数:33,代码来源:__main__.py

示例2: print

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import get_tournament_year [as 别名]
        _file_base_name, _extension = os.path.splitext(_file)
        if _extension == ".csv":
            INPUT_DATA[_sub_dir][_file_base_name] = pandas.read_csv(_file_path)
        elif _extension == ".xls":
            INPUT_DATA[_sub_dir][_file_base_name] = pandas.read_excel(_file_path, 0, index_col=None, na_values=['NA'])
print("Input Data loaded.")

# lookup dictionaries based on input data
SEASON_ID_TO_YEAR = {}
DIVISIONS = {}
SEASON_YEAR_TO_ID = {}
if Misc.check_input_data("Kaggle", "seasons", raise_exception=False):
    df = INPUT_DATA['Kaggle']['seasons']
    for _, row in df.iterrows():
        season_id = row['season']
        tournament_year = Misc.get_tournament_year(row['years'])

        SEASON_YEAR_TO_ID[tournament_year] = season_id
        SEASON_ID_TO_YEAR[season_id] = tournament_year
        DIVISIONS[season_id] = {
            "W": row['regionW'],
            "X": row['regionX'],
            "Y": row['regionY'],
            "Z": row['regionZ'],
        }

# blank tournament bracket
TOURNAMENT_BRACKET = {
    'R00': {
        'W01': None, 'W02': None, 'W03': None, 'W04': None, 'W05': None, 'W06': None, 'W07': None, 'W08': None, 'W09': None, 'W10': None, 'W11': None, 'W12': None, 'W13': None, 'W14': None, 'W15': None, 'W16': None,
        'X01': None, 'X02': None, 'X03': None, 'X04': None, 'X05': None, 'X06': None, 'X07': None, 'X08': None, 'X09': None, 'X10': None, 'X11': None, 'X12': None, 'X13': None, 'X14': None, 'X15': None, 'X16': None,
开发者ID:davidcasterton,项目名称:PyMarchMadness,代码行数:33,代码来源:Constants.py


注:本文中的Misc.get_tournament_year方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。