[Numpy-discussion] argmin and datetimes

Benjamin Root ben.root@ou....
Mon Mar 21 15:11:46 CDT 2011

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)
>>> a.fill(datetime.now())

This works:
>>> a.min()
datetime.datetime(2011, 3, 21, 15, 5, 10, 990733)

but, this fails:
>>> np.argmin(a)
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?
For reference, I am at commit aada93306acfb4e2eb816faf32652edf8825cf45

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20110321/8b5abf55/attachment-0001.html 

More information about the NumPy-Discussion mailing list