freelance-project-34-market.../python/tasks/mlb_player.py
Siarhei Siniak 47a1d7da79 [~] Refactor
2021-07-16 10:39:03 +03:00

36 lines
643 B
Python

import glob
import io
import os
import pandas
import pickle
def kernel_1():
t4 = 'kernel_1-t3.dat'
def preprocess(t4):
t1 = '/kaggle/input/mlb-player-digital-engagement-forecasting'
t2 = glob.glob(
os.path.join(
t1,
'*.csv'
)
)
t3 = {
o : pandas.read_csv(o).to_xarray()
for o in t2
}
with io.open(t4, 'wb') as f:
pickle.dump(t3, f)
if not os.path.exists(t4):
preprocess(t4=t4)
with io.open(t4, 'rb') as f:
t3 = pickle.load(f)
return dict(
t3=t3,
)