Skip to content

[enhancement] Can this lib support npy append other data type? like string #8

@zhuwenxing

Description

@zhuwenxing

It works well to append an item if this item is an array.
But it the item is an object like a string, then there will be error

[2023-07-27T07:48:55.983Z] 
[2023-07-27T07:48:55.983Z] array = 'FchBBdlm2uMLLr1mVjpwtFsnnSmkEvLbWo1DXvOAHbx9JAvWu9vH45eTBRCUqAZjU0Bmz34loB84MYKjekcWTFZaGh1fbAU61G9Tu6TJbIVLkb7t0jIzs...hRIJ8LTLVOCbYqEprSz55WXhvJ8NX1LoNVFJ3kA3YUp8NNNPQjJeZLQdhrb4GYvrxOVjt1Tx7QGgPO00kYa8cOjagDwlNSKLw3Dr6XRzeu3HXyDFpTanZQ'
[2023-07-27T07:48:55.983Z] 
[2023-07-27T07:48:55.983Z]     def header_data_from_array_1_0(array):
[2023-07-27T07:48:55.983Z]         """ Get the dictionary of header metadata from a numpy.ndarray.
[2023-07-27T07:48:55.983Z]     
[2023-07-27T07:48:55.983Z]         Parameters
[2023-07-27T07:48:55.983Z]         ----------
[2023-07-27T07:48:55.983Z]         array : numpy.ndarray
[2023-07-27T07:48:55.983Z]     
[2023-07-27T07:48:55.983Z]         Returns
[2023-07-27T07:48:55.983Z]         -------
[2023-07-27T07:48:55.983Z]         d : dict
[2023-07-27T07:48:55.983Z]             This has the appropriate entries for writing its string representation
[2023-07-27T07:48:55.983Z]             to the header of the file.
[2023-07-27T07:48:55.983Z]         """
[2023-07-27T07:48:55.983Z] >       d = {'shape': array.shape}
[2023-07-27T07:48:55.983Z] E       AttributeError: 'str' object has no attribute 'shape'
[2023-07-27T07:48:55.983Z] 
[2023-07-27T07:48:55.983Z] /usr/local/lib/python3.8/dist-packages/numpy/lib/format.py:357: AttributeError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions