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 :: Adding a new column in pandas dataframe from another dataframe with different index 
Python :: python date time 
Python :: create and activate virtual environment with python 3 
Python :: python set split limit 
Python :: python class without init 
Python :: pygame rect 
Python :: flask multuple parameters 
Python :: np.all 
Python :: serialize list to json python 
Python :: how to do input python 
Python :: python count how many times a word appears in a string 
Python :: remove figure label 
Python :: seaborn orient 
Python :: python mongodump 
Python :: looping over lists in python 
Python :: python codes for counting the occurrence of a letters in dictionary excluding digits 
Python :: sample hierarchical clustering 
Python :: nrf24l01 arduino to raspberry pi struct 
Python :: remove python 2.7 centos 7 
Python :: how to print random in python 
Python :: python TypeError: function takes positional arguments but were given 
Python :: python sleep command 
Python :: docstring in python 
Python :: Python DateTime Class Syntax 
Python :: python count appearances in list 
Python :: matplotlib multiple bar plot 
Python :: delete file in django terminal 
Python :: how to import data in python 
Python :: python check if number contains digit 
Python :: List Get a Element 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =