By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,773 Members | 914 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,773 IT Pros & Developers. It's quick & easy.

where is the error?

P: n/a
Hello,

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

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

This command works fine but when I apply the following,

values_matchup=values_Stumpf[diff_temp_Stumpf,:]

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
Jun 27 '08 #1
Share this Question
Share on Google+
2 Replies

P: n/a
la***@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=(logical_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_Stumpf,:]
Clearly, from the error message, the index diff_temp_Stumpf 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
--
http://mail.python.org/mailman/listinfo/python-list
Jun 27 '08 #2

P: n/a
la***@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
Sc***********@Acm.Org
Jun 28 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.