Title: string labels dumped to Excel should be formatted as strings · Issue #646 · larray-project/larray · GitHub
Open Graph Title: string labels dumped to Excel should be formatted as strings · Issue #646 · larray-project/larray
X Title: string labels dumped to Excel should be formatted as strings · Issue #646 · larray-project/larray
Description: >>> arr = ndtest('a=10E01,10E03') >>> arr.to_excel() produces something like: a | 1.00E+02 | 1.00E+04 | 0 | 1 This is not a visual transformation, it actually converts the values to numbers (whatever the actual dtype of labels were -- .d...
Open Graph Description: >>> arr = ndtest('a=10E01,10E03') >>> arr.to_excel() produces something like: a | 1.00E+02 | 1.00E+04 | 0 | 1 This is not a visual transformation, it actually converts the values to numbers (whatev...
X Description: >>> arr = ndtest('a=10E01,10E03') >>> arr.to_excel() produces something like: a | 1.00E+02 | 1.00E+04 | 0 | 1 This is not a visual transformation, it actually converts the...
Opengraph URL: https://github.com/larray-project/larray/issues/646
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"string labels dumped to Excel should be formatted as strings","articleBody":"```python\r\n>>> arr = ndtest('a=10E01,10E03')\r\n>>> arr.to_excel()\r\n```\r\nproduces something like:\r\n```\r\n a | 1.00E+02 | 1.00E+04\r\n | 0 | 1\r\n```\r\nThis is not a visual transformation, it actually converts the values to numbers (whatever the actual dtype of labels were -- .dump() converts numpy types to raw Python types anyway)\r\n```python\r\n>>> arr.a.labels.dtype\r\ndtype('\u003cU5')\r\n>>> arr.dump()\r\n[['a', '10E01', '10E03'], ['', 0, 1]]\r\n```\r\nThe solution is to set NumberFormat on the target cells ***before*** pasting the values (https://github.com/ZoomerAnalytics/xlwings/issues/436).\r\n\r\n```python\r\n>>> wb = open_excel()\r\n>>> # produces bad result\r\n>>> wb[0]['A1'] = '10E03'\r\n>>> # produces good result\r\n>>> wb[0]['A2'].api.NumberFormat = \"@\"\r\n>>> wb[0]['A2'] = '10E03'\r\n```\r\n\r\nNote that set_labels (currently) returns object arrays. This should be irrelevant when we go via .dump(), which is always the case, I think (when using `wb[0] = array`, .dump() is called automatically).\r\n\r\n```python\r\n>>> ndtest(3).set_labels('a', {'a1': '10E03'}).a.labels.dtype\r\ndtype('O')\r\n```\r\n\r\nIdeally, this should be fixed in xlwings.\r\n\r\nHonestly, this issue seems easy to fix for small arrays (by scanning through each value and setting the format accordingly) but hard to do efficiently (set the format in chunks). Maybe .dump should not return a simple list of list but a custom object which retains the notion of axes etc. so that we can set the format for each axis in a single operation?","author":{"url":"https://github.com/gdementen","@type":"Person","name":"gdementen"},"datePublished":"2018-06-11T14:09:17Z","url":"https://github.com/larray-project/larray/issues/646"}
| 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:20f556d2-a4b2-39ca-7242-54addb627e92 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AA3A:245A38:222B4A:2E78EA:6B00233F |
| html-safe-nonce | 4ad7496e5e2ed90f1c3db68a651fddca1ea8e3dc7e86c345127b4d40e4a23bc1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBQTNBOjI0NUEzODoyMjJCNEE6MkU3OEVBOjZCMDAyMzNGIiwidmlzaXRvcl9pZCI6IjY1NzA5ODQzMDA3MzU0NTUzNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 7c3cdf82245b1de55c8ba5bc657317a8c9f6f27a7075fff138ad280164f1c4b9 |
| hovercard-subject-tag | issue:331205445 |
| 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/646/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ecb7e1d220dbb6c26824f7bacd73be7b8f5fd1949c3b0f1be275902bf48efffe/larray-project/larray/issues/646 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ecb7e1d220dbb6c26824f7bacd73be7b8f5fd1949c3b0f1be275902bf48efffe/larray-project/larray/issues/646 |
| og:image:alt | >>> arr = ndtest('a=10E01,10E03') >>> arr.to_excel() produces something like: a | 1.00E+02 | 1.00E+04 | 0 | 1 This is not a visual transformation, it actually converts the values to numbers (whatev... |
| 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