Description
-
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.
this piece of code does it, I don't really understand why these things are OK to be the same function here
pandas/pandas/core/resample.py
Line 308 in 7ffbf1a
Code Sample, a copy-pastable example
df = pd.DataFrame([[1,2],[3,4], [5,6]], index=pd.date_range("2020-01-30", "2020-02-01"))
df.resample("1M").apply(lambda df: df.mean().mean())
Problem description
current behavior calls the function on all columns, in all groups, as in aggregate, but is should on all dfs of the groups as in apply
Expected Output
2020-01-31 2.5
2020-02-29 5.5
Freq: M, dtype: float64
Output of pd.show_versions()
INSTALLED VERSIONS
commit : 2a7d332
python : 3.8.5.final.0
python-bits : 64
OS : Linux
OS-release : 5.2.1-1.el7.elrepo.x86_64
Version : #1 SMP Sun Jul 14 08:15:04 EDT 2019
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.1.2
numpy : 1.19.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.1.1
setuptools : 47.1.0
Cython : None
pytest : 4.6.11
hypothesis : 5.29.0
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.5 (dt dec pq3 ext lo64)
jinja2 : 2.11.2
IPython : 7.17.0
pandas_datareader: None
bs4 : None
bottleneck : 1.3.2
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.1
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : 1.3.19
tables : 3.6.1
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None