[~] Refactor
This commit is contained in:
parent
ccf7705477
commit
8ef31c33a2
@ -1,22 +1,34 @@
|
|||||||
import glob
|
import glob
|
||||||
import os
|
import os
|
||||||
import pandas
|
import pandas
|
||||||
|
import pickle
|
||||||
|
|
||||||
def kernel_1():
|
def kernel_1():
|
||||||
t1 = '/kaggle/input/mlb-player-digital-engagement-forecasting'
|
t4 = 'kernel_1-t3.dat'
|
||||||
t2 = glob.glob(
|
|
||||||
os.path.join(
|
def preprocess(t4):
|
||||||
t1,
|
t1 = '/kaggle/input/mlb-player-digital-engagement-forecasting'
|
||||||
'*.csv'
|
t2 = glob.glob(
|
||||||
|
os.path.join(
|
||||||
|
t1,
|
||||||
|
'*.csv'
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
t3 = {
|
t3 = {
|
||||||
o : pandas.read_csv(o)
|
o : pandas.read_csv(o)
|
||||||
for o in t2
|
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(
|
return dict(
|
||||||
t1=t1,
|
|
||||||
t2=t2,
|
|
||||||
t3=t3,
|
t3=t3,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user