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 :: check dictionary values pandas dataframe colu 
Python :: model coefficients 
Python :: how to find a specific word in a list python 
Python :: django insert bulk data 
Python :: dict comprehension python 
Python :: python dataframe add rank column 
Python :: how to exit a loop in python 
Python :: how to specify root geometry in tkinter 
Python :: duplicate a list with for loop in python 
Python :: how to plot a pandas dataframe with matplotlib 
Python :: sqlite python select with parameters 
Python :: python write a line to a file 
Python :: save jupyter notebook session 
Python :: repl.it secret 
Python :: python write column csv 
Python :: pandas replace multiple values in column 
Python :: pandas read parquet from s3 
Python :: python last index of item in list 
Python :: python ceil method 
Python :: index of and last index of in python 
Python :: how to get quarter year date in pandas 
Python :: iterrows pandas 
Python :: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. 
Python :: remove figure label 
Python :: remove punctuation from a string 
Python :: how to chose right epoch 
Python :: defaultdict item count 
Python :: a function to create a null matrix in python 
Python :: topological sort 
Python :: standard noramlization 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =