Skip to content

Commit d9f31e1

Browse files
author
Christoph Möhl
committed
ENH 15972 minor changes as suggested by reviewers
1 parent 98b8c00 commit d9f31e1

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

doc/source/whatsnew/v0.20.0.txt

Lines changed: 0 additions & 1 deletion
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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Other Enhancements
3737
- :func:`api.types.infer_dtype` now infers decimals. (:issue: `15690`)
3838
- :func:`read_feather` has gained the ``nthreads`` parameter for multi-threaded operations (:issue:`16359`)
3939
- :func:`DataFrame.clip()` and :func: `Series.cip()` have gained an inplace argument. (:issue: `15388`)
40+
- ``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`)
4041

4142
.. _whatsnew_0210.api_breaking:
4243

pandas/core/reshape/pivot.py

Lines changed: 1 addition & 3 deletions
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

Lines changed: 1 addition & 0 deletions
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)