-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Can't use a lambda function in named aggregation #28467
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Works fine for me (python 3.7.4 and pandas 0.25.1). |
An easy way to try the error out is through this shared repl.it console. |
Reproduced on 0.25.1, but not on master FWIW.
…On Mon, Sep 16, 2019 at 2:37 PM Rafael Ferreira ***@***.***> wrote:
An easy way to try the error out is through this shared repl.it console
<https://repl.it/repls/OlivedrabLikelyDemo>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#28467?email_source=notifications&email_token=AAKAOIWUGM6GPWWAPTZKUMLQJ7N6RA5CNFSM4IXFVIC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD62IXCY#issuecomment-531925899>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKAOIQZYH656IIOKC2FM7DQJ7N6RANCNFSM4IXFVICQ>
.
|
This occurs for me in |
It occurs when you use more than one unnamed function on the same column: so it is the tuple of A workaround is using named functions (which is a pain). So, this fails with
While this works:
|
Both work fine on master for me. Could use a regression test.
|
@mroeschke exactly your code yields the following error for me (from the first agg):
|
Not sure that this issue should be closed: the referenced merged PR only contains testing functions: excellent that this is now covered, but the failure will remain... |
@robertmuil the reason the PR only contains testing functions is the issue was previously fixed |
understood
|
Code Sample, a copy-pastable example if possible
Problem description
When I
groupby
+agg
with a named function, the named aggregation works perfectly. However, when done with a lambda function instead, the following error is raised:Notice that his is not error 7186 because there are no more than one lambda here.
I've noticed that this error only happens when I mix
lambda
functions along withstr
-mapped functions, i.e. justworks just fine.
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.4.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-1036-gcp
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.25.1
numpy : 1.17.2
pytz : 2019.2
dateutil : 2.8.0
pip : 19.0.3
setuptools : 40.8.0
Cython : None
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 : 3.1.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.1
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
[paste the output of
pd.show_versions()
here below this line]The text was updated successfully, but these errors were encountered: