diff options
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r-- | numpy/lib/shape_base.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index a3fbee3d5..b600b70f6 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -885,7 +885,7 @@ def hsplit(ary, indices_or_sections): Please refer to the `split` documentation. `hsplit` is equivalent to `split` with ``axis=1``, the array is always split along the second - axis regardless of the array dimension. + axis except for 1-D arrays, where it is split at ``axis=0``. See Also -------- @@ -933,6 +933,12 @@ def hsplit(ary, indices_or_sections): array([[[2., 3.]], [[6., 7.]]])] + With a 1-D array, the split is along axis 0. + + >>> x = np.array([0, 1, 2, 3, 4, 5]) + >>> np.hsplit(x, 2) + [array([0, 1, 2]), array([3, 4, 5])] + """ if _nx.ndim(ary) == 0: raise ValueError('hsplit only works on arrays of 1 or more dimensions') |