-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: pivot_table with margins=True and numeric columns is buggy #26568
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
Labels
good first issue
Needs Tests
Unit test(s) needed to prevent regressions
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Comments
This looks to work on master. Could use a test
|
This was referenced Jul 17, 2021
the first example is not fixed, The totals for the columns is zero.
|
take |
4 tasks
4 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
good first issue
Needs Tests
Unit test(s) needed to prevent regressions
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Code Sample, a copy-pastable example if possible
Setup:
When
index=0
andcolumns=1
the'All'
row has zeros instead of the sums:If the
index
parameter is not 0 or -1 anIndexError
is raised, but only ifmargins=True
:This works fine for non-numeric columns:
It also works fine if
index=0
and thecolumns
parameter is a numeric value other than 1:Problem description
The output of
pivot_table
withmargins=True
is inconsistent for numeric column namesExpected Output
I'd expect the output to be consistent with
Out[7]
/Out[8]
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: a91da0c
python: 3.6.8.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.25.0.dev0+620.ga91da0c94e
pytest: 4.2.0
pip: 19.0.1
setuptools: 40.6.3
Cython: 0.28.2
numpy: 1.16.2
scipy: 1.2.1
pyarrow: 0.6.0
xarray: 0.9.6
IPython: 7.2.0
sphinx: 1.8.2
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.9
feather: 0.4.0
matplotlib: 2.0.2
openpyxl: 2.4.8
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 0.9.8
lxml.etree: 3.8.0
bs4: None
html5lib: 0.999
sqlalchemy: 1.1.13
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: 0.1.5
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: