Skip to content
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

BUG: sum with axis=None does not apply the aggregation across both axes. #52977

Closed
2 of 3 tasks
arnaudlegout opened this issue Apr 28, 2023 · 4 comments
Closed
2 of 3 tasks
Assignees
Labels
Bug Reduction Operations sum, mean, min, max, etc.

Comments

@arnaudlegout
Copy link
Contributor

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
import numpy as np
a = np.random.randint(1, 20, 9).reshape(3,3)
p = pd.DataFrame(a, index=['a', 'b', 'c'], columns=['x', 'y', 'z'])
p.sum(axis=None)
>>>
x    42
y    24
z    20
dtype: int64

Issue Description

According to the documentation of DataFrame.sum using axis=None should apply the aggregation across both axes.
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.sum.html

This is not the case in the given example.

Expected Behavior

returns the aggregation across both axes, that is, return 86

Installed Versions

INSTALLED VERSIONS

commit : 37ea63d
python : 3.10.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.13.0-1033-gcp
Version : #40~20.04.1-Ubuntu SMP Tue Jun 14 00:44:12 UTC 2022
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : C.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 2.0.1
numpy : 1.22.1
pytz : 2023.3
dateutil : 2.8.2
setuptools : 67.6.1
pip : 23.1
Cython : 0.29.30
pytest : 7.1.3
hypothesis : 6.72.0
sphinx : 6.1.3
blosc : None
feather : None
xlsxwriter : 3.0.8
lxml.etree : 4.8.0
html5lib : 1.1
pymysql : None
psycopg2 : 2.9.3
jinja2 : 3.1.2
IPython : 7.34.0
pandas_datareader: 0.10.0
bs4 : 4.8.2
bottleneck : 1.3.2
brotli : 1.0.9
fastparquet : None
fsspec : 2022.5.0
gcsfs : 2022.5.0
matplotlib : 3.6.3
numba : 0.56.4
numexpr : 2.8.4
odfpy : None
openpyxl : 3.0.9
pandas_gbq : 0.19.1
pyarrow : 10.0.1
pyreadstat : 1.1.9
pyxlsb : None
s3fs : None
scipy : 1.10.1
snappy : None
sqlalchemy : 1.4.39
tables : 3.7.0
tabulate : 0.8.10
xarray : 2022.6.0
xlrd : 2.0.1
zstandard : None
tzdata : 2023.3
qtpy : 2.1.0
pyqt5 : None

@arnaudlegout arnaudlegout added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 28, 2023
@jbrockmendel
Copy link
Member

xref #52042

@rhshadrach rhshadrach added Reduction Operations sum, mean, min, max, etc. and removed Needs Triage Issue that has not been reviewed by a pandas team member labels May 2, 2023
@NikolayBoev
Copy link
Contributor

take

@jbrockmendel
Copy link
Member

Closed by #52042

@ZougaRida
Copy link

Until this date, this feature is depracated by looking at #52042 commits, will it be available in future releases or am I wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reduction Operations sum, mean, min, max, etc.
Projects
None yet
Development

No branches or pull requests

5 participants