-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
[WIP] Custom fill value for reindex, align, and merge operations #2920
Conversation
Hello @zdgriffith! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-05-02 21:54:47 UTC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zdgriffith this is fantastic, thank you!
I think the only thing that is missing is a brief release announcement in whats-new.rst
xarray/core/alignment.py
Outdated
"""align(*objects, join='inner', copy=True, indexes=None, | ||
exclude=frozenset()) | ||
"""align(*objects, join='inner', copy=True, fill_value=dtypes.NA, | ||
indexes=None, exclude=frozenset()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small additional clean-up you could optionally do here: since we no longer support Python 2, these function signature could be moved from the docstring onto the function itself, e.g.,
def align(*objects, join='inner', copy=True, fill_value=dtypes.NA,
indexes=None, exclude=frozenset())"
This would let you drop the calls to kwargs.pop()
below, and would be a small win for efficiency/clean code.
Thanks for the review @shoyer! Would edits to the docs be in-scope for this PR? For example where fill values are mentioned in http://xarray.pydata.org/en/latest/indexing.html#align-and-reindex. |
Up to you. Would be happy to include any edits you think are appropriate but they aren't required. The API docs are the canonical reference for various function options but if you think there are good places to mention this option in the narrative docs that would also be welcome. |
+1 for a line in the docs, I don't think an example is needed |
thanks @zdgriffith! |
* upstream/master: [WIP] Custom fill value for reindex, align, and merge operations (pydata#2920) Attempt to fix py35 build on Travis (pydata#2925) List formatting in docs (pydata#2939) DOC: Avoid downloading .tif file (pydata#2919)
This PR adds an optional
fill_value
parameter for the following functions/methods:The value given to
fill_value
is used to fill missing values in the new object after the operation. By defaultfill_value
is NaN.whats-new.rst
for all changes andapi.rst
for new API