matlab number of elements in array greater than code example

Example 1: numpy array with 2 times each value

>>> np.repeat(3, 4)
array([3, 3, 3, 3])

>>> x = np.array([1,2,3,4])
>>> np.repeat(x, 2)
array([1, 1, 2, 2, 3, 3, 4, 4])

Example 2: how to average only positive number in array numpy

a = [[1, 2, 3, -1, -2, -3, -4, -1, 1, 2, 1, 2, 3, 2, 5],
     [1, 2, 3, -1, -2, -3, -4, -1, 1, 2, 1, 2, 3, 2, 5],
     [1, 2, 3, -1, -2, -3, -4, -1, 1, 2, 1, 2, 3, 2, 5]]

b = np.array(a)

def avg(a):
    return a[a > 0].mean()

np.apply_along_axis(avg, 1, b)