[Numpy-discussion] argmin and datetimes
robert.kern at gmail.com
Mon Mar 21 16:26:27 EDT 2011
On Mon, Mar 21, 2011 at 15:11, Benjamin Root <ben.root at ou.edu> wrote:
> Came across an odd behavior with a numpy array of datetimes:
>>>> import numpy as np
>>>> from datetime import datetime
>>>> a = np.empty((9, 20), dtype=datetime)
> This works:
> datetime.datetime(2011, 3, 21, 15, 5, 10, 990733)
> but, this fails:
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "/home/bvr/Programs/numpy/numpy/core/fromnumeric.py", line 754, in
> return argmin(axis)
> TypeError: unsupported operand type(s) for -: 'int' and 'datetime.datetime'
> Is this a bug, or am I just doing datetimes wrong?
Heh. x.argmin() is implemented as (0-x).argmax(). It should probably
just be implemented.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion