Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

How can I Duplicate 1 Dimensional array

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

import numpy as np

np_array_1d = np.array([1,2,3,4])
np_array_2d = np.expand_dims(np_array_1d, axis = 0)
ans = np.repeat(a = np_array_2d, repeats = 2, axis = 0)
print(ans)
Comment

PREVIOUS NEXT
Code Example
Python :: Python NumPy dsplit Function Syntax 
Python :: Python NumPy vsplit Function 
Python :: get method from plot 
Python :: midpoint line drawing algorithm 
Python :: if statment with logical or operator for multiple varaibles 
Python :: python __truediv__ 
Python :: Python __ge__ magic method 
Python :: palindrome rearrange 
Python :: python mxs Classof 
Python :: track keyboard press pynput 
Python :: saving specific column with pd 
Python :: Convertion of an array into binary using NumPy binary_repr 
Python :: Printing a long code line to span over multiple lines 
Python :: # remove sensitive information like name, email, phone no from text 
Python :: gensim prepare corpus 
Python :: Remove Brackets from List Using the Translate method 
Python :: python special methods list 
Python :: download Twitter Images with BeautifulSoup 
Python :: map reduce and filter functions in python 
Python :: map function in pyhton 
Python :: find sum of all elements in a matrix by python 
Python :: Redirect to the same page and display a message if user insert wrong data 
Python :: python while loop command gaming code 
Python :: connect labjack to python 
Python :: ring convert string lines to list items and convert the list to a string 
Python :: list duplicate files in folder python 
Python :: python adx indicator 
Python :: django recapcha 
Python :: idiomatic python 
Python :: rounding with .2g gives strange results 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =