Title: read_hdf is much slower than it should be · Issue #563 · larray-project/larray · GitHub
Open Graph Title: read_hdf is much slower than it should be · Issue #563 · larray-project/larray
X Title: read_hdf is much slower than it should be · Issue #563 · larray-project/larray
Description: >>> from larray_eurostat import * >>> arr = eurostat_get('migr_pop3ctb') >>> arr.to_hdf('test_arr.h5', 'arr') >>> import pandas as pd >>> %timeit pd.read_hdf('test_arr.h5', 'arr') 114 ms ± 8.29 ms per loop (mean ± std. dev. of 7 runs, 10...
Open Graph Description: >>> from larray_eurostat import * >>> arr = eurostat_get('migr_pop3ctb') >>> arr.to_hdf('test_arr.h5', 'arr') >>> import pandas as pd >>> %timeit pd.read_hdf('test_arr.h5', 'arr') 114 ms ± 8.29 ms ...
X Description: >>> from larray_eurostat import * >>> arr = eurostat_get('migr_pop3ctb') >>> arr.to_hdf('test_arr.h5', 'arr') >>> import pandas as pd >...
Opengraph URL: https://github.com/larray-project/larray/issues/563
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"read_hdf is much slower than it should be","articleBody":"```python\r\n>>> from larray_eurostat import *\r\n>>> arr = eurostat_get('migr_pop3ctb')\r\n>>> arr.to_hdf('test_arr.h5', 'arr')\r\n>>> import pandas as pd\r\n>>> %timeit pd.read_hdf('test_arr.h5', 'arr')\r\n114 ms ± 8.29 ms per loop (mean ± std. dev. of 7 runs, 10 loops each)\r\n>>> %timeit read_hdf('test_arr.h5', 'arr')\r\n1.24 s ± 35.4 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\r\n```\r\nThe problem is mostly in inout.array.cartesian_product_df which is very expensive while it should do nothing for .h5 arrays saved from an LArray (it was already \"densified\").\r\n\r\n```python\r\n>>> from larray.inout.array import cartesian_product_df\r\n>>> df = pd.read_hdf('test_arr.h5', 'arr')\r\n>>> %timeit cartesian_product_df(df)\r\n968 ms ± 20.2 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\r\n\r\n>>> from larray.inout.array import df_labels\r\n>>> %timeit labels = df_labels(df, False)\r\n288 ms ± 3.85 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\r\n>>> labels = df_labels(df, False)\r\n>>> from itertools import product\r\n>>> %timeit new_index = pd.MultiIndex.from_tuples(list(product(*labels)))\r\n440 ms ± 3.83 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)\r\n>>> new_index = pd.MultiIndex.from_tuples(list(product(*labels)))\r\n>>> columns = list(df.columns)\r\n>>> %timeit np.array_equal(df.index.values, new_index.values)\r\n23.3 ms ± 638 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)\r\n```\r\nI think I had already fixed this (or at least partially) in the very old pandasbased3 branch.","author":{"url":"https://github.com/gdementen","@type":"Person","name":"gdementen"},"datePublished":"2018-01-03T12:01:48Z","url":"https://github.com/larray-project/larray/issues/563"}
| 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:7f21d975-c0c1-4546-6238-6e9531701113 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B2E2:3CBF1A:1F7E4E1:2B19214:6B0023B6 |
| html-safe-nonce | 7baf513e722387772028745d324c7864284774376bcabd49fd8b634bf266e9ed |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMkUyOjNDQkYxQToxRjdFNEUxOjJCMTkyMTQ6NkIwMDIzQjYiLCJ2aXNpdG9yX2lkIjoiNzg3MzYyNjQxNjM4OTAzOTAzMCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 420b87e98bee901a526df32c054c4aca1c42453cec25e289ac05fd3c8b7e787d |
| hovercard-subject-tag | issue:285667996 |
| 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/563/issue_layout |
| twitter:image | https://opengraph.githubassets.com/97167aae8f8e881f06dfd9bd847fcb1e1236dd23cfa84b534da6a3e6e2840879/larray-project/larray/issues/563 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/97167aae8f8e881f06dfd9bd847fcb1e1236dd23cfa84b534da6a3e6e2840879/larray-project/larray/issues/563 |
| og:image:alt | >>> from larray_eurostat import * >>> arr = eurostat_get('migr_pop3ctb') >>> arr.to_hdf('test_arr.h5', 'arr') >>> import pandas as pd >>> %timeit pd.read_hdf('test_arr.h5', 'arr') 114 ms ± 8.29 ms ... |
| 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