numpy.delete() in Python

The numpy.delete() function returns a new array with sub-arrays along an axis deleted. For 1-D array, this function returns those entries which are not returned by arr[obj].

Syntax

Parameter

arr: This parameter returns the input array.

obj : This parameter indicates which sub-arrays to remove.

axis: It represents the axis along which to delete the subarray defined by obj. If axis is None, obj is applied to the flattened array.

Return

This function returns a copy of ‘arr’ with the elements specified by obj removed.

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This