Skip to content

Add a FutureWarning to Dataset.__iter__ and Dataset.__len__ #1658

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

Merged
merged 2 commits into from
Oct 27, 2017

Conversation

shoyer
Copy link
Member

@shoyer shoyer commented Oct 25, 2017

This will allow us to resolve a long-standing pain-point with consistency between pandas and xarray.

CC @pydata/xarray

xref GH884

This will allow us to resolve a long-standing pain-point with consistency
between pandas and xarray.

CC pydata/xarray
@shoyer shoyer requested a review from max-sixty October 25, 2017 05:00
Copy link
Member

@jhamman jhamman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just few doc changes. Did you test test this by setting these new warnings to errors to make sure you've found all the locations that need to changed?

``ds.keys()``) the next major release of xarray, to only include data
variables instead of both data variables and coordinates. In the meantime,
please prefer iterating over keys in ``ds.data_vars`` or ``ds.coords``, or
``ds.variables`` if you need both at once.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could use some polishing. The first sentence should probably be split in two. Also, the "please prefer" statement is a bit awkward.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to keep this as a simple version of the full deprecation warning, and leave the detailed rationale to whats-new.rst. Let me know if this is any better...

for membership in ``DataArray.coords``. In the next major version of
xarray, it will check membership in the array data found in
``DataArray.values`` instead (:issue:`1267`).
- Directly iteration over and counting a ``Dataset`` (e.g., ``[k for k in ds]``,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directly->Direct

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@shoyer
Copy link
Member Author

shoyer commented Oct 25, 2017

Yes, this was tested by making the warnings errors.

Copy link
Collaborator

@max-sixty max-sixty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@shoyer shoyer merged commit 120e039 into pydata:master Oct 27, 2017
@shoyer shoyer deleted the deprecate-Dataset-iter branch October 27, 2017 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants