-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Closed
Labels
Description
Calling np.hstack([ ]) throws an IndexError. It takes a bit more work to find out the root cause of the error, ie: the empty list.
>>> import numpy as np
>>> np.hstack([ ])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/numpy/core/shape_base.py", line 277, in hstack
if arrs[0].ndim == 1:
IndexError: list index out of range
np.vstack, on the other hand, throws a more appropriate error.
>>> np.vstack([ ])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/numpy/core/shape_base.py", line 230, in vstack
return _nx.concatenate([atleast_2d(_m) for _m in tup], 0)
ValueError: need at least one array to concatenate
Reactions are currently unavailable