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
When upgrading from Pandas version 0.24.2 to 0.25.3 I noticed some of my old code failed of a sudden.
The above code isolates the issue: when grouping on more than one key and aggregating a Timestamp column, the _try_cast() method is called twice from inside _python_agg_general() method - the first call transforms the object type from Series to DatetimeArray and the second call fails because the new object doesn't have the _values attribute.
If the aggregated column is not of Timestamp dtype but eg., string, the code runs just fine:
Code Sample, a copy-pastable example if possible
Problem description
Potentially relates to #23683.
When upgrading from Pandas version 0.24.2 to 0.25.3 I noticed some of my old code failed of a sudden.
The above code isolates the issue: when grouping on more than one key and aggregating a Timestamp column, the
_try_cast()
method is called twice from inside_python_agg_general()
method - the first call transforms the object type from Series to DatetimeArray and the second call fails because the new object doesn't have the_values
attribute.If the aggregated column is not of Timestamp dtype but eg., string, the code runs just fine:
If we keep the Timestamp dtype but remove the timezone, the code runs just fine:
If we keep the Timestamp dtype and the timezone but aggregate on a single key, the code runs just fine:
Running the initial code sample produces the following exception:
Expected Output
Output of
pd.show_versions()
$ python -c 'import pandas as pd; pd.show_versions()'
INSTALLED VERSIONS
commit : None
python : 3.6.7.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.25.3
numpy : 1.17.2
pytz : 2018.5
dateutil : 2.7.3
pip : 18.0
setuptools : 40.4.0
Cython : None
pytest : 5.3.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 1.1.2
lxml.etree : 4.3.2
html5lib : 1.0.1
pymysql : 0.9.2
psycopg2 : None
jinja2 : 2.10
IPython : 6.5.0
pandas_datareader: None
bs4 : 4.6.3
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.3.2
matplotlib : 3.0.0
numexpr : 2.7.0
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.14.1
pytables : None
s3fs : None
scipy : 1.1.0
sqlalchemy : 1.2.11
tables : 3.5.2
xarray : None
xlrd : 1.1.0
xlwt : 1.3.0
xlsxwriter : 1.1.2
The text was updated successfully, but these errors were encountered: