tableprint.table
takes a 2D array as first parameter, your array m
is only 1D.
data : array_like
An (m x n) array containing the data to print (m rows of n columns)
So you need to convert m
to a 2D array:
tp.table(m[np.newaxis], headers)
Result:
╭───────┬───────┬───────┬───────╮
│ name1 │ name2 │ name3 │ name4 │
├───────┼───────┼───────┼───────┤
│ 1 │ 2 │ 3 │ 4 │
╰───────┴───────┴───────┴───────╯
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…