where is the error?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lajam@caramail.com

    where is the error?

    Hello,

    I'm trying to assign data into an array with the nonzero function.
    There is my code.

    from numarray import *
    diff_temp=(logi cal_and(values[:,5] -2,values[:,5] < 2)).nonzero()

    This command works fine but when I apply the following,

    values_matchup= values_Stumpf[diff_temp_Stump f,:]

    I have this error message:
    IndexError: each subindex must be either a slice, an integer,
    Ellipsis, or NewAxis

    Does someone know what it is the problem? I'm using python2.4.3 on
    Ubuntu.

    Using this command with python on windows xp worked fine.

    Thank you for the help,
    Cedric
  • Gary Herron

    #2
    Re: where is the error?

    lajam@caramail. com wrote:
    Hello,
    >
    I'm trying to assign data into an array with the nonzero function.
    There is my code.
    >
    from numarray import *
    diff_temp=(logi cal_and(values[:,5] -2,values[:,5] < 2)).nonzero()
    >
    Does that have something to do with the question below?
    This command works fine but when I apply the following,
    >
    values_matchup= values_Stumpf[diff_temp_Stump f,:]
    >
    Clearly, from the error message, the index diff_temp_Stump f is not one
    of the allowed types. Have you examined its value? Printed it? Set
    it equal to a known legal value and tried that line again?

    First thing: Find out what value that index has, then if it's necessary
    to ask your question again, include that information and we'll have
    something to go on in forming an answer.

    Gary Herron
    I have this error message:
    IndexError: each subindex must be either a slice, an integer,
    Ellipsis, or NewAxis
    >
    Does someone know what it is the problem? I'm using python2.4.3 on
    Ubuntu.
    >
    Using this command with python on windows xp worked fine.
    >
    Thank you for the help,
    Cedric
    --

    >

    Comment

    • Scott David Daniels

      #3
      Re: where is the error?

      lajam@caramail. com wrote:
      ... And my problem was that the commands worked on windows but not on
      linux.
      >
      >By the way, shouldn't you be using numpy? I thought numarray was going
      >away by mid-2008 i.e. now.
      I know, but i'm not sure that it's the problem.
      It's your job to get certain of some things, and what people are
      proposing are experiments you can do to find the answer. The problem
      is yours, the benefit of having the code work will be yours, and
      you, unlike us, are in a position to perform experiments.

      Don't be as vague as "the commands worked on windows but not on linux."
      That kind of statement is usually a flag that you _think_ you typed the
      same thing. Write a complete, small test program that demonstrates your
      success on XP. Move the program to Ubuntu (remembering about line
      endings) via flash drive or something. Run _exactly_ the same program
      on Ubuntu. If you get a failure, keep trimming the program on Ubuntu
      til you find the smallest program that breaks. Take it back to XP and
      make sure it still runs there.

      Don't give partial version information. I know you have two systems:
      Ubuntu (who knows what version), python 2.4.3, numarray who knows.

      The Windows box is running XP, but what service pack? what version of
      Python on XP? What version of numarray on XP? In collecting all of
      this information _before_ you ask, you often discover the answer to
      your question without needing to ask anyone else.

      If numpy might solve your problem, why avoid trying it simply because
      it might not do so?

      Sorry, this a long form of "read smart questions," but it did include
      some suggestions about how you could find the problem in your particular
      case.

      --Scott David Daniels
      Scott.Daniels@A cm.Org

      Comment

      Working...