Insert values into an array at the given index.
Numeric.shape.insert(input, index, values, level)Inserts the values at the requested position.
- Parameters:
input: Array receiving the new valuesindex: Position where the values are insertedvalues: Values placed into the arraylevel: Optional axis along which values are inserted
- Returns: Array holding the inserted values
- NumPy: Covers
np.insert,np.appendthrough a single Numerix method.
import Numeric from '@neabyte/numerix'
const values = Numeric.shape.insert([1, 3], 1, [2])
console.log(values)
// [1,2,3]import Numeric from '@neabyte/numerix'
const values = Numeric.shape.insert([2, 3], 0, [1])
console.log(values)
// [1,2,3]import Numeric from '@neabyte/numerix'
const values = Numeric.shape.insert([1, 2], 2, [3])
console.log(values)
// [1,2,3]import Numeric from '@neabyte/numerix'
const values = Numeric.shape.insert([1, 4], 1, [2, 3])
console.log(values)
// [1,2,3,4]