You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
755 B

7 months ago
  1. import json
  2. import os
  3. import zipfile
  4. from io import BytesIO
  5. import pandas as pd
  6. def addOneAthlete(df, file):
  7. data = json.load(file)
  8. df = df.append(data, ignore_index=True)
  9. return df
  10. def create_pcikle():
  11. df = pd.DataFrame()
  12. with zipfile.ZipFile('download.zip') as z:
  13. for filename in z.namelist():
  14. if filename.endswith('.zip'):
  15. zfiledata = BytesIO(z.read(filename))
  16. with zipfile.ZipFile(zfiledata) as zfile2:
  17. for name2 in zfile2.namelist():
  18. with zfile2.open(name2) as f:
  19. df = addOneAthlete(df, f)
  20. df.to_pickle('data.pkl')
  21. if __name__ == '__main__':
  22. data = pd.read_pickle('data.pkl')
  23. print('x')