USPS / process.py
Witold Wydmański
fix
3eedd79
raw
history blame contribute delete
No virus
531 Bytes
#%%
import h5py
import pandas as pd
import numpy as np
#%%
with h5py.File("usps.h5", 'r') as hf:
train = hf.get('train')
X_tr = train.get('data')[:]
y_tr = train.get('target')[:]
test = hf.get('test')
X_te = test.get('data')[:]
y_te = test.get('target')[:]
# %%
X_training = np.concatenate((X_tr, y_tr.reshape(-1, 1)), axis=1)
X_test = np.concatenate((X_te, y_te.reshape(-1, 1)), axis=1)
# %%
pd.DataFrame(X_training).to_csv("train.csv", index=False)
pd.DataFrame(X_test).to_csv("test.csv", index=False)