### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Array manipulation routines »

# numpy.trim_zeros

`numpy.``trim_zeros`(filt, trim='fb')

  Trim the leading and trailing zeros from a 1D array.

  Parameters: | filt : array_like Input array. trim : string, optional A string with ‘f’ representing trim from front and ‘b’ to trim from back.

  Examples

      >>> a = np.array((0, 0, 0, 1, 2, 3, 2, 1, 0))
      >>> np.trim_zeros(a)
      array([1, 2, 3, 2, 1])

### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Array manipulation routines »