Title: implement weighted aggregate operations · Issue #159 · larray-project/larray · GitHub
Open Graph Title: implement weighted aggregate operations · Issue #159 · larray-project/larray
X Title: implement weighted aggregate operations · Issue #159 · larray-project/larray
Description: here is crude code I wrote for mean for my own uses: The interesting part is that it allows weights to have more dimensions that the original array, which is sometimes useful. def mean(self, *args, **kwargs): keepaxes = kwargs.pop('keepa...
Open Graph Description: here is crude code I wrote for mean for my own uses: The interesting part is that it allows weights to have more dimensions that the original array, which is sometimes useful. def mean(self, *args,...
X Description: here is crude code I wrote for mean for my own uses: The interesting part is that it allows weights to have more dimensions that the original array, which is sometimes useful. def mean(self, *args,...
Opengraph URL: https://github.com/larray-project/larray/issues/159
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"implement weighted aggregate operations","articleBody":"here is crude code I wrote for mean for my own uses:\r\n\r\nThe interesting part is that it allows weights to have more dimensions that the original array, which is sometimes useful.\r\n\r\n```python\r\n def mean(self, *args, **kwargs):\r\n keepaxes = kwargs.pop('keepaxes', False)\r\n skipna = kwargs.pop('skipna', None)\r\n weights = kwargs.pop('weights', None)\r\n if skipna is None:\r\n skipna = True\r\n if weights is None:\r\n func = np.nanmean if skipna else np.mean\r\n return self._aggregate(func, args, kwargs, keepaxes=keepaxes,\r\n commutative=True)\r\n else:\r\n func = np.nansum if skipna else np.sum\r\n if np.isscalar(weights):\r\n # assume weights is a label along an axis\r\n weights = self[weights]\r\n wsum = (self * weights)._aggregate(func, args, kwargs, keepaxes=keepaxes, commutative=True)\r\n expanded_weights = weights.expand(self.axes)\r\n num = expanded_weights._aggregate(func, args, kwargs, keepaxes=keepaxes, commutative=True)\r\n return wsum / num\r\n```","author":{"url":"https://github.com/gdementen","@type":"Person","name":"gdementen"},"datePublished":"2017-03-16T11:13:06Z","url":"https://github.com/larray-project/larray/issues/159"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cc80eb45-4c41-ce04-776e-0086f66d5985 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9580:2463C6:11807F:179568:6B001E3B |
| html-safe-nonce | c68a54da1c007df9ccf5fbeed9fba74e68ea450cb060017a8477f7a6aa6325ee |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NTgwOjI0NjNDNjoxMTgwN0Y6MTc5NTY4OjZCMDAxRTNCIiwidmlzaXRvcl9pZCI6IjM0NDk0Mzk0MDI4ODE3MTk4NjciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | bf9c6e7129b574ff622fcb44bf4e10f9f7e900937c7dce37f64a09bea9c26685 |
| hovercard-subject-tag | issue:214670480 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/larray-project/larray/159/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ea73c778d984c7df7edc9a1332116cc84b2116e1977f2975b2a6ac6f616f526d/larray-project/larray/issues/159 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ea73c778d984c7df7edc9a1332116cc84b2116e1977f2975b2a6ac6f616f526d/larray-project/larray/issues/159 |
| og:image:alt | here is crude code I wrote for mean for my own uses: The interesting part is that it allows weights to have more dimensions that the original array, which is sometimes useful. def mean(self, *args,... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gdementen |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/larray-project/larray git https://github.com/larray-project/larray.git |
| octolytics-dimension-user_id | 26460981 |
| octolytics-dimension-user_login | larray-project |
| octolytics-dimension-repository_id | 16981067 |
| octolytics-dimension-repository_nwo | larray-project/larray |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 16981067 |
| octolytics-dimension-repository_network_root_nwo | larray-project/larray |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width