Skip to content

POC/API/DEPR: errors kwd for fillna #45190

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
wants to merge 2 commits into from

Conversation

jbrockmendel
Copy link
Member

xref #45153

Upsides: 1) users get to control the behavior, 2) we can deprecate the inconsistent default behaviors to become consistent
Downsides: 1) Larger API surface area, 2) many more test cases to cover (which ATM this PR does none of), 3) increased code complexity, though most of that goes away once deprecations are enforced.

Could implement the same for Index.fillna to keep it consistent.

If we go down this road, I'd want to do the same for other sometimes-casting methods: putmask, where, replace. (which just leaves __setitem__ is inconsistent)

@TomAugspurger
Copy link
Contributor

Agreed with the goal to get things consistent. I don't have a strong preference on raising vs. coercing by default, or having a keyword or not.

@jbrockmendel jbrockmendel added the API - Consistency Internal Consistency of API/Behavior label Jan 6, 2022
@jreback
Copy link
Contributor

jreback commented Jan 8, 2022

+1 on doing this (didn't look in detail), of course should deprecate downcast at the same time....

@jreback jreback added the Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate label Jan 8, 2022
@jreback
Copy link
Contributor

jreback commented Jan 8, 2022

Agreed with the goal to get things consistent. I don't have a strong preference on raising vs. coercing by default, or having a keyword or not.

i think coercing by default is ok (its what pandas is good at generally) and keeps things natural while allowing user control if it really matters

@jbrockmendel
Copy link
Member Author

I think we're all on board, so im going to start writing tests/whatsnew for this.

Are we OK with only "coerce" and "raise" being allowed here? In other contexts we have "ignore", but I just see that as adding unnecessary API/test surface area.

@jbrockmendel
Copy link
Member Author

hmm for categorical in particular there is a question about what "coerce" should mean. e.g. Categorical._replace has coercion logic that is probably what we want here.

@jbrockmendel
Copy link
Member Author

Mothballing while I try to sort out some of the kinks (and to clear the queue)

@jbrockmendel jbrockmendel added the Mothballed Temporarily-closed PR the author plans to return to label Jan 13, 2022
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 Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Mothballed Temporarily-closed PR the author plans to return to
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants