arrays in lists

Discussion in 'Python' started by Peter Stahlir, Dec 17, 2007.

  1. Hi!

    I have a list of arrays and want to find an array with list.index(x).
    Is that possible. I get an
    ValueError: The truth value of an array with more than one element is
    ambiguous. Use a.any() or a.all()


    For example:
    from numpy import array
    a = array([1])
    b = array([2])
    c = [a,b]
    d = c.index(a)

    Thank you.
     
    Peter Stahlir, Dec 17, 2007
    #1
    1. Advertising

  2. Peter Stahlir

    bcroq Guest

    On 17 déc, 14:05, "Peter Stahlir" <>
    wrote:
    > For example:
    > from numpy import array
    > a = array([1])
    > b = array([2])
    > c = [a,b]
    > d = c.index(a)


    No problem here, Python 2.4.4
     
    bcroq, Dec 17, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JustSomeGuy

    Sorting lists of lists...

    JustSomeGuy, Jun 17, 2004, in forum: C++
    Replies:
    0
    Views:
    326
    JustSomeGuy
    Jun 17, 2004
  2. Jon Slaughter

    lists of lists

    Jon Slaughter, Dec 13, 2004, in forum: C++
    Replies:
    4
    Views:
    427
    Buster
    Dec 13, 2004
  3. Charlotte Henkle

    Counter for items in lists in lists?

    Charlotte Henkle, Sep 25, 2004, in forum: Python
    Replies:
    8
    Views:
    405
    Charlotte Henkle
    Sep 26, 2004
  4. =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==

    List of lists of lists of lists...

    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==, May 8, 2006, in forum: Python
    Replies:
    5
    Views:
    410
    =?UTF-8?B?w4FuZ2VsIEd1dGnDqXJyZXogUm9kcsOtZ3Vleg==
    May 15, 2006
  5. Philipp
    Replies:
    21
    Views:
    1,135
    Philipp
    Jan 20, 2009
Loading...

Share This Page