-
-
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
Control attrs of result in merge()
, concat()
, combine_by_coords()
and combine_nested()
#3877
Conversation
Adds option 'promote_attrs' to DataArray.to_dataset(). By default promote_attrs=False, maintaining current behaviour. If promote_attrs=True, the attrs of the DataArray are shallow-copied to the Dataset returned by to_dataset().
If the values of any shared key are not equivalent, then raises an error.
Provides several options for how to combine the attributes of the passed objects and give them to the returned Dataset.
Provides several options for how to combine the attributes of the passed objects and give them to the returned DataArray or Dataset.
Provides several options for how to combine the attributes of the passed objects and give them to the returned Dataset.
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.
This looks excellent! Thanks @johnomotani !
Any thoughts from anyone re the kwarg name combine_coords
or its options? They seem reasonable to me.
Apply suggestions from code review Co-Authored-By: Maximilian Roos <[email protected]>
No need for these arguments to be MutableMapping rather than just Mapping.
Any other thoughts from anyone before we hit the big green button? |
854e922
to
5249814
Compare
Do not use OrderedDicts any more, so name did not make sense.
5249814
to
9cc68a9
Compare
Oh sweet! Should there perhaps be another option to specify which object to get the attrs from? I'm just thinking by analogy to how |
That would actually be nice to have in |
For specifying which object, one possibility would be to pass an |
I'm not in favour of an integer argument, for the reasons discussed for
Fine to discuss this on a separate PR though. |
- Control over attributes of result in :py:func:`merge`, :py:func:`concat`, | ||
:py:func:`combine_by_coords` and :py:func:`combine_nested` using | ||
combine_attrs keyword argument. (:issue:`3865`, :pull:`3877`) | ||
By `John Omotani <https://github.com/johnomotani>`_ |
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.
Could we merge master and move this to 0.16.0?
Let's merge later today unless there are other comments? |
Merging — any other feedback please post and we can follow-up on. Thanks a lot @johnomotani , great PR! |
* upstream/master: (54 commits) Limit repr of arrays containing long strings (pydata#3900) expose a few zarr backend functions as semi-public api (pydata#3897) Use drawstyle instead of linestyle in plot.step. (pydata#3274) Implementation of polyfit and polyval (pydata#3733) misplaced quote in whatsnew (pydata#3889) Rename ordered_dict_intersection -> compat_dict_intersection (pydata#3887) Control attrs of result in `merge()`, `concat()`, `combine_by_coords()` and `combine_nested()` (pydata#3877) xfail test_uamiv_format_write (pydata#3885) Use `fixes` in PR template (pydata#3886) Tweaks to "how_to_release" (pydata#3882) whatsnew section for 0.16.0 Release v0.15.1 whatsnew for 0.15.1 (pydata#3879) update panel documentation (pydata#3880) reword the whats-new entry for unit support (pydata#3878) Raise error when assigning to IndexVariable.values & IndexVariable.data (pydata#3862) Re-enable tests xfailed in pydata#3808 and fix new CFTimeIndex failures due to upstream changes (pydata#3874) add spacing in the versions section of the issue report (pydata#3876) map_blocks: allow user function to add new unindexed dimension. (pydata#3817) Delete associated indexes when deleting coordinate variables. (pydata#3840) ...
* upstream/master: (75 commits) Implement idxmax and idxmin functions (pydata#3871) Update pre-commit-config.yaml (pydata#3911) Revert "Use `fixes` in PR template (pydata#3886)" (pydata#3912) update the docstring of diff (pydata#3909) Un-xfail test_dayofyear_after_cftime_range (pydata#3907) Limit repr of arrays containing long strings (pydata#3900) expose a few zarr backend functions as semi-public api (pydata#3897) Use drawstyle instead of linestyle in plot.step. (pydata#3274) Implementation of polyfit and polyval (pydata#3733) misplaced quote in whatsnew (pydata#3889) Rename ordered_dict_intersection -> compat_dict_intersection (pydata#3887) Control attrs of result in `merge()`, `concat()`, `combine_by_coords()` and `combine_nested()` (pydata#3877) xfail test_uamiv_format_write (pydata#3885) Use `fixes` in PR template (pydata#3886) Tweaks to "how_to_release" (pydata#3882) whatsnew section for 0.16.0 Release v0.15.1 whatsnew for 0.15.1 (pydata#3879) update panel documentation (pydata#3880) reword the whats-new entry for unit support (pydata#3878) ...
combine_attrs
argument formerge()
,concat()
,combine_by_coords()
andcombine_nested()
controls what attributes the result is given. Defaults maintain the current behaviour. Possible values (named followingcompat
arguments) are:merge
drops attributes #3865isort -rc . && black . && mypy . && flake8
whats-new.rst
for all changes andapi.rst
for new API