Skip to content

API/CLN: Have toplevel pd.pivot mirror pivot instead of pivot_simple #22209

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

Merged
merged 12 commits into from
Aug 8, 2018
Prev Previous commit
Next Next commit
Remove pivot_simple
  • Loading branch information
Matt Roeschke committed Aug 5, 2018
commit 088c6c418610ad7798f26ae95ad8b55dc581f894
40 changes: 0 additions & 40 deletions pandas/core/reshape/reshape.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,46 +383,6 @@ def _unstack_multiple(data, clocs, fill_value=None):
return unstacked


def pivot_simple(index, columns, values):
"""
Produce 'pivot' table based on 3 columns of this DataFrame.
Uses unique values from index / columns and fills with values.

Parameters
----------
index : ndarray
Labels to use to make new frame's index
columns : ndarray
Labels to use to make new frame's columns
values : ndarray
Values to use for populating new frame's values

Notes
-----
Obviously, all 3 of the input arguments must have the same length

Returns
-------
DataFrame

See also
--------
DataFrame.pivot_table : generalization of pivot that can handle
duplicate values for one index/column pair
"""
if (len(index) != len(columns)) or (len(columns) != len(values)):
raise AssertionError('Length of index, columns, and values must be the'
' same')

if len(index) == 0:
return DataFrame(index=[])

hindex = MultiIndex.from_arrays([index, columns])
series = Series(values.ravel(), index=hindex)
series = series.sort_index(level=0)
return series.unstack()


def _slow_pivot(index, columns, values):
"""
Produce 'pivot' table based on 3 columns of this DataFrame.
Expand Down