Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

numpy concatenation python

#// required library
import numpy as npy

#// define 3 (1D) numpy arrays
arr1 = npy.array([10, 20, 30])
arr2 = npy.array([40, 50, 60])
arr3 = npy.array([70, 80, 90])

arrCon = npy.concatenate([arr1, arr2, arr3])
print(arrCon)

#// concatenation can also happen with 2D arrays
arr1_2d = npy.array([
  [10, 20, 30],
  [40, 50, 60]
])
arr2_2d = npy.array([
  [11, 22, 33],
  [44, 55, 66]
])

arr_2dCon = npy.concatenate([arr1_2d, arr2_2d])
print(arr_2dCon)
Comment

concatenate strings of numpy array python

a=np.array(['ab','cd','ef','gh'])
''.join(a)

#Output: 'abcdefgh'
Comment

PREVIOUS NEXT
Code Example
Python :: multiple model search in django rest framework 
Python :: dataframe rolling window 
Python :: plotly facet_grid python 
Python :: how to pre populate field flask wtforms 
Python :: python telegram bot async 
Python :: plot circles in matplotlib 
Python :: python - match two df on a variable with different name 
Python :: how to access a file from root folder in python project 
Python :: selenium webdriver without opening browser 
Python :: Access field values of form django 
Python :: python change label text 
Python :: python running mean pandas 
Python :: python find oldest and newest date 
Python :: Function in python with input method 
Python :: python melt 
Python :: string in python 
Python :: Merge two Querysets in Python Django while preserving Queryset methods 
Python :: # Python string capitalization 
Python :: Tree: Postorder Traversal 
Python :: python how to iterate through a list of lists 
Python :: flask windows auto reload 
Python :: sorted python 
Python :: how to use pyttsx3 
Python :: cv2 videowriter python not working 
Python :: package in python 
Python :: nltk python how to tokenize text 
Python :: splitting strings in python 
Python :: date and time in python 
Python :: python module has no attribute 
Python :: get first digit of number 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =