“Numpy Roll” Code-Antworten

Numpy Rollsyntax

numpy.roll(array, shift, axis = None)
Outrageous Ostrich

Numpy Roll

import numpy as np
from scipy.ndimage.interpolation import shift

xs = np.array([ 0.,  1.,  2.,  3.,  4.,  5.,  6.,  7.,  8.,  9.])

shift(xs, 3, cval=np.NaN)
Kind Koala

Numpy Roll -Beispiel

# welcome to softhunt.net
# Python Program illustrating
# numpy.roll() method

import numpy as np

array = np.arange(9).reshape(3, 3)
print("Original array : \n", array)

# Rolling array; Shifting one place
print("\nRolling with 1 shift : \n", np.roll(array, 1))

# Rolling array; Shifting five places
print("\nRolling with 5 shift : \n", np.roll(array, 5))

# Rolling array; Shifting five places with 0th axis
print("\nRolling with 2 shift with 0 axis : \n", np.roll(array, 2, axis = 0))
Outrageous Ostrich

Ähnliche Antworten wie “Numpy Roll”

Fragen ähnlich wie “Numpy Roll”

Weitere verwandte Antworten zu “Numpy Roll” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen