summaryrefslogtreecommitdiff
path: root/API/utils.py
diff options
context:
space:
mode:
authorRasmus Luha <rasmus.luha@gmail.com>2022-03-17 00:47:22 +0200
committerRasmus Luha <rasmus.luha@gmail.com>2022-03-17 00:47:22 +0200
commitab2efcde6a5fac062ace86aa1705dc47ce69f438 (patch)
treee91491dfb56459866001ff4a6cd4cee547eec1f1 /API/utils.py
parentecb4b4c8c56d9f720ba004fcfefd40acb996cc7e (diff)
Little Restructuring
Diffstat (limited to 'API/utils.py')
-rw-r--r--API/utils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/API/utils.py b/API/utils.py
new file mode 100644
index 0000000..c04bdf1
--- /dev/null
+++ b/API/utils.py
@@ -0,0 +1,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