Closed
Description
Hello!
There are problems when working with NumPy Structured arrays containing an object.
Given the NumPy composite type:
records_dtype = [('col1', object), ('col2', np.float64)]
In numpy, data is retrieved by the name of the column, but in zarr this does not work:
arr = np.array([('1', 1.0), ('22', 2.0), ('333', 3.0)], dtype=records_dtype)
print(arr['col1'])
-
When creating dataset an exception occurs:
ds = zarr.array(arr)
zarr.errors.MetadataError: error decoding metadata: Cannot change data-type for object array. -
If you pass 'fill_value = None' to
zarr.array()
, the dataset is created and the values from it can be read:ds = zarr.array(arr, fill_value=None) print(ds[:])
But data retrieval by column name does not work:
print(ds['col1'])
ValueError: cannot create an OBJECT array from memory buffer
Metadata
Metadata
Assignees
Labels
No labels