Skip to content

API: Have pd.pivot mirror pivot instead of pivot_simple #22116

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

Closed
mroeschke opened this issue Jul 29, 2018 · 6 comments · Fixed by #22209
Closed

API: Have pd.pivot mirror pivot instead of pivot_simple #22116

mroeschke opened this issue Jul 29, 2018 · 6 comments · Fixed by #22209

Comments

@mroeschke
Copy link
Member

To pivot, there's currently:

pd.pivot_table / df.pivot_table

def pivot_table(data, values=None, index=None, columns=None, aggfunc='mean',

df.pivot

def pivot(self, index=None, columns=None, values=None):

pivot_simple (Importable at the top level as pd.pivot)

def pivot_simple(index, columns, values):

I'm not sure why pd.pivot currently doesn't mirror df.pivot like how pd.pivot_table mirrors df.pivot_table, but it would clearer if these were in sync.

@gfyoung
Copy link
Member

gfyoung commented Jul 30, 2018

cc @jreback

@mroeschke
Copy link
Member Author

There's also a quote in reshaping.rst that doesn't seem to be true:

To reshape the data into this form, we use the DataFrame.pivot() method (also implemented as a top level function pivot())

but pivot() that is referred above uses the pivot_simple implementation instead of the pivot implementation.

@jreback jreback added this to the 0.24.0 milestone Aug 6, 2018
@jreback jreback added the Clean label Aug 6, 2018
@jorisvandenbossche jorisvandenbossche added the Blocker Blocking issue or pull request for an upcoming release label Aug 16, 2018
@jorisvandenbossche jorisvandenbossche changed the title CLN: Have pd.pivot mirror pivot instead of pivot_simple API: Have pd.pivot mirror pivot instead of pivot_simple Aug 16, 2018
@jorisvandenbossche
Copy link
Member

Reopening this one instead of opening a new issue.

So PR #22209 changed the top-level pd.pivot to match the behaviour of DataFrame.pivot. This is however a breaking change, so I think we should discuss in more detail if we want this, and if so, at least deprecate the current behaviour.

One option is to deprecate the current behaviour (and from the passed values, I think we should be able to infer if the old or new behaviour is wanted).

But, we maybe first need to discuss if we want to fully deprecate the old behaviour.

@jreback jreback modified the milestones: 0.24.0, Contributions Welcome Dec 2, 2018
@TomAugspurger
Copy link
Contributor

Anyone have thoughts here? Is this blocking for 0.24.0?

@jreback
Copy link
Contributor

jreback commented Jan 3, 2019

not blocking

@TomAugspurger TomAugspurger removed Blocker Blocking issue or pull request for an upcoming release labels Jun 20, 2019
@mroeschke
Copy link
Member Author

Closing as this change has persisted since 0.24.0 and no complaints so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants