Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEPR: deprecate pd.get_store as not api consistent and cluttering #15940

Merged
merged 1 commit into from
Apr 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/source/whatsnew/v0.20.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -913,13 +913,14 @@ Deprecations
- 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`)
- ``Series/DataFrame/Panel.consolidate()`` been deprecated as a public method. (:issue:`15483`)
- The ``as_indexer`` keyword of ``Series.str.match()`` has been deprecated (ignored keyword) (:issue:`15257`).
- The following top-level pandas functions have been deprecated and will be removed in a future version (:issue:`13790`)
- The following top-level pandas functions have been deprecated and will be removed in a future version (:issue:`13790`, :issue:`15940`)

* ``pd.pnow()``, replaced by ``Period.now()``
* ``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
* ``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
16 changes: 14 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 @@ -140,6 +141,7 @@ def test_deprecation_access_obj(self):


class TestTopLevelDeprecations(tm.TestCase):

# top-level API deprecations
# GH 13790

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

# GH 15940

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