Linear matrix transpose query

Hi

I tried to run a code by converting a matrix into a linear matrix, then taking it’s transpose.
Before transpose order of matrix is (1,4).
And after transpose also order remains the same, i.e matrix remains unchanged.Please check where is the problem.
Following is my code:
import numpy as np
x=np.array([[4,5],[8,9]])
k=x.reshape((-1,))
print(k)
kt=np.transpose((k))
print(kt)

Hey @pasta, before taking transpose shape of k is (4,) and not (1,4). You should replace this line k=x.reshape((-1,))
by
k=x.reshape((1,4)) or k=x.reshape((1,-1)).

Then you will get desired output.

Hope this cleared your doubt.
Plz mark the doubt as resolved in my doubts section. :blush: