Skip to content

Commit 6121313

Browse files
committed
Added change to pass observed fixture to pivot_table test, added change version to docstring and updated correct whatsnew.
1 parent 0662fa3 commit 6121313

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

doc/source/whatsnew/v0.24.0.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ Other Enhancements
426426
- :func:`pandas.DataFrame.to_sql` has gained the ``method`` argument to control SQL insertion clause. See the :ref:`insertion method <io.sql.method>` section in the documentation. (:issue:`8953`)
427427
- :meth:`DataFrame.corrwith` now supports Spearman's rank correlation, Kendall's tau as well as callable correlation methods. (:issue:`21925`)
428428
- :meth:`DataFrame.to_json`, :meth:`DataFrame.to_csv`, :meth:`DataFrame.to_pickle`, and other export methods now support tilde(~) in path argument. (:issue:`23473`)
429-
- :meth:`DataFrame.pivot_table` now accepts ``observed`` parameter which is passed to underlying calls to :meth:`DataFrame.groupby` to speed up grouping categorical data. (:issue:`24923`)
430429

431430
.. _whatsnew_0240.api_breaking:
432431

doc/source/whatsnew/v0.25.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ including other versions of pandas.
1919
Other Enhancements
2020
^^^^^^^^^^^^^^^^^^
2121

22-
-
22+
:meth:`DataFrame.pivot_table` now accepts ``observed`` parameter which is passed to underlying calls to :meth:`DataFrame.groupby` to speed up grouping categorical data. (:issue:`24923`)
2323
-
2424
-
2525

pandas/core/frame.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5675,6 +5675,8 @@ def pivot(self, index=None, columns=None, values=None):
56755675
If True: only show observed values for categorical groupers.
56765676
If False: show all values for categorical groupers.
56775677
5678+
.. versionchanged :: 0.25.0
5679+
56785680
Returns
56795681
-------
56805682
table : DataFrame

pandas/tests/reshape/test_pivot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ def setup_method(self, method):
3838
'E': np.random.randn(11),
3939
'F': np.random.randn(11)})
4040

41-
def test_pivot_table(self):
41+
def test_pivot_table(self, observed):
4242
index = ['A', 'B']
4343
columns = 'C'
4444
table = pivot_table(self.data, values='D',
45-
index=index, columns=columns)
45+
index=index, columns=columns, observed=observed)
4646

4747
table2 = self.data.pivot_table(
48-
values='D', index=index, columns=columns)
48+
values='D', index=index, columns=columns, observed=observed)
4949
tm.assert_frame_equal(table, table2)
5050

5151
# this works
52-
pivot_table(self.data, values='D', index=index)
52+
pivot_table(self.data, values='D', index=index, observed=observed)
5353

5454
if len(index) > 1:
5555
assert table.index.names == tuple(index)

0 commit comments

Comments
 (0)