-1

I have a numpy array :

ar = [[1,2],[3,4],[5,6]]

I want to convert it to :

ar = [[1,3,5],[2,4,6]]

I have tried numpy reshape function it did not work. Is there any way to reshape it using numpy reshape method or any other way??

Thank you.

Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70
VipinSC
  • 11
  • 4

1 Answers1

0

Use Transpose (.T)

ar = np.array([[1,2],[3,4],[5,6]])
ar.T
Gilseung Ahn
  • 2,598
  • 1
  • 4
  • 11