arr = np.array([[45, 45, 45, 50, 51, 50, 50, 50, 51, 50, 52], [45, 45, 45, 
    50, 51, 50, 50, 50, 51, 50, 51, 52, 55], [45, 45, 45, 50, 51, 50, 52, 
    50, 50, 50, 51], [50, 51, 52, 55, 50, 52, 50, 50, 50, 51, 50, 51]],
    dtype=object)

def slice_array(arr, num_cols, num_rows=None):
    if num_rows:
        return np.array([row[:num_cols] for row in arr[:num_rows]])
return np.array([row[:num_cols] for row in arr])
res1 = slice_array(arr, 4, 2)
res2 = slice_array(arr, 4)
How to transform an object into an array