|
|
|
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, header=False) |
|
pd.DataFrame(X_test).to_csv("test.csv", index=False, header=False) |