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/650#issuecomment-218304910,https://api.github.com/repos/pydata/xarray/issues/650,218304910,MDEyOklzc3VlQ29tbWVudDIxODMwNDkxMA==,10194086,2016-05-10T22:00:35Z,2016-05-10T22:00:35Z,MEMBER,"I could imagine to continue working on this - however, there are some open design questions: - Do we include `skipna`? (I would say yes) - Do we allow the weights to contain NaN? (I would say yes, although disallowing it would make it easier.) - Does `skipna` also apply to the weights or are NaNs always skipped in the weights? (I would suggest the latter.) - Do we need a `skipna_weights` for a fine grained control of this? (This sounds unnecessary) - Do you agree with the above given examples? ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,115933483 https://github.com/pydata/xarray/pull/650#issuecomment-218302130,https://api.github.com/repos/pydata/xarray/issues/650,218302130,MDEyOklzc3VlQ29tbWVudDIxODMwMjEzMA==,10194086,2016-05-10T21:48:02Z,2016-05-10T21:48:02Z,MEMBER,"It seems incorporating this to `mean` may not be very practical and `average` not the cleanest solution. Do you know if a weighted `mean` is planned in `pandas`? Anyway, I have tried to put together some corner cases whre there are NaN in the data or the weights. Unfortunately there is no `np.nanaverage`, so I also compared it to `np.ma.average`. I put together a gist with a lot of examples: https://gist.github.com/mathause/720cbca2d97597a99534581b8ca296a5 The above implementation works fine, however there are currently two cases where I expect another answer: ``` data = [1, np.nan]; weights = [0, 1.] >>> 0. ``` I think this should return NaN. ``` data = [1, 1.]; weights = [np.nan, np.nan] >>> 0 data = [1, 1.]; weights = [np.nan, 0] >>> 0 ``` I think these should also return NaN. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,115933483 https://github.com/pydata/xarray/pull/650#issuecomment-186214729,https://api.github.com/repos/pydata/xarray/issues/650,186214729,MDEyOklzc3VlQ29tbWVudDE4NjIxNDcyOQ==,10194086,2016-02-19T13:34:33Z,2016-02-19T13:34:33Z,MEMBER,"I am fine having it as extra method. I think it is an important feature to have - I use this function every day. ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,115933483 https://github.com/pydata/xarray/pull/650#issuecomment-156154844,https://api.github.com/repos/pydata/xarray/issues/650,156154844,MDEyOklzc3VlQ29tbWVudDE1NjE1NDg0NA==,10194086,2015-11-12T16:24:02Z,2015-11-12T16:24:02Z,MEMBER,"Didn't realize you were working on this. Pulling it into mean is fine for me (if you need the weights it is a one-liner). `average` in numpy seems comparatively complicated - maybe that's why it got it's own function... - average with no valid elements (or 0 weight) seems to return NaN which is fine - maybe you need to add tests when the data contains NaN @jhamman you showed this in a lecture? cool :) ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,115933483