diff options
author | Michael Currie <mcurrie@bruceforceresearch.com> | 2015-04-17 11:55:11 -0600 |
---|---|---|
committer | Sebastian Berg <sebastian@sipsolutions.net> | 2015-09-27 16:14:43 +0200 |
commit | efd18a5455ea2b21eb0e3bd9ca9fab0d08e09526 (patch) | |
tree | be226f2c2f9a24d14e516cd8d132fbd7643050b6 /numpy/lib/shape_base.py | |
parent | 0752872542593bb8703977d5d1e458dbca0cb712 (diff) | |
download | numpy-efd18a5455ea2b21eb0e3bd9ca9fab0d08e09526.tar.gz |
BUG: Expanded warning conditions for array_split
Zero arrays can also occur with any of the partitions sub_arys[i]
induced by array_split, not just the final partition sub_arys[-1].
Modified by seberg.
Closes gh-5771
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r-- | numpy/lib/shape_base.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index 011434dda..481ae96e5 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -423,7 +423,7 @@ def array_split(ary, indices_or_sections, axis=0): # This "kludge" was introduced here to replace arrays shaped (0, 10) # or similar with an array shaped (0,). # There seems no need for this, so give a FutureWarning to remove later. - if sub_arys[-1].size == 0 and sub_arys[-1].ndim != 1: + if any(arr.size == 0 and arr.ndim != 1 for arr in sub_arys): warnings.warn("in the future np.array_split will retain the shape of " "arrays with a zero size, instead of replacing them by " "`array([])`, which always has a shape of (0,).", |