home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 539174999

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/issues/3268#issuecomment-539174999 https://api.github.com/repos/pydata/xarray/issues/3268 539174999 MDEyOklzc3VlQ29tbWVudDUzOTE3NDk5OQ== 1956032 2019-10-07T19:49:41Z 2019-10-07T19:49:41Z CONTRIBUTOR

@crusaderky thanks for the explanation, that's a solution to my pb.

Although I understand that since accessor will be created from scratch, a dataset copy won't propagate the accessor properties (in this case the list of added variables):

```python ds = xarray.Dataset() ds['ext_data'] = xarray.DataArray(1.)

my_estimator = BaseEstimator() # With "clean" method from @crusaderky ds.my_accessor.fit(my_estimator, x=2.) ds.my_accessor.transform(my_estimator, y=3.)

ds2 = ds.copy()

ds = ds.my_accessor.clean() ds2 = ds2.my_accessor.clean()

print(ds.data_vars) print(ds2.data_vars) gives:python Data variables: ext_data float64 1.0 Data variables: ext_data float64 1.0 fit_data float64 4.0 trf_data float64 7.0 ``` "Cleaning" the dataset works as expected, but the copy (ds2) has en empty list of added variables so the "clean" method doesn't have the expected result. We have the same behavior for deep copy.

Would that make any sense that the xr.DataSet.copy() method also return a copy of the accessors ?

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