-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
ENH: fill_value argument for shift #15527
Conversation
Tests+ are a WIP. |
@ResidentMario tip. write tests first! This validates that you are actually testing the right thing. |
Will try to follow TDD when here going forward. Right now, this looks like it works for non-datetimes, but with datetimes the fill value is treated as UNIX time. So e.g. What behavior should be followed in that case? Trying to read the |
It seems to me that the behavior the emulate here w.r.t.
|
no the fill value has to be a valid value for that dtype (this is checked already internally) |
The tests for As you stated above, the implementation is from a surface level as simple as passing the A couple of things I'm seeing in testing, however. I'm finding that in this implementation non-valid values actually get converted to The other thing is that |
yes So we certainly can raise on a not-None fill_value for certain types (categorical; sparse in theory could work though, but don't spend too much time on, you can simply open an issue) and to your last part, we are prob not validating things as much as we should so help there would be great as well! |
Would it be OK to make reworking the
Raises:
On:
Whereas this implementation results in an upcast to object type:
It would be good to write up something like a With this PR, I suggest:
|
@ResidentMario absolutely! in general, 1 PR -> 1 'issue'. It makes it easier to reason about / review. So for example I would leave this PR, and do another that does the validation as you suggest. You can then rebase this one on your new one (until it is merged), then rebase on master. Very happy with independent (or even dependent PR's as I suggest above), just indicate if that is the case in the top of the PR. and certainly filing issues is good as well; for bugs / features even if you plan to do them. It keeps things organized. |
closing as stale but good idea. master has changed a bit since this PR, might be easier now. |
git diff upstream/master | flake8 --diff