[Numpy-discussion] TypeError: only integer arrays with one element can be converted to an index

yogesh karpate yogeshkarpate@gmail....
Sat Apr 3 04:57:05 CDT 2010


I am facing the error mentioned in subject line.
error is encountered at
data_temp=filtered[a:b]
TypeError: only integer arrays with one element can be converted to an index
what can be error
The code snippet is  as follows

'''left=some array
right =some array, both are having same length.
filtered is datafile(.txt) containing 4000 sample values
left=(array([ 107,  594, 1082, 1569, 2057, 2545, 3033, 3520]),)
right=(array([ 133,  621, 1109, 1597, 2085, 2573, 3061, 3550]),)

maxval=empty(a)
minval=empty(a)
maxloc=empty(a)
minloc=empty(a)
data_temp=empty(a)
a1=len(left)
for i in  arange(a1):
    a=left[i]
    b=right[i]
    print a,b
    data_temp=filtered[a:b]
   maxloc[i]=data_temp.argmax()
    maxval[i]=data_temp[maxloc]
    minloc[i]=data_temp.argmin()
    minval[i]=data_temp[minloc]
    maxloc[i] = maxloc[i]-1+left[i]# % add offset of present location
    minloc[i] = minloc[i]-1+left[i]# % add offset of present location'''
R_index = maxloc
R_t   = t[maxloc]
Thanks in advance
Regards
Yogesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100403/5b18c5f3/attachment.html 


More information about the NumPy-Discussion mailing list