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 :: django sessions for beginners 
Python :: python 
Python :: print data type array 
Python :: python printing hello world 
Python :: import python file from another directory 
Python :: How to count the occurrence of certain item in an ndarray? 
Python :: python queue not empty 
Python :: elementwise comparison list python 
Python :: argparse flag without value 
Python :: python print values inside request.POST 
Python :: import matplotlib pyplot as plt 
Python :: python discord know message from bot 
Python :: how to get the number of rows and columns in a numpy array 
Python :: plynomial regression implementation python 
Python :: python array find lambda 
Python :: django form field add attrs 
Python :: beautifulsoup find text inside tag 
Python :: concatenate list 
Python :: text generate gpt 2 huggingface 
Python :: python tkinter menu widget 
Python :: tuple in python 3 
Python :: how to take input in python as string and convert into integer list 
Python :: ngnix config 
Python :: how to find unique sublist in list in python 
Python :: how to end a while loop python 
Python :: How to efficiently search for a pattern string within another bigger one, in Python? 
Python :: django queryset and operator 
Python :: python online practice test 
Python :: what is serialization in django 
Python :: compound interest python 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =