diff options
author | Stephan Hoyer <shoyer@google.com> | 2018-05-23 23:28:50 -0700 |
---|---|---|
committer | Stephan Hoyer <shoyer@google.com> | 2018-05-23 23:28:50 -0700 |
commit | c637addf931221f874efd0acb164c1aab97afd3e (patch) | |
tree | 636afcb44013301d3c21b99713f3d0faa35e9b80 | |
parent | 2666831389e4834ea83741a4ba104f62fdb47704 (diff) | |
download | numpy-c637addf931221f874efd0acb164c1aab97afd3e.tar.gz |
BUG: fix datetime.timedelta->timedelta64 unit detection logic
-rw-r--r-- | numpy/core/src/multiarray/datetime.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/datetime.c b/numpy/core/src/multiarray/datetime.c index a4a028ad4..21458630f 100644 --- a/numpy/core/src/multiarray/datetime.c +++ b/numpy/core/src/multiarray/datetime.c @@ -2808,9 +2808,12 @@ convert_pyobject_to_timedelta(PyArray_DatetimeMetaData *meta, PyObject *obj, us_meta.base = NPY_FR_m; } else if (td % (24*60*60*1000000LL) != 0) { - us_meta.base = NPY_FR_D; + us_meta.base = NPY_FR_h; } else if (td % (7*24*60*60*1000000LL) != 0) { + us_meta.base = NPY_FR_D; + } + else { us_meta.base = NPY_FR_W; } us_meta.num = 1; |