iarray.IArray.insert#

IArray.insert(data, axis=0, start=None)#

Insert data in a position by extending the axis.

Parameters
  • data (object supporting the PyBuffer protocol) – The object containing the data.

  • axis (int, optional) – The axis along the data contained by data will be inserted. Default is 0.

  • start (int, optional) – The position in the array axis from where to start inserting the data. If None (default), it will be appended at the end.

Notes

If start is not at the end of the array, it must be a multiple of chunks[axis]. Furthermore, if start != shape[axis] the number of elements of data must be a multiple of chunks[axis] * shape[in the other axis] and if start = shape[axis] (or None) the number of elements of data must be a multiple of shape[in the other axis].

For example, let’s suppose that we have an array of shape = [20, 20] and chunks = [7,7], and we would like to insert data in the axis = 0. Then, if start = 0 which is different from shape[axis] and multiple of chunks[axis], the number of elements of data must be a multiple of 7 * 20. If start = 20 = shape[axis] (or None), the number of elements of data can be anything * 20.

See also

append, delete, resize