Skip to content

Commit d9e00d2

Browse files
authored
DEPR: deprecate pd.get_store as not api consistent and cluttering (#15940)
1 parent f478e4f commit d9e00d2

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

doc/source/whatsnew/v0.20.0.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -981,13 +981,14 @@ Deprecations
981981
- importing ``concat`` from ``pandas.tools.merge`` has been deprecated in favor of imports from the ``pandas`` namespace. This should only affect explict imports (:issue:`15358`)
982982
- ``Series/DataFrame/Panel.consolidate()`` been deprecated as a public method. (:issue:`15483`)
983983
- The ``as_indexer`` keyword of ``Series.str.match()`` has been deprecated (ignored keyword) (:issue:`15257`).
984-
- The following top-level pandas functions have been deprecated and will be removed in a future version (:issue:`13790`)
984+
- The following top-level pandas functions have been deprecated and will be removed in a future version (:issue:`13790`, :issue:`15940`)
985985

986986
* ``pd.pnow()``, replaced by ``Period.now()``
987987
* ``pd.Term``, is removed, as it is not applicable to user code. Instead use in-line string expressions in the where clause when searching in HDFStore
988988
* ``pd.Expr``, is removed, as it is not applicable to user code.
989989
* ``pd.match()``, is removed.
990990
* ``pd.groupby()``, replaced by using the ``.groupby()`` method directly on a ``Series/DataFrame``
991+
* ``pd.get_store()``, replaced by a direct call to ``pd.HDFStore(...)``
991992

992993
.. _whatsnew_0200.prior_deprecations:
993994

pandas/io/pytables.py

+7
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,13 @@ def _read_group(self, group, **kwargs):
13231323
def get_store(path, **kwargs):
13241324
""" Backwards compatible alias for ``HDFStore``
13251325
"""
1326+
warnings.warn(
1327+
"get_store is deprecated and be "
1328+
"removed in a future version\n"
1329+
"HDFStore(path, **kwargs) is the replacement",
1330+
FutureWarning,
1331+
stacklevel=6)
1332+
13261333
return HDFStore(path, **kwargs)
13271334

13281335

pandas/tests/api/test_api.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from warnings import catch_warnings
44

5+
import pytest
56
import pandas as pd
67
from pandas import api
78
from pandas.util import testing as tm
@@ -63,7 +64,7 @@ class TestPDApi(Base, tm.TestCase):
6364
# top-level functions
6465
funcs = ['bdate_range', 'concat', 'crosstab', 'cut',
6566
'date_range', 'eval',
66-
'factorize', 'get_dummies', 'get_store',
67+
'factorize', 'get_dummies',
6768
'infer_freq', 'isnull', 'lreshape',
6869
'melt', 'notnull', 'offsets',
6970
'merge', 'merge_ordered', 'merge_asof',
@@ -102,7 +103,7 @@ class TestPDApi(Base, tm.TestCase):
102103
'rolling_median', 'rolling_min', 'rolling_quantile',
103104
'rolling_skew', 'rolling_std', 'rolling_sum',
104105
'rolling_var', 'rolling_window', 'ordered_merge',
105-
'pnow', 'match', 'groupby']
106+
'pnow', 'match', 'groupby', 'get_store']
106107

107108
def test_api(self):
108109

@@ -140,6 +141,7 @@ def test_deprecation_access_obj(self):
140141

141142

142143
class TestTopLevelDeprecations(tm.TestCase):
144+
143145
# top-level API deprecations
144146
# GH 13790
145147

@@ -168,6 +170,16 @@ def test_groupby(self):
168170
check_stacklevel=False):
169171
pd.groupby(pd.Series([1, 2, 3]), [1, 1, 1])
170172

173+
# GH 15940
174+
175+
def test_get_store(self):
176+
pytest.importorskip('tables')
177+
with tm.ensure_clean() as path:
178+
with tm.assert_produces_warning(FutureWarning,
179+
check_stacklevel=False):
180+
s = pd.get_store(path)
181+
s.close()
182+
171183

172184
class TestJson(tm.TestCase):
173185

0 commit comments

Comments
 (0)