I am using h5py
package to create HDF5
file for my training set.
I want to create the first column having a variable length. For example, [1,2,3]
as 1st entry in the column, [1,2,3,4,5]
as 2nd entry and so on leaving other 5 columns in the same dataset in HDF5
file with data type int
with a fixed length, i.e. 1.
I have tried the below code statement to solve this type of scenario:
dt = h5py.special_dtype(vlen=np.dtype('int32'))
datatype = np.dtype([('FieldA', dt), ('FieldB', dt1), ('FieldC', dt1), ('FieldD', dt1), ('FieldE', dt1), ('FieldF', dt1)])
But, in the output, I got only empty array for each of the columns stated above for this dataset.
And, when I tried the below code:
dt = h5py.special_dtype(vlen=np.dtype('int32'))
data = db.create_dataset("data1", (5000,), dtype=dt)
This only gives me one column with variable length entries in the dataset but I want all these 6 columns to be included in the same dataset but with 1st column as having variable length entries like stated above.
I am totally confused as to how to get a solution for this type of scenario. Any help would highly be appreciated.