NumPy split divides an array along an existing axis using equal sections or cut positions
Dividing an array is a question about positions before it is a question about numbers. A boundary separates neighbouring entries without sorting them or calculating a replacement value. Academia Master Trader explains NumPy split in English for readers in Lithuania. A small matrix lets us compare equal sections with explicit cut positions. We will record the input shape, name the selected axis and then read each output in order. These examples concern data organisation, not financial results or additional observations beyond the supplied values.
Begin with one matrix
After import numpy as np, define a = np.array([[8,3,6,2],[9,4,7,5]]). Its shape is (2,4): two rows and four columns. The first row is eight, three, six and two. The second row is nine, four, seven and five. Axis zero refers to the row dimension, while axis one refers to the column dimension. Each has its own length, so the same section count may have different meanings depending on the selected axis.
The NumPy documentation describes split as dividing an array into multiple subarrays that are views into the original. The result is a list of arrays, rather than one array with a new grouping axis. Keep the container and the individual output shapes separate when describing the operation. We will read the arrays in their returned order.
Divide the columns into equal sections
The call np.split(a,2,axis=1) returns two arrays. The first is [[8,3],[9,4]], and the second is [[6,2],[7,5]]. Each has shape (2,2). The selected axis has length four, and two equal sections each receive two columns. Both original rows remain represented in each output. The left section comes first, followed by the right section.
The integer two names the number of sections, not the number of columns to place in every section. Those descriptions happen to coincide here because four divided by two is two. With a different axis length, the same section count would produce a different section width. Read the argument's role rather than inferring it from this one numerical coincidence.
Divide the rows instead
The call np.split(a,2,axis=0) also returns two arrays, but each now has shape (1,4). They are [[8,3,6,2]] and [[9,4,7,5]]. The selected axis has length two, so each equal section receives one row. All four columns remain in each output. The extra brackets matter: these are two dimensional arrays with one row, not one dimensional arrays with four entries.
Follow seven across the examples. In the input it occupies (1,2). In the column division it belongs to the second output at (1,0). In the row division it belongs to the second output at (0,2). Its numerical value is unchanged. The boundary and the selected axis explain its new local coordinates.

Read explicit cut positions
The figure compares the input with the two equal column sections. Both outputs retain the original row order. The vertical boundary falls between column indices one and two. It does not represent a numerical threshold on the entries: three and four remain on the left because of their positions, not because of their sizes.
For a different arrangement, np.split(a,[1,3],axis=1) uses explicit cut positions. The returned arrays are [[8],[9]], [[3,6],[4,7]] and [[2],[5]], with shapes (2,1), (2,2) and (2,1). The first boundary is before column index one, and the second is before column index three. Two boundaries therefore create three sections. Equal widths are not required when explicit cut positions are supplied. The middle section contains the columns at original indices one and two. Its first local column is therefore not the first column of the input. Writing the original index range beside each section is a useful way to preserve that connection.
Check the selected length
An integer section count requires an equal division along the selected axis. For this input, np.split(a,3,axis=1) cannot divide four columns into three equal sections and raises a ValueError. The function does not silently distribute the remaining column. NumPy documents a separate function for near equal divisions; that is a different operation with its own rule.
Continue learning with Academia Master Trader at academiamastertrader.com.br and in Aprenda. Record the input shape, selected axis and whether the second argument means a section count or cut positions. Then write every output shape and trace one value through its local coordinates. This makes the division visible without mistaking boundaries for calculations.








