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

DOC: Should DataFrame.drop() accept a set for the columns , index and labels argument? #59890

Open
1 task done
Dr-Irv opened this issue Sep 25, 2024 · 0 comments
Open
1 task done
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@Dr-Irv
Copy link
Contributor

Dr-Irv commented Sep 25, 2024

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.drop.html

Documentation problem

The arguments labels, index and columns are documented as "single label or list-like". But a set is accepted:

import pandas as pd

df = pd.DataFrame({1: [2], 3: [4]})   # Fix is here
df = df.drop(columns={1})

The pandas source declaration in the typing declarations does not allow a set to be passed.

Suggested fix for documentation

Unclear.

Either we update the docs to say a set is allowed (and update the internal types), OR we add a check to see if a set is passed and raise an exception.

First raised as a pandas-stubs issue in pandas-dev/pandas-stubs#1008

@Dr-Irv Dr-Irv added Docs Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

1 participant