Skip to content

DOC: Update pandas.DataFrame.droplevel docstring #32004

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 5 commits into from
Feb 25, 2020
Merged

DOC: Update pandas.DataFrame.droplevel docstring #32004

merged 5 commits into from
Feb 25, 2020

Conversation

asyarif93
Copy link
Contributor

@asyarif93 asyarif93 commented Feb 15, 2020

Output of python scripts/validate_docstrings.py pandas.DataFrame.droplevel:

################################################################################
#################### Docstring (pandas.DataFrame.droplevel) ####################
################################################################################

Return DataFrame with requested index / column level(s) removed.

.. versionadded:: 0.24.0

Parameters
----------
level : int, str, or list-like
    If a string is given, must be the name of a level
    If list-like, elements must be names or positional indexes
    of levels.

axis : {0 or 'index', 1 or 'columns'}, default 0
    Axis along which the level(s) is removed:

    * 0 or 'index': remove level(s) in column.
    * 1 or 'columns': remove level(s) in row.

Returns
-------
DataFrame
    DataFrame with requested index / column level(s) removed.

Examples
--------
>>> df = pd.DataFrame([
...     [1, 2, 3, 4],
...     [5, 6, 7, 8],
...     [9, 10, 11, 12]
... ]).set_index([0, 1]).rename_axis(['a', 'b'])

>>> df.columns = pd.MultiIndex.from_tuples([
...     ('c', 'e'), ('d', 'f')
... ], names=['level_1', 'level_2'])

>>> df
level_1   c   d
level_2   e   f
a b
1 2      3   4
5 6      7   8
9 10    11  12

>>> df.droplevel('a')
level_1   c   d
level_2   e   f
b
2        3   4
6        7   8
10      11  12

>>> df.droplevel('level_2', axis=1)
level_1   c   d
a b
1 2      3   4
5 6      7   8
9 10    11  12

################################################################################
################################## Validation ##################################
################################################################################

1 Errors found:
	See Also section not found

Copy link
Member

@datapythonista datapythonista left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks for the fixes.

Can you update your branch with master, so the CI is green (git fetch upstream && git merge upstream/master from your branch, you need to have the upstream remote set to the original pandas repo).

Also, can you remove droplevel from this line: https://github.com/pandas-dev/pandas/blob/master/ci/code_checks.sh#L272 Now that you fixed the examples we don't need to exclude running its tests.

Thank you!

@WillAyd
Copy link
Member

WillAyd commented Feb 20, 2020

@asyarif93 can you merge master and repush again to get CI green?

@WillAyd WillAyd added this to the 1.1 milestone Feb 25, 2020
@WillAyd WillAyd merged commit 54b4001 into pandas-dev:master Feb 25, 2020
@WillAyd
Copy link
Member

WillAyd commented Feb 25, 2020

Thanks @asyarif93

roberthdevries pushed a commit to roberthdevries/pandas that referenced this pull request Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants