NumPy Array Operations

Suppose I have a 2 dimensional array as Square_sq;-
When i perform the following operations the resultant array is one dimensional:-
I want the resultant array Square_sum to be a 2 dimensional array. How can I do it?

It is conventional that summing up a 2-D array along some axis will give out 1-D array.
You can later reshape it into a 2-D array as :

square_sum.reshape(1, square_sum.shape[0])
1 Like