[Numpy-discussion] Where's that function?

josef.pktd@gmai... josef.pktd@gmai...
Wed Feb 6 14:02:41 CST 2013


On Wed, Feb 6, 2013 at 2:45 PM, Benjamin Root <ben.root@ou.edu> wrote:
>
>
> On Wed, Feb 6, 2013 at 1:08 PM, <josef.pktd@gmail.com> wrote:
>>
>> I'm convinced that I saw a while ago a function that uses a list of
>> interval boundaries to index into an array, either to iterate or to
>> take.
>> I thought that's very useful, but didn't make a note.
>>
>> Now, I have no idea where I saw this (I thought numpy), and I cannot
>> find it anywhere.
>>
>> any clues?
>>
>
> Some possibilities:
>
> np.array_split()
> np.split()

perfect (haven't gotten further down the list yet)

>>> np.split(np.arange(15), [3,4,6, 13])
[array([0, 1, 2]), array([3]), array([4, 5]), array([ 6,  7,  8,  9,
10, 11, 12]), array([13, 14])]

docstring says equal size, which fortunately is not correct
http://docs.scipy.org/doc/numpy/reference/generated/numpy.split.html

Thank you,

Josef


> np.ndindex()
> np.nditer()
> np.nested_iters()
> np.ravel_multi_index()
>
> Your description reminded me of a function I came across once, but I can't
> remember if one of these was it or if it was another one.
>
> IHTH,
> Ben Root
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>


More information about the NumPy-Discussion mailing list