[Numpy-discussion] find appropriate dtype based on a set of values
robert.kern at gmail.com
Tue Sep 3 08:47:26 EDT 2013
On Mon, Sep 2, 2013 at 3:55 PM, Stéfan van der Walt <stefan at sun.ac.za>
> On Mon, Sep 2, 2013 at 4:21 PM, Gregorio Bastardo
> <gregorio.bastardo at gmail.com> wrote:
> >>>> np.min_scalar_type([-1,256]) # int16 expected
> > dtype('int32')
> > Am I missing something? Anyone knows how to achieve the desired
> The docstring states explicitly that this use case is not supported.
> Here's one way of doing it: https://gist.github.com/stefanv/6413742
You can probably reduce the amount of work by only comparing a.min() and
a.max() instead of the whole array.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion