Even after using a.T (Transpose of a) to broadcast it to b for addition, it didn’t, does it mean that one dimensional array cannot be transposed.

Transpose of 1-d np array is same.

You will need to reshape either a or b into 2-d ( `1 x n`

or `n x 1`

matrix ) for broadcast to work in this case :

a = a.reshape(1, 4)

a.T + b

or

b=b.reshape(5,1)

a.T + b

Two cases above will produce 4x5 or 5x4 matrix, depending on how you use it.

1 Like