On 11/13/06, Charles R Harris <[EMAIL PROTECTED]> wrote:
>
>
> On 11/12/06, Erin Sheldon <[EMAIL PROTECTED]> wrote:
> > Hi all -
> >
> > Thanks to everyone for the suggestions.
> > I think map(tuple, list) is probably the most compact,
> > but the list comprehension also works well.
> >
> > Because
On 11/12/06, Erin Sheldon <[EMAIL PROTECTED]> wrote:
Hi all -Thanks to everyone for the suggestions.I think map(tuple, list) is probably the most compact,but the list comprehension also works well.Because map() is proably going to disappear someday, I'll
stick with the list comprehension. array( [
Hi all -
Thanks to everyone for the suggestions.
I think map(tuple, list) is probably the most compact,
but the list comprehension also works well.
Because map() is proably going to disappear someday, I'll
stick with the list comprehension.
array( [tuple(row) for row in result], dtype=dtype)
T
Pierre GM wrote:
> On Sunday 12 November 2006 20:10, Erin Sheldon wrote:
>> Actually, there is a problem with that approach. It first converts
>> the entire array to a single type, by default a floating type.
>
> As A.M. Archibald suggested, you can use list comprehension:
> N.array([(a,b,c,d,)
On Sunday 12 November 2006 20:10, Erin Sheldon wrote:
> Actually, there is a problem with that approach. It first converts
> the entire array to a single type, by default a floating type.
As A.M. Archibald suggested, you can use list comprehension:
N.array([(a,b,c,d,) for (a,b,c,d) in yourlist]
Erin Sheldon wrote:
> On 11/12/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
>
>> I haven't been following this too closely, but if you need to transpose
>> your data without converting all to one type, I can think of a couple of
>> different approaches:
>>
>> 1. zip(*yourlist)
>> 2. nump
George Sakkis wrote:
> Tim Hochberg wrote:
>
>
>> George Sakkis wrote:
>>
>>> def index(a, value):
>>> return N.where(a==value)[0][0]
>>>
>>>
>> Or
>>
>> def index(a, value):
>> return argmax(a == value)
>>
>
> That's a bit easier to write and a bit harder to grok; that'
Tim Hochberg wrote:
> George Sakkis wrote:
> > def index(a, value):
> > return N.where(a==value)[0][0]
> >
> Or
>
> def index(a, value):
> return argmax(a == value)
That's a bit easier to write and a bit harder to grok; that's ok, I can
live with it.
> > This works but seems clunky and l
On 12/11/06, Erin Sheldon <[EMAIL PROTECTED]> wrote:
> Actually, there is a problem with that approach. It first converts
> the entire array to a single type, by default a floating type. For
> very large integers this precision is insufficient. For example, I
> have the following integer in my
On 11/12/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
> I haven't been following this too closely, but if you need to transpose
> your data without converting all to one type, I can think of a couple of
> different approaches:
>
> 1. zip(*yourlist)
> 2. numpy.transpose(numpy.array(yourlist,
Erin Sheldon wrote:
> On 11/12/06, Erin Sheldon <[EMAIL PROTECTED]> wrote:
>
>> On 11/12/06, Pierre GM <[EMAIL PROTECTED]> wrote:
>>
>>> You could try the fromarrays function of numpy.core.records
>>>
>>>
>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4', 'f4',
--- Robert Kern <[EMAIL PROTECTED]> wrote:
> Also add g2c to your library list, then. It is g77's FORTRAN runtime library
Okay I put libg2c.a in the atlas directory and made the line in site.cfg,
atlas_libs = lapack, f77blas, cblas, atlas, g2c
Now numpy imports but numpy.linalg.test() as well as a
On 11/12/06, Charles R Harris <[EMAIL PROTECTED]> wrote:
> > 94137100072000193L
> > which ends up as
> > 94137100072000192
> > after going to a float and then back to an integer.
>
> Out of curiosity, where does that large integer come from?
It is a unique object identifier. It is a combination
On 11/12/06, Erin Sheldon <[EMAIL PROTECTED]> wrote:
On 11/12/06, Erin Sheldon <[EMAIL PROTECTED]> wrote:> On 11/12/06, Pierre GM <[EMAIL PROTECTED]> wrote:> >
> > You could try the fromarrays function of numpy.core.records> >> > >>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4',
On 11/12/06, Erin Sheldon <[EMAIL PROTECTED]> wrote:
> On 11/12/06, Pierre GM <[EMAIL PROTECTED]> wrote:
> >
> > You could try the fromarrays function of numpy.core.records
> >
> > >>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4', 'f4',
> > 'f4')}
> > >>> a = N.core.records.from
On 11/12/06, Pierre GM <[EMAIL PROTECTED]> wrote:
>
> You could try the fromarrays function of numpy.core.records
>
> >>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4', 'f4',
> 'f4')}
> >>> a = N.core.records.fromarrays(N.transpose(yourlist), dtype=mydescriptor)
>
> The 'transpos
You could try the fromarrays function of numpy.core.records
>>> mydescriptor = {'names': (a','b','c','d'), 'formats':('f4', 'f4', 'f4',
'f4')}
>>> a = N.core.records.fromarrays(N.transpose(yourlist), dtype=mydescriptor)
The 'transpose' function ensures that 'fromarrays' sees 4 arrays (one for e
I have to not ammend my statement a bit:
DBI 2.0 actually returns a lists of tuples, which would
work. It appears to just be pgdb, the postgres interface,
that is returning lists of lists. Still, I need to
interact with this database.
Erin
On Sun, Nov 12, 2006 at 06:56:29PM -0500, Erin Sheld
Hi all-
I want to take the result from a database query,
and create a numpy array with field names and types
corresponding to the returned columns.
The DBI 2.0 compliant interfaces return lists
of lists. E.g.
[[94137100072000193L, 94, 345.5721510002, -0.8367320809996],
[94137100072000
Abhishek Roy wrote:
> --- Robert Kern <[EMAIL PROTECTED]> wrote:
>> Are your ATLAS libraries shared or static (i.e., are they libatlas.so or
>> libatlas.a)? ldd(1) only lists the shared libraries that are linked. ATLAS is
>> usually installed as static libraries.
> They are static. Thanks, I was mi
On Sunday 12 November 2006 17:08, A. M. Archibald wrote:
> On 12/11/06, Keith Goodman <[EMAIL PROTECTED]> wrote:
> > Is anybody interested in making x.max() and nanmax() behave the same
> > for matrices, except for the NaN part? That is, make
> > numpy.matlib.nanmax return a matrix instead of an ar
Tim Hochberg wrote:
George Sakkis wrote:
def index(a, value):
return N.where(a==value)[0][0]
Or
def index(a, value):
return argmax(a == value)
This works but seems clunky and less efficient than necessary. If there
isn't a better alternative, I w
On 12/11/06, Keith Goodman <[EMAIL PROTECTED]> wrote:
> Is anybody interested in making x.max() and nanmax() behave the same
> for matrices, except for the NaN part? That is, make
> numpy.matlib.nanmax return a matrix instead of an array.
Sounds good to me; maybe put a patch in the tracker?
A. M.
Is anybody interested in making x.max() and nanmax() behave the same
for matrices, except for the NaN part? That is, make
numpy.matlib.nanmax return a matrix instead of an array.
Example
=
>> import numpy.matlib as M
>> x = M.rand(3,2)
>> x.max(0)
matrix([[ 0.91749823, 0.94942954]])
>> M.n
George Sakkis wrote:
> def index(a, value):
> return N.where(a==value)[0][0]
>
Or
def index(a, value):
return argmax(a == value)
> This works but seems clunky and less efficient than necessary. If there
> isn't a better alternative, I would welcome a new index()
> function/method in t
--- Robert Kern <[EMAIL PROTECTED]> wrote:
> Are your ATLAS libraries shared or static (i.e., are they libatlas.so or
> libatlas.a)? ldd(1) only lists the shared libraries that are linked. ATLAS is
> usually installed as static libraries.
They are static. Thanks, I was mindlessly copying a suggesti
Keith Goodman wrote:
> On 11/12/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> > This must be pretty trivial but I couldn't find it in the docs: what's
> > the "numpythonic" way to find the (first) index of an element, i.e. the
> > equivalent to list.index ?
>
> Does where work?
def index(a, valu
On 11/12/06, Keith Goodman <[EMAIL PROTECTED]> wrote:
> >> x = M.matrix([[1, 2], [3, 4]])
> >> x
> matrix([[1, 2],
> [3, 4]])
>
> >> y = M.matrix([[5], [6]])
> >> y
> matrix([[5],
> [6]])
>
> >> idx = M.where(x[:,0].A < 100)[0]
> >> idx
> array([0, 1])
>
>
> >> x[idx,0] # < Th
>> x = M.matrix([[1, 2], [3, 4]])
>> x
matrix([[1, 2],
[3, 4]])
>> y = M.matrix([[5], [6]])
>> y
matrix([[5],
[6]])
>> idx = M.where(x[:,0].A < 100)[0]
>> idx
array([0, 1])
>> x[idx,0] # < This works
matrix([[1],
[3]])
>> x[idx,0] = y# < But this doesn't w
On 11/12/06, George Sakkis <[EMAIL PROTECTED]> wrote:
> This must be pretty trivial but I couldn't find it in the docs: what's
> the "numpythonic" way to find the (first) index of an element, i.e. the
> equivalent to list.index ?
Does where work?
--
This must be pretty trivial but I couldn't find it in the docs: what's
the "numpythonic" way to find the (first) index of an element, i.e. the
equivalent to list.index ?
Thanks,
George
-
Using Tomcat but need to do more? Nee
You're probably right. Well it would most definitely be useful for all
the lads in my lab, but I am not sure this is a broad audience. The use
case is when you have a array representing data in an "mgrid" way, and
you wnat to apply transformations to the coordinates. It is something I
have done and
Gael Varoquaux schrieb:
> Hi all,
>
> I didn't get any answers to this email. Is it because the proposed
> addition to numpy is not of any interest to anybody apart from me ?
> Maybe the way I introduced this is wrong. Please tell me what is wrong
> with this proposition.
>
Well you didn't m
Hi all,
I didn't get any answers to this email. Is it because the proposed
addition to numpy is not of any interest to anybody apart from me ?
Maybe the way I introduced this is wrong. Please tell me what is wrong
with this proposition.
Regards,
Gaël
On Fri, Oct 20, 2006 at 01:28:52PM +0200
I see you're on linux. If this is Fedora, atlas (and the other libaries)
are available from standard repos (core + extras)
-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly wi
35 matches
Mail list logo