#1848·visdom

table() and html_table() reject a list of 1-D numpy rows they accept as a 2-D array

Author: thisisanubhavCreated Sep 21, 2026Updated Sep 21, 2026

Bug

table() and html_table() accept a 2-D numpy array, but reject the same data as a list of 1-D arrays:

python
import numpy as np
arr = np.array([[1, 2], [3, 4]])

vis.table(arr, headers=["a", "b"])        # works
vis.table(list(arr), headers=["a", "b"])  # AssertionError
AssertionError: each row in `data` should be a list or tuple

Iterating a 2-D array yields 1-D arrays, so list(arr), a comprehension over an array, or building rows with np.array(...) in a loop all land on this shape. The error doesn't help much either: the rows are row-shaped data, just not a list or tuple.

Why this looks like an oversight rather than a limit

Both functions go through _normalize_table_data in py/visdom/utils/shared_utils.py, which already accepts a 2-D numpy array explicitly and coerces numpy scalars inside cells. The test suite covers both of those separately (test_table_normalizes_tuple_rows_to_lists, test_table_coerces_numpy_cells_to_native_types). A list of 1-D arrays is just the combination of the two.

Expected

A list of 1-D numpy arrays is accepted and produces exactly the same pane as the 2-D array it came from. A row that is itself multi-dimensional should still be rejected.

I have a fix with tests ready and will open a PR.