Skip to content

scalar arrays break dumps to Excel #873

Open
@gdementen

Description

@gdementen
>>> scalar_arr = where(True, 5, 10)
>>> arr = stack({'a': scalar_arr, 'b': 'a'}, 'test')
>>> with open_excel() as wb:
>>>     wb[0] = arr.dump()
TypeError: Objects for SAFEARRAYS must be sequences (of sequences), or a buffer object.

Unsure where this should be fixed though. In Array.dump() (there is already some code in there trying to fix this kind of issues but for other numpy types)? in xw_excel.Sheet.__setitem__? in xlwings? in stack() (but see below for a way to create the array without stack)?

See note at https://github.com/larray-project/larray/blob/master/larray/core/array.py#L2500 for a discussion about this.

>>> scalar_arr = where(True, 5, 10)
>>> arr = full(1, None, dtype=object)
>>> arr[0] = scalar_arr

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions