diff options
Diffstat (limited to 'AllAboutData')
-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) |