Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

np.pad

>>> np.pad(a, [(1, ), (2, )], mode='constant')
array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
       [ 0.,  0.,  1.,  1.,  1.,  1.,  1.,  0.,  0.],
       [ 0.,  0.,  1.,  1.,  1.,  1.,  1.,  0.,  0.],
       [ 0.,  0.,  1.,  1.,  1.,  1.,  1.,  0.,  0.],
       [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]])
Comment

np.pad

>>> np.pad(a, [(1, 0), (2, 0)], mode='constant')
array([[ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.],
       [ 0.,  0.,  1.,  1.,  1.,  1.,  1.,  0.,  0.],
       [ 0.,  0.,  1.,  1.,  1.,  1.,  1.,  0.,  0.],
       [ 0.,  0.,  1.,  1.,  1.,  1.,  1.,  0.,  0.],
       [ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.,  0.]])
Comment

PREVIOUS NEXT
Code Example
Python :: delete function python 
Python :: string functions 
Python :: if then else python 
Python :: if it is square python 
Python :: python ternary operators 
Python :: slider python 
Python :: filter dictionary python 
Python :: numpy indexing 
Python :: Fill in the empty function so that it returns the sum of all the divisors of a number, without including it. A divisor is a number that divides into another without a remainder. 
Python :: show which columns in dataframe have NA 
Python :: upload image to s3 python 
Python :: Simple example of python strip function 
Python :: np.random.randint 
Python :: doing math in python 
Python :: re python 
Python :: python 3.9 release date 
Python :: check if object is list python 
Python :: axes_style seaborn 
Python :: how to create multiple dictionaries in python 
Python :: odd number in python 
Python :: pandas explode 
Python :: the requested resource was not found on this server. django 
Python :: how to get runtime of a function in python 
Python :: text to png python 
Python :: adding in python 
Python :: Use the correct syntax to print the first item in the fruits tuple. 
Python :: python numpy euler 
Python :: simple plt plot 
Python :: py to flag converter online 
Python :: fb account api grabber 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =