Answers for "numpy split to chunks of equal size"

0

numpy split to chunks of equal size

def build_chunks(arr, chunk_size, axis=1):
     return np.split(arr, 
                     range(chunk_size, arr.shape[axis], chunk_size), axis=axis)
Posted by: Guest on October-10-2021
-1

Numpy split array into chunks of equal size

def split_given_size(a, size):
    return np.split(a, np.arange(size,len(a),size))
Posted by: Guest on October-10-2021

Code answers related to "numpy split to chunks of equal size"

Python Answers by Framework

Browse Popular Code Answers by Language