Title: Apply dict to map values · Issue #246 · python-graphblas/python-graphblas · GitHub
Open Graph Title: Apply dict to map values · Issue #246 · python-graphblas/python-graphblas
X Title: Apply dict to map values · Issue #246 · python-graphblas/python-graphblas
Description: This is probably a crazy idea (and I don't currently have a use case), but could we make it easy to apply a dict to map values? For example, to make the following easier and more reliable (i.e., not rely on inlining the dict): In [10]: v...
Open Graph Description: This is probably a crazy idea (and I don't currently have a use case), but could we make it easy to apply a dict to map values? For example, to make the following easier and more reliable (i.e., no...
X Description: This is probably a crazy idea (and I don't currently have a use case), but could we make it easy to apply a dict to map values? For example, to make the following easier and more reliable (i.e....
Opengraph URL: https://github.com/python-graphblas/python-graphblas/issues/246
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Apply dict to map values","articleBody":"This is probably a crazy idea (and I don't currently have a use case), but could we make it easy to apply a dict to map values? For example, to make the following easier and more reliable (i.e., not rely on inlining the dict):\r\n```python\r\nIn [10]: v = gb.Vector.from_values(np.arange(5), np.arange(5))\r\n\r\nIn [11]: v\r\nOut[11]:\r\n\"v_2\" nvals size dtype format\r\ngb.Vector 5 5 INT64 full\r\n-------------------------------------\r\nindex 0 1 2 3 4\r\nvalue 0 1 2 3 4\r\n\r\nIn [12]: v.apply(lambda x: {0: 0, 1: 2, 2: 4, 3: 6, 4: 8}[x]).new()\r\nOut[12]:\r\n\"v_4\" nvals size dtype format\r\ngb.Vector 5 5 INT64 full\r\n-------------------------------------\r\nindex 0 1 2 3 4\r\nvalue 0 2 4 6 8\r\n```\r\nThis requires Numba to know the types of the dictionary. Also, I don't know how easy it would be to have a default value. This may require its own method.\r\n\r\nThis is inspired by the Pandas functionality to be able to use `x.map(d)` to apply a dict or Series mapping.","author":{"url":"https://github.com/eriknw","@type":"Person","name":"eriknw"},"datePublished":"2022-05-23T17:34:02.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/246/python-graphblas/issues/246"}
| 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:d6571643-08ec-2f34-3d44-252d8e3e41ba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CBA6:7E226:287661A:36F7536:697366DB |
| html-safe-nonce | 86ad5d5bdbfcf38ae9ebd90f80e1930cb0d1c7a00b2e3dfa264a7465b73dacb3 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkE2OjdFMjI2OjI4NzY2MUE6MzZGNzUzNjo2OTczNjZEQiIsInZpc2l0b3JfaWQiOiIxNjkyMDg5Nzg2NTM1MzgwMTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 504b46907604749fb6f409bce7432f52bdbced00e6c244b6ee091a3abaa9108a |
| hovercard-subject-tag | issue:1245498059 |
| 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/python-graphblas/python-graphblas/246/issue_layout |
| twitter:image | https://opengraph.githubassets.com/72b8f747bead97557afa90c4fdcacba635be335bd864a3836a8d9a955ba3ae2b/python-graphblas/python-graphblas/issues/246 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/72b8f747bead97557afa90c4fdcacba635be335bd864a3836a8d9a955ba3ae2b/python-graphblas/python-graphblas/issues/246 |
| og:image:alt | This is probably a crazy idea (and I don't currently have a use case), but could we make it easy to apply a dict to map values? For example, to make the following easier and more reliable (i.e., no... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eriknw |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4cf879a11b0a28a85543899a36aaee9ec9ca2fb7bedad86c0da5731193c95f01 |
| turbo-cache-control | no-preview |
| go-import | github.com/python-graphblas/python-graphblas git https://github.com/python-graphblas/python-graphblas.git |
| octolytics-dimension-user_id | 103965858 |
| octolytics-dimension-user_login | python-graphblas |
| octolytics-dimension-repository_id | 221014819 |
| octolytics-dimension-repository_nwo | python-graphblas/python-graphblas |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 221014819 |
| octolytics-dimension-repository_network_root_nwo | python-graphblas/python-graphblas |
| 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 | fe8be790582ef7a55477ce1918ac0ed16b106d31 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width