|
@ -0,0 +1,30 @@ |
|
|
|
|
|
import json |
|
|
|
|
|
import os |
|
|
|
|
|
import zipfile |
|
|
|
|
|
from io import BytesIO |
|
|
|
|
|
|
|
|
|
|
|
import pandas as pd |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def addOneAthlete(df, file): |
|
|
|
|
|
data = json.load(file) |
|
|
|
|
|
df = df.append(data, ignore_index=True) |
|
|
|
|
|
return df |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_pcikle(): |
|
|
|
|
|
df = pd.DataFrame() |
|
|
|
|
|
with zipfile.ZipFile('download.zip') as z: |
|
|
|
|
|
for filename in z.namelist(): |
|
|
|
|
|
if filename.endswith('.zip'): |
|
|
|
|
|
zfiledata = BytesIO(z.read(filename)) |
|
|
|
|
|
with zipfile.ZipFile(zfiledata) as zfile2: |
|
|
|
|
|
for name2 in zfile2.namelist(): |
|
|
|
|
|
with zfile2.open(name2) as f: |
|
|
|
|
|
df = addOneAthlete(df, f) |
|
|
|
|
|
df.to_pickle('data.pkl') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
|
data = pd.read_pickle('data.pkl') |
|
|
|
|
|
print('x') |