home / github / pull_requests

Menu
  • GraphQL API
  • Search all tables

pull_requests: 273971942

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
273971942 MDExOlB1bGxSZXF1ZXN0MjczOTcxOTQy 2922 closed 0 Feature/weighted 10194086 - [X] Closes #422 - [X] Tests added - [X] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API I took a shot at the weighted function - I added a `DataArrayWeighted` class, that currently only implements `mean`. So, there is still quite a bit missing (e.g. `DatasetWeighted`), but let me know what you think. ``` python import numpy as np import xarray as xr da = xr.DataArray([1, 2]) weights = xr.DataArray([4, 6]) da.weighted(weights).mean() # <xarray.DataArray ()> # array(1.6) ``` There are quite a number of difficult edge cases with invalid data, that can be discussed. * I decided to replace all `NaN` in the `weights` with `0`. * if weights sum to `0` it returns `NaN` (and not `inf`) ``` python weights = xr.DataArray([0, 0]) da.weighted(weights).mean() ``` * The following returns `NaN` (could be `1`) ``` python da = xr.DataArray([1, np.nan]) weights = xr.DataArray([1, 0]) da.weighted(weights).mean(skipna=False) ``` It could be good to add all edge-case logic to a separate function but I am not sure if this is possible... 2019-04-26T17:09:02Z 2021-02-03T14:47:52Z 2020-03-19T14:29:43Z 2020-03-19T14:29:42Z df614b96082b38966a329b115082cd8dddf9fb29     0 8acc78ef91ec2e808eac852a526dd90fe859f39b 65a5bff79479c4b56d6f733236fe544b7f4120a8 MEMBER   13221727 https://github.com/pydata/xarray/pull/2922  

Links from other tables

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