summaryrefslogtreecommitdiff
path: root/API/utils.py
blob: c04bdf1a68ef9bb95fe43b3741ec7741ab0e36d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import pandas as pd

# Making relative paths. On windows slashes would be backwards
# It is probably not the best way.
relPathTeams = "../AllAboutData/Data/NBAteams.csv"
relPathPlayers = "../AllAboutData/Data/Players/"

def getTeamNames():
    '''
    Returns dictionary with fetched teams' names as keys
    and full_names as values.
    '''

    teamsDf = pd.read_csv(relPathTeams).to_dict()
    team_names = {}
    for el in range(len(teamsDf["name"])):
        team_names.update({teamsDf["name"][el] : teamsDf["full_name"][el]})
    return team_names