-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: AssertionError: <class 'pandas.core.arrays.datetimes.DatetimeArray'> on concat #40841
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
@nathanielatom thanks for the report! Seems to be a regression between 1.0.x and 1.1.x |
Looks like this happens because of pandas/pandas/core/indexes/base.py Line 2980 in 9bfa67c
which returns a DatetimeArray instead of a numpy array |
first bad commit: [cf8c680] BUG: preserve object dtype for Index set ops (#31401)
|
removed 1.2.x milestone as this is an regression in 1.1.0 |
@simonjayhawkins I added back the milestone (but 1.2.5), as this is still a recent regression (not everybody directly upgrades to the next pandas when released, and 1.1.x is quite recent). If there is a PR to fix this, I think it is appropriate to backport it. |
OK but we have the regression label to track regressions. I tend to use the 1.2.x milestones to track the regressions from the last minor release, i.e. 1.2.
sure. not having the milestone does not prevent us backporting older regression fixes. |
Maybe an alternative could be to have 2 regression labels. released and unreleased instead of using milestones. (Although the blocker label is sometimes used for unreleased regressions) |
In the OP, do we expect the concatenated Index to be object dtype or datetime64tz? |
In pandas v1.0.5 the resulting index is object dtype:
I also edited/updated the OP with the full DataFrame. |
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Code Sample, a copy-pastable example
Problem description
This appears to be a regression when concatenating DataFrames with partially null DatetimeIndices. I don't know precisely in which version it was introduced, but it worked with v0.25.3 and python 3.6.
Expected Output
Concatenated DataFrame from pandas v1.0.5:
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : f2c8480
python : 3.9.2.final.0
python-bits : 64
OS : Darwin
OS-release : 16.7.0
Version : Darwin Kernel Version 16.7.0: Thu Dec 20 21:53:35 PST 2018; root:xnu-3789.73.31~1/RELEASE_X86_64
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_CA.UTF-8
LOCALE : en_CA.UTF-8
pandas : 1.2.3
numpy : 1.20.2
pytz : 2021.1
dateutil : 2.8.1
pip : 21.0.1
setuptools : 49.6.0.post20210108
Cython : None
pytest : 6.2.3
hypothesis : None
sphinx : 3.5.3
blosc : None
feather : None
xlsxwriter : 1.3.8
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.22.0
pandas_datareader: None
bs4 : None
bottleneck : 1.3.2
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.4
numexpr : 2.7.3
odfpy : None
openpyxl : 3.0.7
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.6.2
sqlalchemy : None
tables : 3.6.1
tabulate : None
xarray : 0.17.0
xlrd : 2.0.1
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: