diff options
author | Rasmus Luha <rasmus.luha@gmail.com> | 2022-03-16 18:50:37 +0200 |
---|---|---|
committer | Rasmus Luha <rasmus.luha@gmail.com> | 2022-03-16 18:50:37 +0200 |
commit | 03aaa6978fbd73c13b63f0c525f01189c67d0f1f (patch) | |
tree | 89450e92d6c92fcdc41893617d3051b47e33b65f /AllAboutData/getData.py | |
parent | baeb9ef961eef425ef5c655d8fd4e4140bb1526f (diff) |
API requests done
Diffstat (limited to 'AllAboutData/getData.py')
-rw-r--r-- | AllAboutData/getData.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/AllAboutData/getData.py b/AllAboutData/getData.py index 7c64b30..4cea9af 100644 --- a/AllAboutData/getData.py +++ b/AllAboutData/getData.py @@ -84,10 +84,12 @@ def getPlayerData(url, headers): "height_feet" : player["height_feet"], "height_inches" : player["height_inches"]}) - #add player to dataframe + # Add player to dataframe playerDf.loc[len(playerDf)] = playerSeries - #add dataframe to File - playerDf.to_csv(playersDir+teamName+".csv", mode='a', index=False, header=False) + + # Add dataframe to File + hdr = False if os.path.isfile(playersDir+teamName+".csv") else True + playerDf.to_csv(playersDir+teamName+".csv", mode='a', index=False, header=hdr) print("Page "+str(el)+" read.") print("All done, check \"Data\" Dir.") @@ -95,7 +97,6 @@ def getPlayerData(url, headers): -# Requesting and storing data if __name__ == "__main__": getTeamsData(url, headers) getPlayerData(url, headers) |