How to realize Array transposition in numpy
This article mainly introduces the relevant knowledge of "how to achieve array transposition in numpy". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to realize array transposition in numpy" can help you solve the problem.
The code is as follows:
In [15]: arr1 = np.arange (20) In [16]: arr1Out [16]: array (5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]) In [17]: arr2 = arr1.reshape (4)) In [18]: arr2Out [18]: array ([0,1,2,3,4], [5,6,7,8,9], [10,11,12] 13, 14], [15, 16, 17, 18, 19]) In [19]: arr3 = arr2.TIn [20]: arr3Out [20]: array ([[0,5,10,15], [1,6,11,16], [2,7,12,17], [3,8,13,18], [4,9,14,19]) In [21]: np.dot (arr3,arr2) Out [21]: array ([350,380,410,440) 470], [380,414,448,482,516], [410,448,486,524,562], [440,482,524,566,608], [470,516,562,608,654]) so much for the introduction of "how to implement array transposition in numpy". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.