Skip to content

Commit 22bc015

Browse files
Empty table and maxheadercolwidths
Consistency between processing of `maxcolwidths` and `maxheadercolwidths`.
1 parent 74885be commit 22bc015

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tabulate/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2262,7 +2262,10 @@ def tabulate(
22622262
)
22632263

22642264
if maxheadercolwidths is not None:
2265-
num_cols = len(list_of_lists[0])
2265+
if len(list_of_lists):
2266+
num_cols = len(list_of_lists[0])
2267+
else:
2268+
num_cols = 0
22662269
if isinstance(maxheadercolwidths, int): # Expand scalar for all columns
22672270
maxheadercolwidths = _expand_iterable(
22682271
maxheadercolwidths, num_cols, maxheadercolwidths

0 commit comments

Comments
 (0)