On 7/6/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> Mathew Yeates wrote:
>
> >Not working.
> >A[row,all_dates == 10] = -1 where all_dates is a matrix with column
> >length of 14 [[960111,..,..
> >and A is a matrix with same column length
> >
> >I get
> >IndexError: arrays used as indices must be of integer type
> >
> >when I print out all_dates == 10
> >I get
> >[True True True True True True True True True False False False True True]]
> >
> >I experimented with "<" instead of "==" but I still get boolean values
> >as indices.
> >
> >Any help?
> >
> >
> What version are you using?  Can you give an example that shows the
> error.  It's hard to guess the type of all the variables.  The following
> works for me.
>
> import numpy
> print numpy.__version__
> A = numpy.matrix(rand(3,14))
> all_dates = array([10,10,1,10,1,10,0,10,0,10,0,1,10,1])
> row = 2
> A[row, all_dates == 10]


This is what NASA is doing (and what I would like to do):

>> A[row, asmatrix(all_dates == 10)]
---------------------------------------------------------------------------
exceptions.ValueError                                Traceback (most
recent call last)

/home/kwg/<ipython console>

/usr/local/lib/python2.4/site-packages/numpy/core/defmatrix.py in
__getitem__(self, index)
    122
    123     def __getitem__(self, index):
--> 124         out = N.ndarray.__getitem__(self, index)
    125         # Need to swap if slice is on first index
    126         # or there is an integer on the second

ValueError: too many indices for array

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion

Reply via email to