Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

repeat array along new axis

a = np.array([[1, 2], [1, 2]])
# indexing with np.newaxis inserts a new 3rd dimension, 
# which we then repeat the array along
b = np.repeat(a[:, :, np.newaxis], 3, axis=2)
print(b.shape)
# (2, 2, 3)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas describe kurtosis skewness 
Python :: element wise subtraction python list 
Python :: python data structures 9.4 
Python :: how to run cmd line commands in python 
Python :: max float python 
Python :: plt.annotate text size 
Python :: django clear all sessions 
Python :: knowing the sum null values in a specific row in pandas dataframe 
Python :: django unique together 
Python :: remove duplicate columns python dataframe 
Python :: python program for swapping position of two numbers 
Python :: E: Unable to locate package python-gobject 
Python :: Action based permissions in Django Rest V3+ 
Python :: script python to download videio from any website 
Python :: calculate the distance between two points 
Python :: show equation using geom_smooth 
Python :: list of seaborn color palette 
Python :: pattern in python 
Python :: openpyxl full tutorial 
Python :: how to print answer 2 decimal places in python 3 
Python :: reverse the words in a string python 
Python :: how to use static files in django 
Python :: how to use pafy 
Python :: strip all elements in list python 
Python :: flask migrate 
Python :: how to make an infinite loop python 
Python :: strip first occurence of substring python 
Python :: python webdriver disable logs 
Python :: odd or even in python 
Python :: python set day of date to 1 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =