Skip to content
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

Add head, tail and thin methods #3278

Merged
merged 5 commits into from
Sep 5, 2019
Merged

Conversation

griverat
Copy link
Contributor

@griverat griverat commented Sep 3, 2019

I feel like there's room for improvement in the docstrings, any change or suggestion is welcome!

@pep8speaks
Copy link

pep8speaks commented Sep 3, 2019

Hello @DangoMelon! 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-09-04 19:28:37 UTC

xarray/core/dataset.py Outdated Show resolved Hide resolved
@max-sixty
Copy link
Collaborator

Looks great! V good first effort @DangoMelon

Any thoughts from others? Do we want a default (e.g. 5)?

@shoyer
Copy link
Member

shoyer commented Sep 5, 2019

Do we want to support integer values, indicating that an operation should be applied to all dimensions? e.g., supposing ds has dimensions x and y, then ds.head(5) would be equivalent to ds.head(x=5, y=5).

This would be a natural way to support a default value (if we want that) -- we could simply set the default value to 5, so ds.head() -> ds.head(5) -> ds.head(x=5, y=5).

@shoyer
Copy link
Member

shoyer commented Sep 5, 2019

But yes, I agree with @max-sixty this looks great, and already ready to merge!

If you don't have time to work on default values and/or integers now, we can always merge this PR now and leave those backwards compatible API changes for later :)

@max-sixty
Copy link
Collaborator

Great!

In the spirit of faster iteration, I'll merge this @DangoMelon and then if you want to add default values (I also like the idea of supporting a single value), please go ahead!

@max-sixty max-sixty merged commit 5c6aebc into pydata:master Sep 5, 2019
@griverat
Copy link
Contributor Author

griverat commented Sep 5, 2019

Thanks @max-sixty @shoyer !! I also agree with your suggestions and will be working on adding the default values during these days.

@griverat griverat deleted the head-tail-thin branch September 5, 2019 05:49
dcherian added a commit to dcherian/xarray that referenced this pull request Sep 19, 2019
* master:
  Fix whats-new date :/
  Revert to dev version
  Release v0.13.0
  auto_combine deprecation to 0.14 (pydata#3314)
  Deprecation: groupby, resample default dim. (pydata#3313)
  Raise error if cmap is list of colors (pydata#3310)
  Refactor concat to use merge for non-concatenated variables (pydata#3239)
  Honor `keep_attrs` in DataArray.quantile (pydata#3305)
  Fix DataArray api doc (pydata#3309)
  Accept int value in head, thin and tail (pydata#3298)
  ignore h5py 2.10.0 warnings and fix invalid_netcdf warning test. (pydata#3301)
  Update why-xarray.rst with clearer expression (pydata#3307)
  Compat and encoding deprecation to 0.14 (pydata#3294)
  Remove deprecated concat kwargs. (pydata#3288)
  allow np-array levels and colors in 2D plots (pydata#3295)
  Remove some deprecations (pydata#3292)
  Make argmin/max work lazy with dask (pydata#3244)
  Add head, tail and thin methods (pydata#3278)
  Updater to testing environment name (pydata#3253)
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.

Add head(), tail() and thin() methods?
4 participants