Closed
Description
Code Sample, a copy-pastable example if possible
import pandas as pd
import numpy as np
from functools import partial
df = pd.DataFrame(
np.random.randn(1000, 3),
index=pd.date_range('1/1/2012', freq='S', periods=1000),
columns=['A', 'B', 'C']
)
dfg = df.resample('3T').agg(
{'A': [
partial(np.quantile, q=.9999),
partial(np.quantile, q=.90),
]}
)
Problem description
Resample, unlike groupby, has no ability to do named aggregation. This means if you use a function twice on the same column you get an error saying:
pandas.core.base.SpecificationError: Function names must be unique, found multiple named quantile
.
It would be very useful to make the resample agg interface similar to the groupby agg interface. An example of the named aggregation is here: https://pandas.pydata.org/pandas-docs/stable/user_guide/groupby.html#named-aggregation
Expected Output
Output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit : None
python : 3.6.9.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : None
LOCALE : en_US.UTF-8
pandas : 0.25.3
numpy : 1.17.4
pytz : 2019.3
dateutil : 2.8.1
pip : 18.1
setuptools : 40.6.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
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 : 0.15.1
pytables : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None