Fix fillna accepting downcast as dict by phofl · Pull Request #40861 · pandas-dev/pandas (original) (raw)
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 andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation8 Commits1 Checks0 Files changed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
[ Show hidden characters]({{ revealButtonHref }})
- closes BUG: AttributeError when using dict downcast in DataFrame.fillna #40809
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
This fix makes sense in this case I think, but this does not fix the case for non-list like values, which raises a NotImplementedError
The docstring for Series.fillna says, that downcast may be a dict too, but I don't think that this makes sense, so we should maybe raise an error there?
This fix makes sense in this case I think, but this does not fix the case for non-list like values, which raises a NotImplementedError
by coincidence i've been looking at Block.downcast and found that in the 1D case all test cases have dtypes in [None, "infer"]
(and the None case defaults to "infer"), and as you noted the 2D case only accepts "infer". Anything we can do to be stricter and/or get downcast out of Block would be a plus by my lights
Could deprecate the downcast keyword?
Could deprecate the downcast keyword?
id be on board for this, no idea about others.
Could deprecate the downcast keyword?
id be on board for this, no idea about others.
yeah +1 here as well. this was an artifact from a while back when this was expensive. we should always just downcast (as that is what we do everywhere else)
Open an issue about this or directly a pr?
Open an issue about this or directly a pr?
probably merits an issue, since im not sure @jreback and i are on the same page. my immediate interest is in getting the downcast keyword out of Block.fillna (and ideally Block.interpolate), which i think is distinct from what he has in mind
phofl mentioned this pull request
JulianWgs pushed a commit to JulianWgs/pandas that referenced this pull request