def reb_after_ft_per_team(team='SAS', path='D:\Gal\Work\Results'): ''' IN PROGRESS: need to be changed for OOP ''' home_games = tf.specific_team(team, home=True, away=False) away_games = tf.specific_team(team, home=False, away=True) off_reb, allow_off_reb = 0, 0 for g in home_games: times, home, away = tf.read_from_file(path+r'\\'+g) h_def_reb, h_off_reb, a_def_reb, a_off_reb = reb_after_ft(times, home, away) allow_off_reb += a_off_reb off_reb += h_off_reb for g in away_games: times, home, away = tf.read_from_file(path+r'\\'+g) h_def_reb, h_off_reb, a_def_reb, a_off_reb = reb_after_ft(times, home, away) allow_off_reb += h_off_reb off_reb += a_off_reb return off_reb, allow_off_reb, len(home_games)+len(away_games)
def time_out_histogram(team='NYK', path='D:\Gal\Work\Results'): ''' ''' timeouts = [] games = tf.specific_team(team, path) for g in games: h = g.find('-') im = tf.read_from_file(path+'\\'+g) if g[h+1:h+4] == team: timeouts += tf.find_timeouts(im[0], im[1]) else: timeouts += tf.find_timeouts(im[0], im[2]) plt.plot(actions_histogram(timeouts)) plt.show() return timeouts