Skip to content

.all() and .any() fail for arrays of type 'S' and 'U' (Trac #1314) #1912

Closed

Description

@thouis

Original ticket http://projects.scipy.org/numpy/ticket/1314 on 2009-12-07 by @mdboom, assigned to unknown.

In [3]: x = np.array(['abc', 'def', ''], 'S')

In [4]: x.all()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/wonkabar/data1/builds/betadrizzle/<ipython console> in <module>()

TypeError: cannot perform reduce with flexible type

This is a sensible operation. I wonder if there's a way to make it work.

Activity

  1. thouis commented on Oct 19, 2012

    @thouis
    ContributorAuthor

    @mwiebe wrote on 2011-03-25

    I think this should follow the behavior of Python with regard to strings:

    In [8]: print bool(""), bool("x")
    False True
    
  2. thouis commented on Oct 19, 2012

    @thouis
    ContributorAuthor

    Milestone changed to Unscheduled by @mwiebe on 2011-03-25

  3. added a commit that references this issue on Jan 22, 2024
    7cccf5c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions