Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

array concatenation in 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

PREVIOUS NEXT
Code Example
Python :: numpy concatenation array 
Python :: with open 
Python :: how to use assert in python 
Python :: convert list of lists to numpy array matrix python 
Python :: python print every n loops 
Python :: how to create barcode in python 
Python :: pytorch cuda tensor in module 
Python :: how to append in dictionary in python 
Python :: input code for python 
Python :: python byte like to string 
Python :: reading the JSON from a JSON object 
Python :: python datetime floor to hour 
Python :: download images off unsplash python 
Python :: how to add a linebreak in python 
Python :: create column with values mapped from another column python 
Python :: python list contains string 
Python :: how to drop duplicate columns in pandas that dont have the same name? 
Python :: get index of all element in list python 
Python :: matrix multiplication nupy 
Python :: math module in python 
Python :: convert python script to exe 
Python :: python math functions 
Python :: Local to ISO 8601: 
Python :: python how to drop columns from dataframe 
Python :: how to declare private attribute in python 
Python :: python to postgresql 
Python :: uppercase python 
Python :: traversing dictionary in python 
Python :: poerty python macos 
Python :: python script that turns bluetooth on 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =