Skip to content

ENH: dropna should accept single column as string in subset argument #41021

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
erfannariman opened this issue Apr 18, 2021 · 1 comment · Fixed by #41022
Closed

ENH: dropna should accept single column as string in subset argument #41021

erfannariman opened this issue Apr 18, 2021 · 1 comment · Fixed by #41022
Labels
API - Consistency Internal Consistency of API/Behavior Enhancement
Milestone

Comments

@erfannariman
Copy link
Member

Is your feature request related to a problem?

When giving a string in the subset argument to dropna based on a single column, we get an error:

Index(...) must be called with a collection of some kind, 'C' was passed

Describe the solution you'd like

DataFrame.dropna should accept a single column subset as a string just like DataFrame.drop_duplicates

API breaking implications

None I could think of

df = pd.DataFrame({"A": [1, 1, 3], "B": list("abc"), "C": [4, np.NaN, 5]})
print(df)

   A  B    C
0  1  a  4.0
1  2  b  NaN
2  3  c  5.0

df = df.dropna(subset="C")
print(df)

   A  B    C
0  1  a  4.0
2  3  c  5.0
@rhshadrach
Copy link
Member

+1 Accepting a label or list is done in many places.

@rhshadrach rhshadrach added API - Consistency Internal Consistency of API/Behavior and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Apr 20, 2021
@rhshadrach rhshadrach added this to the 1.3 milestone Apr 20, 2021
@simonjayhawkins simonjayhawkins removed this from the 1.3 milestone May 25, 2021
@jreback jreback added this to the 1.4 milestone Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API - Consistency Internal Consistency of API/Behavior Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants