You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm finding a regression from numpy v1.14.3 to numpy v1.15.4. The issue is that in v1.14.3, busday_count() would operate on datetime64 types, and in v1.15.4, this is no longer the case. This comes up when trying to use busday_count() on dates from a pandas dataframe that stores them as datetimes.
This issue may be clarified by taking the pandas out of of it:
import numpy as np
from datetime import datetime
left = datetime(2011, 1, 1)
right = datetime(2012, 1, 1)
>>> np.busday_count(left, right)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<__array_function__ internals>", line 5, in busday_count
TypeError: Iterator operand 0 dtype could not be cast from dtype('<M8[us]') to dtype('<M8[D]') according to the rule 'safe'
I'm finding a regression from numpy v1.14.3 to numpy v1.15.4. The issue is that in v1.14.3, busday_count() would operate on datetime64 types, and in v1.15.4, this is no longer the case. This comes up when trying to use busday_count() on dates from a pandas dataframe that stores them as datetimes.
Reproducing code example:
Error message:
In v1.14.0 and v1.14.3, the assignments to d1, d2 and d3 succeed and yield the same result. In v1.15.4, the assignment to d3 gives an error message:
in
----> 1 d3 = np.busday_count(df["Date"].iloc[0], df["Date"].iloc[1])
TypeError: Iterator operand 0 dtype could not be cast from dtype('<M8[us]') to dtype('<M8[D]') according to the rule 'safe'
Numpy/Python version information:
Versions on system where error occurs:
import sys, numpy, pandas; print(numpy.version, pandas.version, sys.version)
1.15.4 0.23.4 3.6.7 |Anaconda custom (64-bit)| (default, Dec 10 2018, 20:35:02) [MSC v.1915 64 bit (AMD64)]
Versions on system where error does not occur:
import sys, numpy, pandas; print(numpy.version, pandas.version, sys.version)
1.14.3 0.23.0 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56)
[GCC 7.2.0]
The text was updated successfully, but these errors were encountered: