HTTP/2 200
date: Thu, 31 Jul 2025 02:38:57 GMT
content-type: text/html; charset=utf-8
server: cloudflare
x-origin-cache: HIT
last-modified: Fri, 25 Jul 2025 11:41:59 GMT
access-control-allow-origin: *
expires: Thu, 31 Jul 2025 02:48:57 GMT
cache-control: max-age=600
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=YeM%2BUx1nO08Hrvd7o2qOjfhJIBKO0n9ui0duaaX%2B5PjkjvKCL6zwu2p8TDT7rkLRqZ5DutfnmNnaG3Y6OeCkmSreoxYogG4nNQ%3D%3D"}]}
x-proxy-cache: MISS
x-github-request-id: 8200:1BFD35:153C0:1EFBE:688AD740
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
age: 0
via: 1.1 varnish
x-served-by: cache-bom-vanm7210077-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753929537.946606,VS0,VE227
vary: Accept-Encoding
x-fastly-request-id: db71f240b6178ec544eebe2703e1dcd849976493
cf-cache-status: DYNAMIC
content-encoding: gzip
cf-ray: 9679b8f5af2a47c9-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])]