From ee8825d8bcb30f1b953c02cc7737f0247d446c9a Mon Sep 17 00:00:00 2001 From: Andrew Spott Date: Tue, 19 Jun 2018 08:48:30 -0600 Subject: [PATCH 1/2] Fixed HDFSTore.groups() performance. No longer walks every node, but rather every group. --- pandas/io/pytables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index aa39e341792c7..aad387e0cdd58 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -1098,7 +1098,7 @@ def groups(self): _tables() self._check_if_open() return [ - g for g in self._handle.walk_nodes() + g for g in self._handle.walk_groups() if (not isinstance(g, _table_mod.link.Link) and (getattr(g._v_attrs, 'pandas_type', None) or getattr(g, 'table', None) or From 38b70fcff4a27f91d20e61717028c236f23eaf43 Mon Sep 17 00:00:00 2001 From: Andrew Spott Date: Tue, 19 Jun 2018 14:33:47 -0600 Subject: [PATCH 2/2] added whatsnew --- doc/source/whatsnew/v0.23.2.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/source/whatsnew/v0.23.2.txt b/doc/source/whatsnew/v0.23.2.txt index 79a4c3da2ffa4..9d6a326669c32 100644 --- a/doc/source/whatsnew/v0.23.2.txt +++ b/doc/source/whatsnew/v0.23.2.txt @@ -27,7 +27,9 @@ Performance Improvements - Improved performance of membership checks in :class:`CategoricalIndex` (i.e. ``x in ci``-style checks are much faster). :meth:`CategoricalIndex.contains` is likewise much faster (:issue:`21369`) -- +- Improved performance of :meth:`HDFStore.groups` (and dependent functions like + :meth:`~HDFStore.keys`. (i.e. ``x in store`` checks are much faster) + (:issue:`21372`) Documentation Changes ~~~~~~~~~~~~~~~~~~~~~