NumPy > Add & remove array data

Name
Code
Output
array1 = numpy.random.randint(5, size=(2, 3))
print ("array \n",array1)
array2 = numpy.random.randint(5, size=(1, 3))
print ("array \n",array2)
result = numpy.append(array1,array2,axis=0)
print ("append result \n",result)
array 
 [[4 3 1]
 [4 0 3]]
array 
 [[4 2 3]]
append result 
 [[4 3 1]
 [4 0 3]
 [4 2 3]]
array = numpy.random.randint(5, size=(2, 3))
print ("array \n",array)
result = numpy.insert(array,1,7,axis=1)
print ("insert column result \n",result)
array 
 [[1 1 3]
 [2 0 4]]
insert column result 
 [[1 7 1 3]
 [2 7 0 4]]
array = numpy.random.randint(5, size=(2, 3))
print ("array \n",array)
result = numpy.insert(array1,1,7,axis=0)
print ("insert row result \n",result)
array 
 [[1 3 4]
 [2 0 4]]
insert row result 
 [[2 4 3]
 [7 7 7]
 [0 0 1]]
array = numpy.random.randint(5, size=(2, 3))
print ("array \n",array)
result = numpy.delete(array,1,axis=1)
print ("remove column result \n",result)
array 
 [[0 1 0]
 [3 1 2]]
remove column result 
 [[0 0]
 [3 2]]
array = numpy.random.randint(5, size=(2, 3))
print ("array \n",array)
result = numpy.delete(array,1,axis=0)
print ("remove row result \n",result)
array 
 [[4 0 0]
 [3 1 4]]
remove row result 
 [[4 0 0]]
array1 = numpy.random.randint(5, size=(2, 3))
print ("array1 \n",array1)
array2 = numpy.random.randint(5, size=(2, 3))
print ("array2 \n",array2)
result = numpy.column_stack((array1,array2))
print ("stack result \n",result)
array1 
 [[3 2 4]
 [2 4 3]]
array2 
 [[3 1 4]
 [3 1 4]]
stack result 
 [[3 2 4 3 1 4]
 [2 4 3 3 1 4]]
array1 = numpy.random.randint(5, size=(1, 3))
print ("array1 \n",array1)
array2 = numpy.random.randint(5, size=(1, 3))
print ("array2 \n",array2)
result = numpy.concatenate((array1,array2),axis=0)
print ("concatenate result \n",result)
array1 
 [[2 4 1]]
array2 
 [[2 2 1]]
concatenate result 
 [[2 4 1]
 [2 2 1]]
array = numpy.random.randint(5, size=(1, 4))
print ("array \n",array)
result = numpy.delete(array,[1])
print ("delete item result \n",result)
array 
 [[1 2 2 0]]
delete item result 
 [1 2 0]
array = numpy.random.randint(5, size=(3, 4))
print ("array \n",array)
result = numpy.hsplit(array,2)
print ("split result1 \n",result[0])
print ("split result2 \n",result[1])
array 
 [[1 4 2 3]
 [3 4 3 3]
 [4 1 0 4]]
split result1 
 [[1 4]
 [3 4]
 [4 1]]
split result2 
 [[2 3]
 [3 3]
 [0 4]]
array = numpy.random.randint(5, size=(3, 4))
print ("array \n",array)
result = numpy.vsplit(array,3)
print ("split result1 \n",result[0])
print ("split result2 \n",result[1])
array 
 [[1 4 4 4]
 [2 2 1 4]
 [3 2 3 3]]
split result1 
 [[1 4 4 4]]
split result2 
 [[2 2 1 4]]
array1 = numpy.random.randint(5, size=(1, 3))
print ("array1 \n",array1)
array2 = numpy.random.randint(5, size=(1, 3))
print ("array2 \n",array2)
result = numpy.hstack((array1,array2))
print ("stack result \n",result)
array1 
 [[3 1 1]]
array2 
 [[1 2 0]]
stack result 
 [[3 1 1 1 2 0]]
array1 = numpy.random.randint(5, size=(1, 3))
print ("array1 \n",array1)
array2 = numpy.random.randint(5, size=(1, 3))
print ("array2 \n",array2)
result = numpy.vstack((array1,array2))
print ("stack result \n",result)
array1 
 [[0 0 4]]
array2 
 [[0 3 2]]
stack result 
 [[0 0 4]
 [0 3 2]]