Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Array Rotation Solution
#4
it works as well (using a single line)
n = 2
arr = [1, 2, 3, 4, 5, 6, 7]
# arr = np.asarray(arr)
arr = np.hstack( (arr[n: ], arr[: n]))
Output:
arr = [3 4 5 6 7 1 2]
Reply


Messages In This Thread
Array Rotation Solution - by hannah - Mar-29-2022, 12:40 PM
RE: Array Rotation Solution - by DeaD_EyE - Mar-29-2022, 12:55 PM
RE: Array Rotation Solution - by hannah - Mar-31-2022, 05:59 AM
RE: Array Rotation Solution - by paul18fr - Mar-31-2022, 09:28 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python logging RotatingFileHandler writes to random file after the first log rotation rawatg 0 499 Feb-15-2024, 11:15 AM
Last Post: rawatg
  Calculate transformation and Rotation Sandra2312 1 1,863 Jan-31-2021, 12:53 PM
Last Post: jefsummers
  Level curves don't match after rotation schniefen 1 1,598 Dec-14-2020, 09:56 PM
Last Post: schniefen
  Rotation Effect on live Webcam Feed Leziiy 0 1,662 Sep-12-2020, 04:25 PM
Last Post: Leziiy
  Logger file rotation not working when python code started from windows service as exe nirvantosh 1 6,784 Jun-14-2019, 03:58 PM
Last Post: nirvantosh

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020