Skip to content

groupby.quantile() fails on Timedelta columns #29485

Closed
@dokteurwho

Description

@dokteurwho

Code Sample, groupby quantile example

# groupby quantile example
import pandas as pd

print(f"Pandas {pd.__version__}")

df = pd.DataFrame({
    'idx': [1, 1, 2],
    'start_date': ['2019-10-02', '2019-10-04', '2019-10-05'],
    'arrival_date': ['2019-11-02', '2019-10-14', '2019-10-15']})

for c in ['start_date', 'arrival_date']:
    df[c] = pd.to_datetime(df[c])

df['delta'] = df['arrival_date'] - df['start_date']

print(df.groupby('idx')[['delta']].quantile(.9))

Problem description

The code example used to work in 0.21.1.
In 0.25 I obtain a "TypeError: No matching signature found"

Expected Output

Pandas 0.21.1

           delta

idx
1 28 days 21:36:00
2 10 days 00:00:00

Output of pd.show_versions()

INSTALLED VERSIONS

commit : None
python : 3.6.8.final.0
python-bits : 64
OS : Linux
OS-release : 3.10.0-693.el7.x86_64
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 0.25.3
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.1
pip : 18.1
setuptools : 40.8.0.post20191016
Cython : 0.29.14
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
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 : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions