Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

NumPy roll Example

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

import numpy as np

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

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

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

# Rolling array; Shifting five places with 0th axis
print("
Rolling with 2 shift with 0 axis : 
", np.roll(array, 2, axis = 0))
Comment

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)
Comment

NumPy roll Syntax

numpy.roll(array, shift, axis = None)
Comment

PREVIOUS NEXT
Code Example
Python :: python repr vs str 
Python :: bitwise xor in python 
Python :: how to add condition if null value in django orm 
Python :: python dictionary print key value ascending order 
Python :: index of and last index of in python 
Python :: keras model 2 outputs 
Python :: local time in python 
Python :: how to check if how much time is your code taking to run in python 
Python :: pygame rect 
Python :: Syntax of Opening a File in python 
Python :: for loop only for first 10 python 
Python :: next day in python 
Python :: all python versions 
Python :: Default stride value in keras 
Python :: dynamically create python dictionary 
Python :: how to form .cleaned data in class based views in django 
Python :: how to chose right epoch 
Python :: closures in python 
Python :: unicode error python 
Python :: how to add axis labels to a plotly barchart 
Python :: find index of value in list python 
Python :: net way to print 2d array 
Python :: python create dictionary 
Python :: how to get a list of all variables in memory python 
Python :: Python DateTime Class Syntax 
Python :: nth catalan number 
Python :: Sendgrid dynamic templating 
Python :: len dictionary python 
Python :: aws lambda logging with python logging library 
Python :: kaspersky 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =