Skip to content

Value error thrown by empty array repr #3562

@ikrommyd

Description

@ikrommyd

Version of Awkward Array

main

Description and code to reproduce

To reproduce:

In [9]: ak.Array([])
Out[9]: ---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File ~/miniforge3/envs/ak-uproot/lib/python3.12/site-packages/IPython/core/formatters.py:1036, in MimeBundleFormatter.__call__(self, obj, include, exclude)
   1033     method = get_real_method(obj, self.print_method)
   1035     if method is not None:
-> 1036         return method(include=include, exclude=exclude)
   1037     return None
   1038 else:

File ~/Dropbox/work/coffea_dev/awkward/src/awkward/highlevel.py:1507, in Array._repr_mimebundle_(self, include, exclude)
   1503 # the rest of the rows we sort by the length of their '<prefix>:'
   1504 # but we sort it from longest to shortest for _repr_mimebundle_
   1505 sorted_rows = sorted(rows, key=lambda x: -len(x.split(":")[0]))
-> 1507 n_cols = max(map(len, header_lines))
   1508 body_lines = header_lines
   1509 body_lines.append("-" * n_cols)

ValueError: max() iterable argument is empty
<Array [] type='0 * unknown'>

Introduced by #3552

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThe problem described is something that must be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions