This is a pre-release version (2.5.0.dev0+git20251130.2de293a). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / lib / _function_base_impl / _arg_trim_zeros

function

numpy.lib._function_base_impl:_arg_trim_zeros

source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_function_base_impl.py :1897

Signature

def   _arg_trim_zeros ( filt )

Summary

Return indices of the first and last non-zero element.

Parameters

filt : array_like

Input array.

Returns

start, stop : ndarray

Two arrays containing the indices of the first and last non-zero element in each dimension.

Examples

import numpy as np
_arg_trim_zeros(np.array([0, 0, 1, 1, 0]))

See also

trim_zeros

Aliases

  • numpy.lib._function_base_impl._arg_trim_zeros