Skip to content
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

Series.reorder_levels docstring includes extra axis argument. #22627

Closed
tschm opened this issue Sep 7, 2018 · 3 comments
Closed

Series.reorder_levels docstring includes extra axis argument. #22627

tschm opened this issue Sep 7, 2018 · 3 comments
Labels

Comments

@tschm
Copy link

tschm commented Sep 7, 2018

Code Sample, a copy-pastable example if possible

    def reorder_levels(self, order):
        """
        Rearrange index levels using input order. May not drop or duplicate
        levels

        Parameters
        ----------
        order : list of int representing new level order.
               (reference level by number or key)
        axis : where to reorder levels

        Returns
        -------
        type of caller (new object)
        """
        if not isinstance(self.index, MultiIndex):  # pragma: no cover
            raise Exception('Can only reorder levels on a hierarchical axis.')

        result = self.copy()
        result.index = result.index.reorder_levels(order)
        return result

Problem description

[this should explain why the current behaviour is a problem and why the expected output is a better solution.]

Note: We receive a lot of issues on our GitHub tracker, so it is very possible that your issue has been posted before. Please check first before submitting so that we do not have to handle and close duplicates!

Note: Many problems can be resolved by simply upgrading pandas to the latest version. Before submitting, please check if that solution works for you. If possible, you may want to check if master addresses this issue, but that is not necessary.

For documentation-related issues, you can check the latest versions of the docs on master here:

https://pandas-docs.github.io/pandas-docs-travis/

If the issue has not been resolved there, go ahead and file it in the issue tracker.

Expected Output

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

@TomAugspurger TomAugspurger changed the title axis argument missing in reorder_levels Series.reorder_levels docstring includes extra axis argument. Sep 7, 2018
@TomAugspurger
Copy link
Contributor

We can update the docs, or add an unused axis to Series.reorder_levels.

If we decide to add axis to Series.reorder_levels, it'll probably be easiest to just move the implementation to NDFrame.reorder_levels and use self._get_axis(axis)

@SandrineP
Copy link
Contributor

I can update the docs for now. I'll go ahead and create a PR.

@jbrockmendel
Copy link
Member

Closed by #22734

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

No branches or pull requests

4 participants