Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread PHobson
I've deleted the code b/c it was absurdly slow. It was pretty brute-force. -Looped through each row (r) of y -check to see where y[r,0] - x[:,0] < eps (call that row r_hit) -set y[r,1] = x[r_hit,1] There was kind of a short fuse on this, and I was already reading the data from a text file. So I j

Re: [Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread PHobson
John, Thanks for the quick reply. Unfortunately, no, they're not indexed like that. The first columns are actually floating-point date numbers from matplotlib.dates.date2num. Looks like this is just going to be painful... Thanks for the tip though. That'll definitely be useful elsewhere. -paul

[Numpy-discussion] Quick array value assignment based on common values

2010-08-04 Thread PHobson
Hey folks, I've one array, x, that you could define as follows: [[1, 2.25], [2, 2.50], [3, 2.25], [4, 0.00], [8, 0.00], [9, 2.75]] Then my second array, y, is: [[1, 0.00], [2, 0.00], [3, 0.00], [4, 0.00], [5, 0.00], [6, 0.00], [7, 0.00], [8, 0.00], [9, 0.00], [10,0.00]] Is there a

Re: [Numpy-discussion] Changing a matrix element into a scalar

2010-08-03 Thread PHobson
Wayne, Matrices are two dimensional arrays so you need two indices to access an individual element: In [1]: from numpy import matrix In [2]: m = matrix([[1.2],[2.3]]) In [3]: m[0,0] Out[3]: 1.2 -paul -Original Message- From: numpy-discussion-boun...@scipy.org [mailto:numpy-discussio

Re: [Numpy-discussion] Why this Difference in Importing NumPy 1.2 vs 1.4?

2010-03-28 Thread PHobson
If your on windows, you can probably get rid of it through the Add/Remove Programs portion of the Conrol Panel. -- Paul Hobson Senior Staff Engineer Geosyntec Consultants Portland, OR On Mar 26, 2010, at 8:09 PM, "Wayne Watson" mailto:sierra_mtnv...@sbcglobal.net>> wrote: Thanks. How do I swit

Re: [Numpy-discussion] Why this Difference in Importing NumPy 1.2 vs 1.4?

2010-03-26 Thread PHobson
Wayne, The current release of Scipy doesn't work perfectly well with Numpy 1.4. On my systems (Mac OS 10.6, WinXP, and Ubuntu), I'm running Numpy 1.4 with the current Scipy on Python 2.6.4. I get the same error you describe below on the first attempt. For some reason unknown to me, it works on