For example, I have a array X [1, 3, 2, 5, 1, 3], I need a new array like a moving window, find the smallest in every 3 items ==> [1, 1, 1, 2, 1, 1]
I know I can loop from array len() and use list slip, but Is there a pythonic way for this problem?
I tried X[1] and found type(X[1]) is a int and cannot trace back the the array X.
Thank you for your help.
edited: sorry for the inconvenient. i made a mistake above. for window 1, only the first element 1, so output 1 window 2: [1,3] -> 1 window 3: [1, 3, 2] -> 1 window 4: [3, 2, 5] -> 2
btw the anwsers is very helpful. thank you.