-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: numpy.maximum(pandas.Timestamp(...), pandas.Series(..., dtype='datetime64')) fails with TypeError #50864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report - by calling
This gives the same error, but no real traceback:
The dtype of |
Looks like this is correctly working on main now In [6]: import pandas, numpy
...: ts = pandas.Timestamp('2022-02-01')
...: dates_sr = pandas.to_datetime(pandas.Series(['2022-01-01', '2022-02-01', '2022-03-01']))
...:
...: # note that comparison operators work
...: pandas.testing.assert_series_equal(ts < dates_sr, pandas.Series([False, False, True]))
...:
...: # numpy.maximum fails
...: numpy.maximum(ts, dates_sr)
Out[6]:
0 2022-02-01
1 2022-02-01
2 2022-03-01
dtype: datetime64[us] I suppose we could use a test for this |
take |
If it works on main shouldn't this be closed @Tirthraj93 @hottwaj ? |
@Prabhat-Thapa45 - when there is a bug that happens to be fixed by other changes, we prefer to add a test so that a regression doesn't happen. |
just tried the code above and receiving: No module named 'pandas._libs.pandas_parser' and got inside of pandas: #Below imports needs to happen first to ensure pandas top level import pandas._libs.pandas_parser # isort: skip # type: ignore[reportUnusedImport] |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
numpy.maximum
fails when given args of type TimeStamp and Series(with dtype datetime64)Stacktrace follows:
Expected Behavior
Expected return value is:
Installed Versions
INSTALLED VERSIONS
commit : 2e218d1
python : 3.10.2.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.0-57-generic
Version : #63~20.04.1-Ubuntu SMP Wed Nov 30 13:40:16 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_GB.UTF-8
LOCALE : en_GB.UTF-8
pandas : 1.5.3
numpy : 1.24.1
pytz : 2021.3
dateutil : 2.8.2
setuptools : 59.6.0
pip : 22.3.1
Cython : 3.0.0a10
pytest : 7.1.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.2
lxml.etree : 4.7.1
html5lib : None
pymysql : None
psycopg2 : 2.9.3
jinja2 : 3.0.3
IPython : 8.0.1
pandas_datareader: None
bs4 : 4.8.2
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.5.1
numba : None
numexpr : 2.8.1
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : 6.0.1
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.10.0
snappy : None
sqlalchemy : None
tables : 3.7.0
tabulate : None
xarray : 2022.3.0
xlrd : 1.2.0
xlwt : 1.3.0
zstandard : None
tzdata : 2021.5
The text was updated successfully, but these errors were encountered: