home / github / pull_requests

Menu
  • Search all tables
  • GraphQL API

pull_requests: 13095339

This data as json

id node_id number state locked title user body created_at updated_at closed_at merged_at merge_commit_sha assignee milestone draft head base author_association auto_merge repo url merged_by
13095339 MDExOlB1bGxSZXF1ZXN0MTMwOTUzMzk= 33 closed 0 Dataset.__getitem__ returns a DatasetArray linked to the same dataset 1217238 Originally, `Dataset.__getitem__` would "select" out the given variable to use as the dataset for new DatasetArray. The rationale was that you don't really want to keep track of extra dataset variables that are no longer relevant. The problem is that this means that modifying an item from a dataset would not modify the original dataset. An example might make this clearer: ``` >>> ds = xray.Dataset({'x': ('x', np.arange(10))}) >>> ds['x'].attributes['units'] = 'meters' # this was actually a no-op ``` This is clearly a pretty blatant violation of the norms for a Python container, and it certaintly surprised @akleeman. So this PR simplies this behavior so that `ds['x']` gives a DatasetArray linked to the dataset `ds`, and does some related clean-up of `DatasetArray.from_stack`. The new method `DatasetArray.select` lets you reproduce the old behavior if desired, by using `ds['x'].select()` instead of `ds['x']`. A bonus is that the new behavior is actually faster, because it doesn't need to create a new Dataset object. 2014-03-02T20:30:32Z 2014-06-12T17:29:47Z 2014-03-03T05:44:50Z 2014-03-03T05:44:50Z d8d5abc608768d8a329a9d52590c109dd041b2f2     0 46efe3e01e20a3c422ec2160b3a56caed3768208 2f26e859a791dc6eef39414b812580ee8d7f8277 MEMBER   13221727 https://github.com/pydata/xarray/pull/33  

Links from other tables

  • 0 rows from pull_requests_id in labels_pull_requests
Powered by Datasette · Queries took 0.662ms