コード例 #1
0
 def setUp(self):
     config = ConfigParser()
     config.read(os.path.join(os.path.expanduser('~'), '.pgcred'))
     db = NBAPostgres(user=config['nbadb']['username'],
                      password=config['nbadb']['password'],
                      database=config['nbadb']['database'])
     self.a = RotoGuruNBAAgent(cache_name='test-rg', db=db)
     self.a.insert_db = False
コード例 #2
0
ファイル: test_realgm_xref.py プロジェクト: zugzawang/nba
 def setUp(self):
     config = ConfigParser()
     config.read(os.path.join(os.path.expanduser('~'), '.pgcred'))
     self.db = NBAPostgres(user=config['nbadb']['username'],
                           password=config['nbadb']['password'],
                           database=config['nbadb']['database'])
コード例 #3
0
 def test_init(self):
     nbapg = NBAPostgres()
コード例 #4
0
                header = 'starting_lineups'

            _headers.append(header.lower())

        return _headers

if __name__ == "__main__":
    import glob
    import pprint
    import random

    from nba.db.pgsql import NBAPostgres

    logging.basicConfig(level=logging.ERROR)
    p = NBAStufferParser()
    db = NBAPostgres()

    fixed_games = []

    for fn in glob.glob('/home/sansbacon/workspace/nba-data/nbastuffer/csv/*Box*.csv'):

        with open(fn, 'r') as infile:
            rows = infile.readlines()

        headers = rows.pop(0).split(',')
        headers = p.headers(headers)
        game_pairs = p.game_pairs(rows, headers)

        wanted = ['is_regular_season', 'has_ot', 'dataset', 'game_date', 'venue', 'rest_days', 'days_last_game', 'back_to_back', 'back_to_back_to_back',
                  'three_in_four', 'four_in_five', 'gamecode', 'team_code', 'team_id', 'opponent_team_code', 'opponent_team_id',
                  'q1', 'q2', 'q3', 'q4', 'ot1', 'ot2', 'ot3', 'ot4',
コード例 #5
0
 def setUp(self):
     self.db = NBAPostgres()