Hi,
Suppose an array of shape (N,2,2), that is N arrays of
shape (2,2). I want to select an element (x,y) from each one
of the subarrays, so I get a 1-dimensional array of length
N. For instance:
In [228]: t=np.arange(8).reshape(2,2,2)
In [229]: t
Out[229]:
array([[[0, 1],
[2, 3]],
read about basic slicing :
http://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
On Sun, Nov 21, 2010 at 11:28 AM, John Salvatier
jsalv...@u.washington.edu wrote:
yes use the symbol ':'
so you want
t[:,x,y]
2010/11/21 Ernest Adrogué eadro...@gmx.net:
Hi,
Suppose an array of
yes use the symbol ':'
so you want
t[:,x,y]
2010/11/21 Ernest Adrogué eadro...@gmx.net:
Hi,
Suppose an array of shape (N,2,2), that is N arrays of
shape (2,2). I want to select an element (x,y) from each one
of the subarrays, so I get a 1-dimensional array of length
N. For instance:
In
On Sun, Nov 21, 2010 at 10:25 AM, Wes McKinney wesmck...@gmail.com wrote:
On Sat, Nov 20, 2010 at 7:24 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sat, Nov 20, 2010 at 3:54 PM, Wes McKinney wesmck...@gmail.com wrote:
Keith (and others),
What would you think about creating a library of
On Sun, Nov 21, 2010 at 2:48 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sun, Nov 21, 2010 at 10:25 AM, Wes McKinney wesmck...@gmail.com wrote:
On Sat, Nov 20, 2010 at 7:24 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sat, Nov 20, 2010 at 3:54 PM, Wes McKinney wesmck...@gmail.com wrote:
2010/11/14 Charles R Harris charlesr.har...@gmail.com:
I keep getting page does not exist.
The comments on the event, https://github.com/blog/744-today-s-outage,
are simply great and stunning.
Friedrich
___
NumPy-Discussion mailing list
On Sat, Nov 20, 2010 at 7:24 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sat, Nov 20, 2010 at 3:54 PM, Wes McKinney wesmck...@gmail.com wrote:
Keith (and others),
What would you think about creating a library of mostly Cython-based
domain specific functions? So stuff like rolling
Hi,
21/11/10 @ 11:28 (-0800), thus spake John Salvatier:
yes use the symbol ':'
so you want
t[:,x,y]
I tried that, but it's not the same:
In [307]: t[[0,1],x,y]
Out[307]: array([1, 7])
In [308]: t[:,x,y]
Out[308]:
array([[1, 3],
[5, 7]])
No?
--
Ernest
On Sun, Nov 21, 2010 at 12:30 PM, josef.p...@gmail.com wrote:
On Sun, Nov 21, 2010 at 2:48 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sun, Nov 21, 2010 at 10:25 AM, Wes McKinney wesmck...@gmail.com wrote:
On Sat, Nov 20, 2010 at 7:24 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sat,
On Sun, Nov 21, 2010 at 5:09 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sun, Nov 21, 2010 at 12:30 PM, josef.p...@gmail.com wrote:
On Sun, Nov 21, 2010 at 2:48 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sun, Nov 21, 2010 at 10:25 AM, Wes McKinney wesmck...@gmail.com wrote:
On Sat,
On Sun, Nov 21, 2010 at 6:02 PM, josef.p...@gmail.com wrote:
On Sun, Nov 21, 2010 at 5:09 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sun, Nov 21, 2010 at 12:30 PM, josef.p...@gmail.com wrote:
On Sun, Nov 21, 2010 at 2:48 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sun, Nov 21, 2010
Does np.std() make two passes through the data?
Numpy:
arr = np.random.rand(10)
arr.std()
0.3008736260967052
Looks like an algorithm that makes one pass through the data (one for
loop) wouldn't match arr.std():
np.sqrt((arr*arr).mean() - arr.mean()**2)
0.30087362609670526
But a
On Sun, Nov 21, 2010 at 6:43 PM, Keith Goodman kwgood...@gmail.com wrote:
Does np.std() make two passes through the data?
Numpy:
arr = np.random.rand(10)
arr.std()
0.3008736260967052
Looks like an algorithm that makes one pass through the data (one for
loop) wouldn't match arr.std():
On Sun, Nov 21, 2010 at 17:43, Keith Goodman kwgood...@gmail.com wrote:
Does np.std() make two passes through the data?
Yes. See PyArray_Std() in numpy/core/src/calculation.c
--
Robert Kern
I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by
On Sun, Nov 21, 2010 at 4:18 PM, josef.p...@gmail.com wrote:
On Sun, Nov 21, 2010 at 6:43 PM, Keith Goodman kwgood...@gmail.com wrote:
Does np.std() make two passes through the data?
Numpy:
arr = np.random.rand(10)
arr.std()
0.3008736260967052
Looks like an algorithm that makes one
On Sun, Nov 21, 2010 at 6:37 PM, Keith Goodman kwgood...@gmail.com wrote:
On Sun, Nov 21, 2010 at 3:16 PM, Wes McKinney wesmck...@gmail.com wrote:
What would you say to a single package that contains:
- NaN-aware NumPy and SciPy functions (nanmean, nanmin, etc.)
I'd say yes.
- moving
On Sun, Nov 21, 2010 at 5:56 PM, Robert Kern robert.k...@gmail.com wrote:
On Sun, Nov 21, 2010 at 19:49, Keith Goodman kwgood...@gmail.com wrote:
But this sample gives a difference:
a = np.random.rand(100)
a.var()
0.080232196646619805
var(a)
0.080232196646619791
As you know, I'm
A colleague showed me a program using Numeric with Python 2.5 which
ran much faster than the same program using numpy with Python 2.7. I
distilled this down to a simple test case, characterized by a for
loop in which he does an element-by-element calculation involving
arrays:
from numpy import
On Sun, Nov 21, 2010 at 11:17 PM, Bruce Sherwood bashe...@ncsu.edu wrote:
A colleague showed me a program using Numeric with Python 2.5 which
ran much faster than the same program using numpy with Python 2.7. I
distilled this down to a simple test case, characterized by a for
loop in which he
Hi,
numpy doesn't seem to have a function for sampling from simple
categorical distributions. The easiest solution I could come up with was
something like
from numpy.random import multinomial
multinomial(1, [.5, .3, .2]).nonzero()[0][0]
1
but this is bound to be inefficient as soon as the
20 matches
Mail list logo