8000 min/max/mean of empty arrays (Trac #2078) · Issue #2670 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

min/max/mean of empty arrays (Trac #2078) #2670

@numpy-gitbot

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/2078 on 2012-03-11 by trac user muellner, assigned to unknown.

[]In NumPy release 1.5.1, the minimum/maximum/mean of empty arrays is handled in a sensible way, namely by returning an empty array:

>>> numpy.min(numpy.zeros((0,2)), axis=1)
array([], dtype=float64)

Likewise for max and mean.

This behavior is broken in NumPy 1.7.0.dev-56f66bb, and the line above raises a ValueError. Is this a bug or a feature? Personally, I prefer the old behavior, as it allows the easy handling of special cases (zero-sized arrays) without the need for extra checks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0