NumPy TutorialLesson 13Free preview
NumPy Array Split
This lesson is part of NumPy · All levels
Summary
The array splitting is done by np.array_split which divides the array into several sized parts that may not be the same. There are also hsplits for column breakdown and vsplits for row breakdown. This function is the opposite of concatenate and is often used to divide a dataset into batches.
Key points
- Np.array_split(array, n) divides the array into n parts.
- If the element is not divided, the first part will be slightly larger.
- Hsplit divides the array by column, vsplit by row.
- The result of the split is a list containing new arrays.
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.