[SciPy-user] scipy sclicing

John [H2O] washakie at gmail.com
Fri Oct 10 08:45:02 EDT 2008


Could someone explain what I'm doing wrong here?

>>> i = array(range(140,149))
>>> j = array(range(5,20))
>>> i
array([140, 141, 142, 143, 144, 145, 146, 147, 148])
>>> j
array([ 5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19])
>>> a = acc[i,j]
Traceback (most recent call last):
  File "<string>", line 1, in <string>
ValueError: shape mismatch: objects cannot be broadcast to a single shape
>>> a = acc[140:148,5:19]
>>> 


I'm just following the indexing arrays usage on this page:
http://pages.physics.cornell.edu/~myers/teaching/ComputationalMethods/python/arrays.html

How come I can't use arrays to index my array?

Thanks!
-- 
View this message in context: http://www.nabble.com/scipy-sclicing-tp19917625p19917625.html
Sent from the Scipy-User mailing list archive at Nabble.com.




More information about the SciPy-User mailing list