home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 431584027

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
431584027 MDU6SXNzdWU0MzE1ODQwMjc= 2884 drop all but specified data_variables/coordinates as a convenience function 14314623 closed 0     5 2019-04-10T15:57:03Z 2019-04-16T12:44:13Z 2019-04-16T12:44:13Z CONTRIBUTOR      

I often work with datasets that consist out of a lot of data_variables and coordinates. Often I am only concerned about a subset of variables, and for convenience drop all but a selected list of variables with a little snippet like this:

Code Sample, a copy-pastable example if possible

python def xr_keep(obj, varlist): """drop all data_vars exept the ones provided in `varlist` """ obj = obj.copy() drop_vars = [a for a in obj.data_vars if a not in varlist] return obj.drop(drop_vars)

I would love to have this functionality available as a DataArray/Dataset function. It could look something like da_slim = da.drop_all_but(['var1, 'var3']). Would this be of interest to people here? Then I could try to put in a PR.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2884/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 1 row from issues_id in issues_labels
  • 5 rows from issue in issue_comments
Powered by Datasette · Queries took 160.882ms · About: xarray-datasette