Skip to content

Commit 392be0f

Browse files
authored
Fix separating line detection with ndarray values
This code: ``` import numpy as np from tabulate import tabulate data = [[np.ones(1)]] print(tabulate(data)) ``` Throws a `FutureWarning` or a `ValueError` due to the comparison with `SEPARATING_LINE`. Fixes #287
1 parent 95ae5eb commit 392be0f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tabulate/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ def _is_file(f):
105105
def _is_separating_line(row):
106106
row_type = type(row)
107107
is_sl = (row_type == list or row_type == str) and (
108-
(len(row) >= 1 and row[0] == SEPARATING_LINE)
109-
or (len(row) >= 2 and row[1] == SEPARATING_LINE)
108+
(len(row) >= 1 and row[0] is SEPARATING_LINE)
109+
or (len(row) >= 2 and row[1] is SEPARATING_LINE)
110110
)
111111
return is_sl
112112

0 commit comments

Comments
 (0)