HTTP/2 200
date: Tue, 29 Jul 2025 07:03:42 GMT
content-type: text/html; charset=utf-8
server: cloudflare
x-origin-cache: HIT
last-modified: Fri, 25 Jul 2025 11:42:00 GMT
access-control-allow-origin: *
expires: Tue, 29 Jul 2025 07:13:42 GMT
cache-control: max-age=600
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=yNW6s7wKljbypz4g2j4%2F%2FcnTwR3TIPH7j4lxIEIO6U9YzS3wJSBUVjHNfCr0Scfq0GMQ7LzetEQIa%2FkMpGz01TKTtyI%2BQW46uw%3D%3D"}]}
x-proxy-cache: MISS
x-github-request-id: 57E7:136977:50F01:63A90:6888724D
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
age: 0
via: 1.1 varnish
x-served-by: cache-bom-vanm7210095-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753772623.619617,VS0,VE210
vary: Accept-Encoding
x-fastly-request-id: 3f90acdb9c8619f6bb5ceea9bd6b65bde501b200
cf-cache-status: DYNAMIC
content-encoding: gzip
cf-ray: 966ac20b1b40db81-BOM
alt-svc: h3=":443"; ma=86400
numpy.array_split — NumPy v2.3 Manual
Back to top
numpy.array_split
numpy. array_split ( ary , indices_or_sections , axis = 0 ) [source]
Split an array into multiple sub-arrays.
Please refer to the split
documentation. The only difference
between these functions is that array_split
allows
indices_or_sections to be an integer that does not equally
divide the axis. For an array of length l that should be split
into n sections, it returns l % n sub-arrays of size l//n + 1
and the rest of size l//n.
See also
split
Split array into multiple sub-arrays of equal size.
Examples
Try it in your browser!
>>> import numpy as np
>>> x = np . arange ( 8.0 )
>>> np . array_split ( x , 3 )
[array([0., 1., 2.]), array([3., 4., 5.]), array([6., 7.])]
>>> x = np . arange ( 9 )
>>> np . array_split ( x , 4 )
[array([0, 1, 2]), array([3, 4]), array([5, 6]), array([7, 8])]