BUG: Series.count() raises exception after upgrading from v0.24.1 to v0.25.3 if use_inf_as_na is enabled for a DateTime series. · Issue #29478 · pandas-dev/pandas (original) (raw)
Code Sample, a copy-pastable example if possible
Your code here
import pandas as pd from datetime import datetime
if name == 'main': s = pd.Series([datetime.now()]) with pd.option_context('use_inf_as_na', True): s.count()
Problem description
Previously with pandas v0.24.1, the above code works well,
however, after I upgrade the version to v0.25.3,
the above code raises an exception:AttributeError: 'DatetimeArray' object has no attribute '_constructor'
It seems that something goes wrong when passing a DatetimeArray
to _isna_old
.
I think it is a bug introduced in some recent update.
Expected Output
Output of pd.show_versions()
[paste the output of pd.show_versions()
here below this line]
INSTALLED VERSIONS
commit : None
python : 3.6.8.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 85 Stepping 4, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 0.25.3
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.0
pip : 18.1
setuptools : 40.6.2
Cython : None
pytest : 4.3.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.9.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.12.1
pytables : None
s3fs : None
scipy : 1.2.1
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None