Skip to content

Commit abe70e6

Browse files
author
Christoph Möhl
committed
ENH 15972 minor changes as suggested by reviewers
1 parent 572c4fe commit abe70e6

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

doc/source/whatsnew/v0.20.0.txt

-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,6 @@ Other Enhancements
514514
- ``parallel_coordinates()`` has gained a ``sort_labels`` keyword argument that sorts class labels and the colors assigned to them (:issue:`15908`)
515515
- Options added to allow one to turn on/off using ``bottleneck`` and ``numexpr``, see :ref:`here <basics.accelerate>` (:issue:`16157`)
516516
- ``DataFrame.style.bar()`` now accepts two more options to further customize the bar chart. Bar alignment is set with ``align='left'|'mid'|'zero'``, the default is "left", which is backward compatible; You can now pass a list of ``color=[color_negative, color_positive]``. (:issue:`14757`)
517-
- ``Crosstab`` has gained a ``margins_name`` parameter to define the name of the row / column that will contain the totals when margins is True(:issue:`15972`)
518517

519518
.. _ISO 8601 duration: https://en.wikipedia.org/wiki/ISO_8601#Durations
520519

doc/source/whatsnew/v0.21.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Other Enhancements
3535
- ``RangeIndex.append`` now returns a ``RangeIndex`` object when possible (:issue:`16212`)
3636
- :func:`to_pickle` has gained a protocol parameter (:issue:`16252`). By default, this parameter is set to `HIGHEST_PROTOCOL <https://docs.python.org/3/library/pickle.html#data-stream-format>`__
3737
- :func:`api.types.infer_dtype` now infers decimals. (:issue: `15690`)
38+
- ``Crosstab`` has gained a ``margins_name`` parameter to define the name of the row / column that will contain the totals when margins is True. (:issue:`15972`)
3839

3940
.. _whatsnew_0210.api_breaking:
4041

pandas/core/reshape/pivot.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ def crosstab(index, columns, values=None, rownames=None, colnames=None,
416416
Name of the row / column that will contain the totals
417417
when margins is True.
418418
419-
.. versionadded:: 0.20.0
419+
.. versionadded:: 0.21.0
420420
421421
dropna : boolean, default True
422422
Do not include columns whose entries are all NaN
@@ -573,8 +573,6 @@ def _normalize(table, normalize, margins, margins_name='All'):
573573
index_margin = index_margin / index_margin.sum()
574574
index_margin.loc[margins_name] = 1
575575
table = concat([table, column_margin], axis=1)
576-
print('index margin')
577-
print(index_margin)
578576
table = table.append(index_margin)
579577

580578
table = table.fillna(0)

pandas/tests/reshape/test_pivot.py

+1
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,7 @@ def test_crosstab_margins(self):
10721072
tm.assert_series_equal(all_rows, exp_rows)
10731073

10741074
def test_crosstab_margins_set_margin_name(self):
1075+
# GH 15972
10751076
a = np.random.randint(0, 7, size=100)
10761077
b = np.random.randint(0, 3, size=100)
10771078
c = np.random.randint(0, 5, size=100)

0 commit comments

Comments
 (0)