Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Python NumPy insert Function Example Working with Scalars

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

import numpy as np

# Working on 2D array
arr = np.arange(12).reshape(3, 4)
print("2D arr : 
", arr)
print("Shape : ", arr.shape)

# Working with Scalars
a = np.insert(arr, [1], [[6],[9],], axis = 0)
print("
Array after insertion : 
", a)
print("Shape : ", a.shape)

# Working with Scalars
a = np.insert(arr, [1], [[8],[7],[9]], axis = 1)
print("
Array after insertion : 
", a)
print("Shape : ", a.shape)
Comment

PREVIOUS NEXT
Code Example
Python :: How can I Duplicate 1 Dimensional array 
Python :: Python NumPy hsplit Function Syntax 
Python :: pymel layout 
Python :: creating a variable bound to a set python 
Python :: Stacked or grouped bar char python 
Python :: codeforces problem 580A 
Python :: __truediv__ 
Python :: django ejemplo de un formulario crud 
Python :: NumPy bitwise_and Example When inputs are numbers 
Python :: del mutiple indexes at once 
Python :: visualize 3 columns of pandas 
Python :: NumPy unpackbits Code Unpacked array along axis 0 
Python :: django check for empty onetoone exists 
Python :: # convert dictionary keys to a list 
Python :: adjoint of 3x3 matrix in numpy 
Python :: how to initialize a token spacy python 
Python :: tuple python !g 
Python :: Use one function for the "ComboboxSelected", to read multiple combobox 
Python :: if is 
Python :: groupby and add aggregated column 
Python :: gitlab ci deploy key 
Python :: HTML not being displayed properly in Flask, Python 
Python :: cours python 
Python :: python static 
Python :: ring Using Lists during definition 
Python :: candelstick chart matplotlib 
Python :: get correlation between two signals 1d scipy 
Python :: webdriver antibot 
Python :: global variable not accessible withing thread 
Python :: dbscan multidimensional data 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =