Title: Group aggregate has wrong (and different than getitem!) behavior for groups from other axes · Issue #1117 · larray-project/larray · GitHub
Open Graph Title: Group aggregate has wrong (and different than getitem!) behavior for groups from other axes · Issue #1117 · larray-project/larray
X Title: Group aggregate has wrong (and different than getitem!) behavior for groups from other axes · Issue #1117 · larray-project/larray
Description: >>> arr = ndtest("a=a0,a2,a1") >>> arr a a0 a2 a1 0 1 2 >>> g = arr.a.i[1] >>> g a.i[1] >>> arr[g] 1 >>> arr.sum(g) 1 Now let us define another array with the same axis name, and reuse the g group: >>> arr2 = ndtest("a=a0..a2") >>> arr2 ...
Open Graph Description: >>> arr = ndtest("a=a0,a2,a1") >>> arr a a0 a2 a1 0 1 2 >>> g = arr.a.i[1] >>> g a.i[1] >>> arr[g] 1 >>> arr.sum(g) 1 Now let us define another array with the same axis name, and reuse the g group:...
X Description: >>> arr = ndtest("a=a0,a2,a1") >>> arr a a0 a2 a1 0 1 2 >>> g = arr.a.i[1] >>> g a.i[1] >>> arr[g] 1 >>> arr.sum(g) 1 Now let us defi...
Opengraph URL: https://github.com/larray-project/larray/issues/1117
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Group aggregate has wrong (and different than getitem!) behavior for groups from other axes","articleBody":"```python\r\n>>> arr = ndtest(\"a=a0,a2,a1\")\r\n>>> arr\r\na a0 a2 a1\r\n 0 1 2\r\n>>> g = arr.a.i[1]\r\n>>> g\r\na.i[1]\r\n>>> arr[g]\r\n1\r\n>>> arr.sum(g)\r\n1\r\n```\r\n\r\nNow let us define another array with the same axis name, and reuse the `g` group:\r\n```python\r\n>>> arr2 = ndtest(\"a=a0..a2\")\r\n>>> arr2\r\na a0 a1 a2\r\n 0 1 2\r\n```\r\n\r\nFor getitem, the group is retargeted to the \"local array\" axis (i.e. arr2.a) by using the _labels_ corresponding to the group on the original axis:\r\n\r\n```python\r\n>>> arr2[g]\r\n2\r\n```\r\n\r\nBut for group aggregates, this is the position, irrespective of the label:\r\n\r\n```python\r\n>>> arr2.sum(g)\r\n1\r\n```\r\n\r\nThis is because of the:\r\n```python\r\naxis_key = axis_key.with_axis(real_axis)\r\n```\r\nline in AxisCollection._guess_axis which should probably use retarget_to instead.","author":{"url":"https://github.com/gdementen","@type":"Person","name":"gdementen"},"datePublished":"2024-10-02T14:19:37Z","url":"https://github.com/larray-project/larray/issues/1117"}
| 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:4159719d-50f6-a8f8-fee5-95e0b8a46cbb |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A386:2E6021:2D1D4C0:3B98CEB:6B001F81 |
| html-safe-nonce | 8f16882bda242eb7da7a3e9aa26f60e16cfe979cb89a975abf88d59f84359af5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMzg2OjJFNjAyMToyRDFENEMwOjNCOThDRUI6NkIwMDFGODEiLCJ2aXNpdG9yX2lkIjoiODQ0MDAzNDY5MDM2MTk5MTA0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6b666eaf05deaa27a28f4246735264d2ff696cdd360d3680024e93c2eedc2704 |
| hovercard-subject-tag | issue:2561820174 |
| 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/1117/issue_layout |
| twitter:image | https://opengraph.githubassets.com/120f6d4ed7d9afa401bbaa639fb6d49f8dc49bde3fe1a387eace9a8f428fcd76/larray-project/larray/issues/1117 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/120f6d4ed7d9afa401bbaa639fb6d49f8dc49bde3fe1a387eace9a8f428fcd76/larray-project/larray/issues/1117 |
| og:image:alt | >>> arr = ndtest("a=a0,a2,a1") >>> arr a a0 a2 a1 0 1 2 >>> g = arr.a.i[1] >>> g a.i[1] >>> arr[g] 1 >>> arr.sum(g) 1 Now let us define another array with the same axis name, and reuse the g group:... |
| 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