Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/awkward/highlevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1504,7 +1504,7 @@ def _repr_mimebundle_(self, include=None, exclude=None):
# but we sort it from longest to shortest for _repr_mimebundle_
sorted_rows = sorted(rows, key=lambda x: -len(x.split(":")[0]))

n_cols = max(map(len, header_lines))
n_cols = max(map(len, header_lines), default=0)
body_lines = header_lines
body_lines.append("-" * n_cols)
body_lines.extend(sorted_rows)
Expand Down Expand Up @@ -2446,7 +2446,7 @@ def _repr_mimebundle_(self, include=None, exclude=None):
# but we sort it from longest to shortest for _repr_mimebundle_
sorted_rows = sorted(rows, key=lambda x: -len(x.split(":")[0]))

n_cols = max(map(len, header_lines))
n_cols = max(map(len, header_lines), default=0)
body_lines = header_lines
body_lines.append("-" * n_cols)
body_lines.extend(sorted_rows)
Expand Down
12 changes: 12 additions & 0 deletions tests/test_3564_length0_highlevel_repr.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from __future__ import annotations

import awkward as ak


def test():
length0 = ak.Array([])
assert repr(length0) == "<Array [] type='0 * unknown'>"
assert length0._repr_mimebundle_() == {
"text/html": "<pre>\nbackend: cpu\nnbytes: 0 B\ntype: 0 * unknown</pre>",
"text/plain": "<Array [] type='0 * unknown'>",
}
Loading