Skip to content

Commit

Permalink
DEPR: deprecate pd.get_store as not api consistent and cluttering
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Apr 7, 2017
1 parent 3b53202 commit d74b306
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,7 @@ Deprecations
* ``pd.Expr``, is removed, as it is not applicable to user code.
* ``pd.match()``, is removed.
* ``pd.groupby()``, replaced by using the ``.groupby()`` method directly on a ``Series/DataFrame``
* ``pd.get_store()``, replaced by a direct call to ``pd.HDFStore(...)``

.. _whatsnew_0200.prior_deprecations:

Expand Down
7 changes: 7 additions & 0 deletions pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,13 @@ def _read_group(self, group, **kwargs):
def get_store(path, **kwargs):
""" Backwards compatible alias for ``HDFStore``
"""
warnings.warn(
"get_store is deprecated and be "
"removed in a future version\n"
"HDFStore(path, **kwargs) is the replacement",
FutureWarning,
stacklevel=6)

return HDFStore(path, **kwargs)


Expand Down
13 changes: 11 additions & 2 deletions pandas/tests/api/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from warnings import catch_warnings

import pytest
import pandas as pd
from pandas import api
from pandas.util import testing as tm
Expand Down Expand Up @@ -63,7 +64,7 @@ class TestPDApi(Base, tm.TestCase):
# top-level functions
funcs = ['bdate_range', 'concat', 'crosstab', 'cut',
'date_range', 'eval',
'factorize', 'get_dummies', 'get_store',
'factorize', 'get_dummies',
'infer_freq', 'isnull', 'lreshape',
'melt', 'notnull', 'offsets',
'merge', 'merge_ordered', 'merge_asof',
Expand Down Expand Up @@ -102,7 +103,7 @@ class TestPDApi(Base, tm.TestCase):
'rolling_median', 'rolling_min', 'rolling_quantile',
'rolling_skew', 'rolling_std', 'rolling_sum',
'rolling_var', 'rolling_window', 'ordered_merge',
'pnow', 'match', 'groupby']
'pnow', 'match', 'groupby', 'get_store']

def test_api(self):

Expand Down Expand Up @@ -168,6 +169,14 @@ def test_groupby(self):
check_stacklevel=False):
pd.groupby(pd.Series([1, 2, 3]), [1, 1, 1])

def test_get_store(self):
pytest.importorskip('tables')
with tm.ensure_clean() as path:
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
s = pd.get_store(path)
s.close()


class TestJson(tm.TestCase):

Expand Down

0 comments on commit d74b306

Please sign in to comment.