HTTP/2 200
date: Wed, 31 Dec 2025 04:36:15 GMT
content-type: text/html; charset=utf-8
server: cloudflare
x-origin-cache: HIT
last-modified: Sun, 21 Dec 2025 15:49:15 GMT
access-control-allow-origin: *
expires: Wed, 31 Dec 2025 04:46:15 GMT
cache-control: max-age=14400
report-to: {"group":"cf-nel","max_age":604800,"endpoints":[{"url":"https://a.nel.cloudflare.com/report/v4?s=olV10JDdW1IqT9ea6Na3ViAPt8JWUFSeTwFYUiQa41nsuUOM3xZ9rk5BS3CHAltmi7NpWOSYg6krGd6PfBrmaiKWd%2FZ3TKp03w%3D%3D"}]}
x-proxy-cache: MISS
x-github-request-id: 1CC7:292AC1:ABC4BD:C14465:6954A83E
nel: {"report_to":"cf-nel","success_fraction":0.0,"max_age":604800}
age: 0
via: 1.1 varnish
x-served-by: cache-bom-vanm7210067-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1767155775.986667,VS0,VE202
vary: Accept-Encoding
x-fastly-request-id: ce1df6c38d91a2d042c9d5d849e44653f55768cd
cf-cache-status: MISS
content-encoding: gzip
cf-ray: 9b6713295ce73afe-BOM
alt-svc: h3=":443"; ma=86400
numpy.array_split — NumPy v2.4 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])]