home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 155598016

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/648#issuecomment-155598016 https://api.github.com/repos/pydata/xarray/issues/648 155598016 MDEyOklzc3VlQ29tbWVudDE1NTU5ODAxNg== 1217238 2015-11-10T23:12:31Z 2015-11-10T23:19:22Z MEMBER

I realize now that changing the internal representation for DataArray doesn't mean we need to rewrite how every routine works. We can still convert dataarrays to a dataset when convenient -- it just means we'll need to use a method to do so instead of modifying ._dataset. For example, we currently have:

python def copy(self, deep=True): ds = self._dataset.copy(deep=deep) return self._with_replaced_dataset(ds)

and instead we could simply write:

python def copy(self, deep=True): ds = self._to_temp_dataset().copy(deep=deep) return self._new_from_temp_dataset(ds)

However, going forward it will give us more flexibility for how to write DataArray methods. For example, it might actually be clearer to write:

python def copy(self, deep=True): variable = self.variable.copy(deep=deep) coords = OrderedDict((k, v.copy(deep=deep)) for k, v in self._coords.items()) return type(self)(variable, coords, name=name, fastpath=True)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  115805419
Powered by Datasette · Queries took 0.847ms · About: xarray-datasette