Title: reindex on mixed type/object axis fails · Issue #911 · larray-project/larray · GitHub
Open Graph Title: reindex on mixed type/object axis fails · Issue #911 · larray-project/larray
X Title: reindex on mixed type/object axis fails · Issue #911 · larray-project/larray
Description: >>> arr = ndtest(Axis(np.array([0, "a"], dtype=object), "value")) >>> arr.reindex("value", [0, "a", 1]) TypeError: '<' not supported between instances of 'str' and 'int' Note that users usually get a mixed type axis via with_total. I thi...
Open Graph Description: >>> arr = ndtest(Axis(np.array([0, "a"], dtype=object), "value")) >>> arr.reindex("value", [0, "a", 1]) TypeError: '<' not supported between instances of 'str' and 'int' Note that users usually get...
X Description: >>> arr = ndtest(Axis(np.array([0, "a"], dtype=object), "value")) >>> arr.reindex("value", [0, "a", 1]) TypeError: '<' not suppo...
Opengraph URL: https://github.com/larray-project/larray/issues/911
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"reindex on mixed type/object axis fails","articleBody":"```python\r\n>>> arr = ndtest(Axis(np.array([0, \"a\"], dtype=object), \"value\"))\r\n>>> arr.reindex(\"value\", [0, \"a\", 1])\r\nTypeError: '\u003c' not supported between instances of 'str' and 'int'\r\n```\r\nNote that users usually get a mixed type axis via with_total.\r\n\r\nI think the underlying error is that Axis.index does not work for numpy array with mixed dtype\r\n\r\n```python\r\n>>> ax.index(np.array([0, \"a\"]))\r\n--> 895 return array_lookup2(_seq_group_to_name(key), self._sorted_keys, self._sorted_values)\r\nc:\\users\\gdm\\devel\\larray\\larray\\core\\axis.py in _sorted_keys(self)\r\n--> 144 keys, _ = self._update_key_values()\r\nc:\\users\\gdm\\devel\\larray\\larray\\core\\axis.py in _update_key_values(self)\r\n--> 133 sorted_keys, sorted_values = tuple(zip(*sorted(mapping.items())))\r\nTypeError: '\u003c' not supported between instances of 'str' and 'int'\r\n```\r\n\r\nBut we should get rid of these _sorted_keys/_sorted_values anyway (because that's O(N log N) instead of O(N)) so the fix will come for free \"someday\". But we should add a test for this issue nevertheless.","author":{"url":"https://github.com/gdementen","@type":"Person","name":"gdementen"},"datePublished":"2021-01-25T16:44:11Z","url":"https://github.com/larray-project/larray/issues/911"}
| 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:5f09b8a9-d220-5177-e1ac-f88779c51816 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBCC:1E3154:168559:1E24C5:6B001F69 |
| html-safe-nonce | e00ecf376562128da7924d09ba91f559dcfae8223e1ceee57b00126a2f8aad72 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkNDOjFFMzE1NDoxNjg1NTk6MUUyNEM1OjZCMDAxRjY5IiwidmlzaXRvcl9pZCI6IjU4MzE0NTM1MzI1MzU5MjI1MzciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | af3d8421f2339cce233ac01b92e1ff5f4eefa0c2cfdc8a100d960e1ba58d1099 |
| hovercard-subject-tag | issue:793541101 |
| 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/911/issue_layout |
| twitter:image | https://opengraph.githubassets.com/15d5c1537727adbff77b79b1d195d83523b12b5c86a53a56c6f7eb5714cf209e/larray-project/larray/issues/911 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/15d5c1537727adbff77b79b1d195d83523b12b5c86a53a56c6f7eb5714cf209e/larray-project/larray/issues/911 |
| og:image:alt | >>> arr = ndtest(Axis(np.array([0, "a"], dtype=object), "value")) >>> arr.reindex("value", [0, "a", 1]) TypeError: '<' not supported between instances of 'str' and 'int' Note that users usually get... |
| 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