sthoooon
2/12/2017 - 8:18 AM

Array Splitting: N split-points, leads to N + 1 subarrays

Array Splitting: N split-points, leads to N + 1 subarrays

import numpy as np

x = [1, 2, 3, 99, 99, 3, 2, 1]
x1, x2, x3 = np.split(x, [3, 5])
print(x1, x2, x3) # = [1 2 3] [99 99] [3 2 1]

upper, lower = np.vsplit(grid, [2])
left, right = np.hsplit(grid, [2])

from numpy import hsplit, vsplit, split, dsplit
print hsplit(a,3) #Split along horizontally
print split(a,3, axis=1) #Same as hsplit
print vsplit(a,3) #Split along vertically
print split(a,3, axis = 0) #Same as vsplit
c = arange(27).reshape(3,3,3)
print c
print dsplit(c,3) #Split along depth(floor)