Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

rotate matrix python

numpy.rot90(array, k=number_rotations, axes=(0, 1))
Comment

Make Rotation matrix in Python

In [x]: theta = np.radians(30)
In [x]: c, s = np.cos(theta), np.sin(theta)
In [x]: R = np.array(((c, -s), (s, c)))
Out[x]: print(R) 
[[ 0.8660254 -0.5      ]
 [ 0.5        0.8660254]]
Comment

matrix rotation in python

def rotate(matrix):
    rows = len(matrix)
    cols = len(matrix[0])
    res = []
    for i in range(cols):
        temp = []
        for j in range(rows):
            temp.append(matrix[j][i])
        res.append(temp[::-1])

    return res


matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
print(rotate(matrix))
Comment

PREVIOUS NEXT
Code Example
Python :: python window icon on task bar 
Python :: import django concat 
Python :: django get fields data from object model 
Python :: Check if the url is reachable or not in Python 
Python :: how to redirect in django 
Python :: python readlines end of file 
Python :: numpy array sorting 
Python :: python if 
Python :: c++ call python function 
Python :: json and python login system 
Python :: how to use random tree in python 
Python :: python minigame 
Python :: square root python 3 
Python :: deleting in a text file in python 
Python :: python absolute path 
Python :: read .mat file in python 
Python :: python random walk 
Python :: concatenation in python 3 
Python :: pd.get_dummies 
Python :: tkinter dialog box 
Python :: how to make button in python 
Python :: capture image raspberry pi usb camera 
Python :: python exec script 
Python :: python asyncio gather 
Python :: python advanced programs time module 
Python :: how to get number after decimal point 
Python :: laplace transform python 
Python :: print string and variable python 
Python :: Matplotlib inside Jupyter | Jupyter generate graphs. 
Python :: series.string.split expand 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =