Hi,

I have a numpy arrays with datetime objects as:

a = np.array([dt.datetime(2010, 2, 17), dt.datetime(2010, 2, 16),
dt.datetime(2010, 2, 15)])
b = np.array([dt.datetime(2010, 2, 14), dt.datetime(2010, 2, 13),
dt.datetime(2010, 2, 12)])

I want doing a-b should give me days difference as numpy array but I get as:
array([3 days, 0:00:00, 3 days, 0:00:00, 3 days, 0:00:00], dtype=object)
which is a numpy array of timedelta! I can extract days out by using
property days of each, but how I do it in a numpy way may like:
c=a-b
c.days (a numpy array of days difference) like:
array([3, 3, 3])

Any pointers?

Thanks
Vishal Rana
Joan Crawford<http://www.brainyquote.com/quotes/authors/j/joan_crawford.html>
- "I, Joan Crawford, I believe in the dollar. Everything I earn, I
spend."
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to