Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

transpose matrix numpy

>>> a = np.array([[1, 2], [3, 4]])
>>> a
array([[1, 2],
       [3, 4]])
>>> a.transpose()
array([[1, 3],
       [2, 4]])
>>> a.transpose((1, 0))
array([[1, 3],
       [2, 4]])
>>> a.transpose(1, 0)
array([[1, 3],
       [2, 4]])
Comment

numpy transpose

>>> np.transpose(x)
array([[0, 2],
       [1, 3]])
Comment

numpy transpose

ndarray.T

x = np.array([[1.,2.],[3.,4.]])
>>> x
array([[ 1.,  2.],
       [ 3.,  4.]])
>>> x.T
array([[ 1.,  3.],
       [ 2.,  4.]])
>>> x = np.array([1.,2.,3.,4.])
>>> x
array([ 1.,  2.,  3.,  4.])
>>> x.T
array([ 1.,  2.,  3.,  4.])
Comment

transpose of a matrix in python numpy

np.transpose(x)
array([[0, 2],
       [1, 3]])
Comment

Python NumPy transpose Function Syntax

numpy.transpose(a, axes=None)
Comment

transpose of a matrix using numpy

M = np.matrix([[1,2],[3,4]])

M.transpose()
Comment

PREVIOUS NEXT
Code Example
Python :: bytestring python 
Python :: cin python 
Python :: extract specific key values from nested dictionary 
Python :: bad request 400 heroku app 
Python :: horizontal barplot 
Python :: get last x elements of list python 
Python :: if a specific column name is present drop tyhe column 
Python :: datatime add time in float 
Python :: iterate over rows in numpy matrix python 
Python :: variable bound to a set python 
Python :: django convert model to csv 
Python :: sqlalchemy one to one foreign key 
Python :: python how to add a new key to a dictionary 
Python :: python get website chrome network tab 
Python :: pandas check length of string 
Python :: django filter values with OR operator 
Python :: create an array filled with 0 
Python :: repeat a condition n times one by one python 
Python :: binary tree python 
Python :: class chain methods python 
Python :: how to take first half of list python 
Python :: python largest common divisor 
Python :: import pyx file 
Python :: How to Join list element into a string in python 
Python :: geopandas replace column name 
Python :: Reversing Ints 
Python :: python projects 
Python :: how to extract values from a dictionary 
Python :: python running mean pandas 
Python :: python dlib 
ADD CONTENT
Topic
Content
Source link
Name
5+1 =