About 302,000 results
Open links in new tab
  1. Rotating a two-dimensional array in Python - Stack Overflow

    In a program I'm writing the need to rotate a two-dimensional array came up. Searching for the optimal solution I found this impressive one-liner that does the job: rotated = zip(*original[::-1])

  2. numpy.rot90 — NumPy v2.2 Manual

    Rotate an array by 90 degrees in the plane specified by axes. Rotation direction is from the first towards the second axis. This means for a 2D array with the default k and axes , the rotation …

  3. numpy.rot90() in Python - GeeksforGeeks

    Mar 8, 2024 · The numpy.rot90() method performs rotation of an array by 90 degrees in the plane specified by axis(0 or 1). Syntax: numpy.rot90(array, k = 1, axes = (0, 1)) Parameters : array : …

  4. Using numpy.rot90 () function (6 examples) - Sling Academy

    Feb 29, 2024 · 270 degrees rotated array: [[7, 4, 1], [8, 5, 2], [9, 6, 3]] Example 3: Rotating Along Specific Axes. NumPy’s rot90() allows you to specify along which axes the rotation should …

  5. Rotating a 2D Array in Python 3 - DNMTechs - Sharing and …

    This example demonstrates how to rotate a 2D array by 90 degrees in Python. The function rotate_90_degrees takes a 2D array (matrix) as input and returns a new matrix that is rotated …

  6. A clever one-liner to rotate 2D Arrays in Python - Medium

    Sep 24, 2022 · Here’s a fun question: say you want to rotate an array 90 degrees clockwise, like so: How would you do it? [1,2,3], [4,5,6], [7,8,9], [7,4,1], [8,5,2], [9,6,3], I initially learned of a...

  7. python - Rotation of a 2D array over an angle using rotation matrix ...

    May 4, 2015 · If you specifically want 90, 180, or 270 degree rotations, which do not require interpolation, then numpy.rot90 is better. Matrix dimensions will need to be compatible in order …

  8. NumPy: Rotate array (np.rot90) | note.nkmk.me - nkmk note

    Jun 25, 2019 · Using numpy.rot90(), you can rotate the NumPy array ndarray by 90/180/270 degrees. numpy.rot90 — NumPy v1.16 Manual; This article describes the following contents. …

  9. NumPy: numpy.rot90() function - w3resource

    Mar 24, 2023 · Number of times the array is rotated by 90 degrees. The array is rotated in the plane defined by the axes. Axes must be different. Return value: y : ndarray - A rotated view of …

  10. Top 5 Methods to Rotate a Two-Dimensional Array in Python

    Nov 6, 2024 · If you have found yourself needing to rotate a two-dimensional array in Python, you’re in the right place. Below, we delve into several effective methods for performing this …

  11. Some results have been removed
Refresh