Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
>>>
>>> sheet = from_array(arr)
>>> display(sheet)
"""
if len(array.shape) > 2:
raise RuntimeError('The NumPy Array should be of 1-D or 2-D')
rows = array.shape[0]
columns = 1 if len(array.shape) == 1 else array.shape[1]
kwargs = {
'numeric_format': get_cell_numeric_format(array.dtype),
'type': get_cell_type(array.dtype)
}
out_sheet = sheet(rows=rows, columns=columns)
if columns == 1:
column(0, array, **kwargs)
else:
cell_range(array, **kwargs)
return out_sheet