[SciPy-User] Range keyword in binned_statistics does not work

josef.pktd at gmail.com josef.pktd at gmail.com
Thu Nov 14 10:22:29 EST 2013


On Thu, Nov 14, 2013 at 10:16 AM,  <josef.pktd at gmail.com> wrote:
> On Thu, Nov 14, 2013 at 9:50 AM, Daπid <davidmenhur at gmail.com> wrote:
>> On 14 November 2013 14:18, <josef.pktd at gmail.com> wrote:
>>>
>>> from the code it looks like `range` need to be a list (or iterable) of
>>> tuples, with length equal to the number of dimensions
>>>
>>> range = [(3, 7)]
>>
>>
>> Then binned_statistics (the 1D version) should do that transformation for
>> you. This may break some code, but given that no one has reported the
>> documentation mistaken in two versions, I wonder how many people are
>> actually using range argument.
>
> I agree, binned_statistics is based on np.histogram
> However, np.histogram has a 1D specific implementation, where range
> doesn't need to be a list of tuples.
>
> issue and PR to make binned_statistics accept just the tuple would be
> welcome IMO.
>
> If Ralf wants backwards compatibility, then it would be possible to
> add a check, so both versions, tuple or list of tuples, work.

if len(range) == 2:
    range = [range]


aside:
why is `range` a variable name? it has the wrong color.

Josef

>
> Josef
>
>
>>
>> Should we just change the docstring? range=[[xmin, xmax]] looks absurdly
>> verbose to me.
>>
>>
>> /David.
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>



More information about the SciPy-User mailing list