(ind)).compress(numpy.hstack([[1],
>>> ind[1:]!=ind[:-1]]))
>>> numpy.add.reduceat(data, borders)
array([ 6, 15, 24])
On Tue, Jul 18, 2006 at 8:49 AM, Tom Denniston
wrote:
> I suggest
>
> lexsort
> itertools.groupby of the indices
> take
>
> I think it would
I know how to seed and generate random numbers using:
numpy.random.seed and numpy.random.rand
The problem is the seeding of the random numbers is global which I
would think would make it non-thread safe as well as having all the
other annoyances of global state like having so set the seed and set
You could try something like:
In [15]: arr = numpy.array([100,200,300])
In [16]: arr2 = numpy.empty((len(arr)*2,))
In [17]: arr2[::2]=arr
In [18]: arr2[1::2]=numpy.arange(len(arr))
In [20]: arr2
Out[20]: array([ 100.,0., 200.,1., 300.,2.])
2008/9/24 Nadav Horesh <[EMAIL PROTECTE
I think the square brackets are very confusing as a numpy user not
familiar with CPython.
On 8/6/08, Christopher Barker <[EMAIL PROTECTED]> wrote:
> Dag Sverre Seljebotn wrote:
> > cdef numpy.ndarray[numpy.int64, ndim=2]
>
> +1 it's very clear what this means. I think the keyword should be require
Yes this all makes a lot of sense. I would propose changing the name
from business days to weekdays though. Does anyone object wih that?
On 7/30/08, Ivan Vilata i Balaguer <[EMAIL PROTECTED]> wrote:
> Tom Denniston (el 2008-07-30 a les 13:12:45 -0500) va dir::
>
> > If it'
--Tom
On 7/30/08, Francesc Alted <[EMAIL PROTECTED]> wrote:
> A Wednesday 30 July 2008, Tom Denniston escrigué:
> > When people are refering to busienss days are you talking about
> > weekdays or are you saying weekday non-holidays?
>
> Plain weekdays. Taking in account
When people are refering to busienss days are you talking about
weekdays or are you saying weekday non-holidays?
On 7/30/08, Francesc Alted <[EMAIL PROTECTED]> wrote:
> A Wednesday 30 July 2008, Pierre GM escrigué:
> > > > Now, what format do you consider for this reference ?
> > >
> > > Whatever
Francesc,
The datetime proposal is very impressive in its depth and thought.
For me as well as many other people this would be a massive
improvement to numpy and allow numpy to get a foothold in areas like
econometrics where R/S is now dominant.
I had one question regarding casting of strings:
I
Is this the expected behavior of the numpy.intersect1d funciton:
In [8]: numpy.intersect1d([3766, 9583, 17220, 40048, 50909, 52241,
62494, 828525, 20548728, 14874, 320256, 12795, 2223137, 16554, 27901,
2031774, 13610, 1592688, 13585, 16205, 1181652, 37177, 828525, 52241,
113826, 285236, 19475, 933
t set
breakpoints and dig.
--Tom
On 9/14/07, Travis E. Oliphant <[EMAIL PROTECTED]> wrote:
> Tom Denniston wrote:
> > Sometimes numpy operationrs result in NotImplementedType. It makes it
> > a little hard to debug because the problem then crops up later when
> > yo
Sometimes numpy operationrs result in NotImplementedType. It makes it
a little hard to debug because the problem then crops up later when
you try to do an operation with the NotImplementedType. Does anyone
know of a way to get numpy to raise instead of returning not
implemented type?
(Pydb) othe
Try itertools.izipping the lists and then use numpy.fromiter.
On 8/24/07, Sean Davis <[EMAIL PROTECTED]> wrote:
>
>
> On 8/24/07, Sean Davis <[EMAIL PROTECTED]> wrote:
> > I have a simple question (I assume), but I can't quite get a handle on the
> answer. I have a dict with each member a list ha
Thanks!
On 7/6/07, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> Tom Denniston wrote:
>
> >Below is the code around line 900 for ufuncobject.c
> >(http://svn.scipy.org/svn/numpy/trunk/numpy/core/src/ufuncobject.c)
> >
> >There is a decref labeled with ">
thanks
On 6/30/07, Charles R Harris <[EMAIL PROTECTED]> wrote:
>
>
> On 6/26/07, Charles R Harris <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> >
> > On 6/26/07, Charles R Harris < [EMAIL PROTECTED]> wrote:
> > >
> > >
> &
That is normal python syntax. It works with lists. What is slightly
unusual is the multi-dimensional slicing as in arr[:,10:20]. However,
this is governed by the way python translates bracket[] index calls to
the __getitem__ and __getslice__ methods. You can try it out yourself
in ipython or yo
Below is the code around line 900 for ufuncobject.c
(http://svn.scipy.org/svn/numpy/trunk/numpy/core/src/ufuncobject.c)
There is a decref labeled with ">>>" below that is incorrect. As per
the python documentation
(http://docs.python.org/api/dictObjects.html):
#PyObject* PyDict_GetItem( PyObject
In [1]: intArr1 = numpy.array([ 0, 1, 2,-2,-1, 5,-5,-5])
In [2]: intArr2 = numpy.array([1,1,1,2,2,2,3,4])
In [3]: charArr = numpy.array(['a','a','a','b','b','b','c','d'])
Here I sort two int arrays. As expected intArr2 dominates intArr1 but
the items with the same intArr2 values are sorted forwar
One thing I've done in situations like this where you want names of
dynamic fields to be available for tab completion but the object has
other methods and instance variables that might conflict is to use a
proxy object that just contains the fields. So for instance you have
a property called F tha
So searchsorted is supposed to take a list. The arguments I am using
are not correct. But it still seems strange to me that these
incorrect params trigger a memory error. Is a check simply missing or
is this possibly a sign of a larger bug? I can simply correct my
params so this is no big deal,
You need to use numpy.logical_and.
The and and or operators do not work elementwise on arrays to the best
of my understanding. I think it is a limitation on the way logical
operators are applied in python or maybe it is an intentional numpy
limitation. I'm sure others on the list could explain be
I have a userdefined numpy type for mx.DateTime and one for
mx.DateTimeDelta. Info on these packages is available here
(http://www.egenix.com/files/python/eGenix-mx-Extensions.html).
In any case most things work.
What I am left with is three problems:
1. I cannot figure out how to cleanly or e
I don't know if this helps but you could use where to do the dispatch
between the two different formulas.
I don't know the answer to your original question however.
On 2/14/07, Wojciech Śmigaj <[EMAIL PROTECTED]> wrote:
> Timothy Hochberg wrote:
> > On 2/14/07, *Wojciech Śmigaj* <[EMAIL PROTECTED
Many thanks, Travis. I'll test the new version tonight.
--Tom
On 2/7/07, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> Tom Denniston wrote:
>
> >I am trying to register a custom type to numpy. When I do so it works
> >and the ufuncs work but then when I invoke any u
I am trying to register a custom type to numpy. When I do so it works
and the ufuncs work but then when I invoke any ufunc twice the second
time my python interpretter segfaults. I think i know what the
problem is. In the select_types method in ufuncobject.c in
numpy/core/src/ numpy gets a refer
got it. thanks.
On 2/7/07, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> Tom Denniston wrote:
>
> >The behavior below seems strange to me. The string array is type S3
> >yet it says that comparison with 'abc' is not implemented. The ==
> >operator seems
The behavior below seems strange to me. The string array is type S3
yet it says that comparison with 'abc' is not implemented. The ==
operator seems to work though. Is there a subtlty I am missing or is
it simply a bug?
In [1]: import numpy
In [2]: numpy.equal(numpy.array(['abc', 'def']), 'a
or 10 character wide
string. Others might know of a more elegant way to express this.
--Tom
On 1/31/07, Keith Goodman <[EMAIL PROTECTED]> wrote:
> On 1/31/07, Tom Denniston <[EMAIL PROTECTED]> wrote:
> > i would do something like the following. I don't have your o
i would do something like the following. I don't have your odbc
library so I mocked it up with a fake iterator called "it". This
example would be for a two column result where the first is an int and
the second a string. Note it creates a recarray which you can have
match you database column nam
If you want the n largest item i would recommend quicksort but at each
partition you only recurse into the side of the pivot that has the
values you care about. This is easy to determine because you know
how many items are on either side of the pivot and you know that you
want the nth item. This
29 matches
Mail list logo