Skip to content

Commit 4814823

Browse files
mroeschkejorisvandenbossche
authored andcommitted
DOC: Explain pivot vs. pivot_table (#6950) (#14650)
Move pivot paragraph to pivot table section add pivot_table reference to pivot
1 parent a7604fc commit 4814823

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

doc/source/reshaping.rst

+4
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ Pivot tables
323323

324324
.. _reshaping.pivot:
325325

326+
While ``pivot`` provides general purpose pivoting of DataFrames with various
327+
data types (strings, numerics, etc.), Pandas also provides the ``pivot_table``
328+
function for pivoting with aggregation of numeric data.
329+
326330
The function ``pandas.pivot_table`` can be used to create spreadsheet-style pivot
327331
tables. See the :ref:`cookbook<cookbook.pivot>` for some advanced strategies
328332

pandas/core/reshape.py

+5
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,11 @@ def pivot_simple(index, columns, values):
357357
Returns
358358
-------
359359
DataFrame
360+
361+
See also
362+
--------
363+
DataFrame.pivot_table : generalization of pivot that can handle
364+
duplicate values for one index/column pair
360365
"""
361366
if (len(index) != len(columns)) or (len(columns) != len(values)):
362367
raise AssertionError('Length of index, columns, and values must be the'

pandas/tools/pivot.py

+5
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,11 @@ def pivot_table(data, values=None, index=None, columns=None, aggfunc='mean',
7575
Returns
7676
-------
7777
table : DataFrame
78+
79+
See also
80+
--------
81+
DataFrame.pivot : pivot without aggregation that can handle
82+
non-numeric data
7883
"""
7984
index = _convert_by(index)
8085
columns = _convert_by(columns)

0 commit comments

Comments
 (0)