Skip to content

Commit

Permalink
DEPR: deprecate pandas.ols, #6077
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Dec 26, 2015
1 parent 4378153 commit 47dd9e7
Show file tree
Hide file tree
Showing 7 changed files with 137 additions and 64 deletions.
6 changes: 2 additions & 4 deletions doc/source/whatsnew/v0.18.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ Deprecations
For example, instead of ``s.rolling(window=5,freq='D').max()`` to get the max value on a rolling 5 Day window, one could use ``s.resample('D',how='max').rolling(window=5).max()``, which first resamples the data to daily data, then provides a rolling 5 day window.

- ``pd.tseries.frequencies.get_offset_name`` function is deprecated. Use offset's ``.freqstr`` property as alternative (:issue:`11192`)
- ``pandas.fama_macbeth`` routines are deprecated and will be removed in a future version (:issue:``)
- ``pandas.stats.fama_macbeth`` routines are deprecated and will be removed in a future version (:issue:`6077`)
- ``pandas.stats.ols``, ``pandas.stats.plm`` and ``pandas.stats.var`` routines are deprecated and will be removed in a future version (:issue:`6077`)

.. _whatsnew_0180.prior_deprecations:

Expand Down Expand Up @@ -346,8 +347,5 @@ Bug Fixes
- Bug in ``read_excel`` failing to raise ``NotImplemented`` error when keywords `parse_dates` and `date_parser` are provided (:issue:`11544`)

- Bug in ``read_sql`` with pymysql connections failing to return chunked data (:issue:`11522`)
<<<<<<< f67dd750a67e1e097b58407c755016d3726f21d5

- Bug in ``DataFrame`` when masking an empty ``DataFrame`` (:issue:`11859`)
=======
>>>>>>> DEPR: deprecate pandas.fama_macbeth, #6077
2 changes: 1 addition & 1 deletion pandas/stats/fama_macbeth.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def __init__(self, y, x, intercept=True, nw_lags=None,
import warnings
warnings.warn("The pandas.stats.fama_macbeth module is deprecated and will be "
"removed in a future version. We refer to external packages "
"like statsmodels. ",
"like statsmodels, see here: http://statsmodels.sourceforge.net/stable/index.html",
FutureWarning, stacklevel=4)

if dropped_dummies is None:
Expand Down
6 changes: 6 additions & 0 deletions pandas/stats/ols.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ class OLS(StringMixin):

def __init__(self, y, x, intercept=True, weights=None, nw_lags=None,
nw_overlap=False):
import warnings
warnings.warn("The pandas.stats.ols module is deprecated and will be "
"removed in a future version. We refer to external packages "
"like statsmodels, see some examples here: http://statsmodels.sourceforge.net/stable/regression.html",
FutureWarning, stacklevel=4)

try:
import statsmodels.api as sm
except ImportError:
Expand Down
11 changes: 11 additions & 0 deletions pandas/stats/plm.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def __init__(self, y, x, weights=None, intercept=True, nw_lags=None,
entity_effects=False, time_effects=False, x_effects=None,
cluster=None, dropped_dummies=None, verbose=False,
nw_overlap=False):
import warnings
warnings.warn("The pandas.stats.plm module is deprecated and will be "
"removed in a future version. We refer to external packages "
"like statsmodels, see some examples here: http://statsmodels.sourceforge.net/stable/mixed_linear.html",
FutureWarning, stacklevel=4)
self._x_orig = x
self._y_orig = y
self._weights = weights
Expand Down Expand Up @@ -732,6 +737,12 @@ def __init__(self, y, x, window_type='full_sample', window=None,
min_periods=None, intercept=True, nw_lags=None,
nw_overlap=False):

import warnings
warnings.warn("The pandas.stats.plm module is deprecated and will be "
"removed in a future version. We refer to external packages "
"like statsmodels, see some examples here: http://statsmodels.sourceforge.net/stable/mixed_linear.html",
FutureWarning, stacklevel=4)

for attr in self.ATTRIBUTES:
setattr(self.__class__, attr, create_ols_attr(attr))

Expand Down
3 changes: 2 additions & 1 deletion pandas/stats/tests/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def test_solve_rect(self):

b = Series(np.random.randn(N), self.frame.index)
result = pmath.solve(self.frame, b)
expected = ols(y=b, x=self.frame, intercept=False).beta
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
expected = ols(y=b, x=self.frame, intercept=False).beta
self.assertTrue(np.allclose(result, expected))

def test_inv_illformed(self):
Expand Down
Loading

0 comments on commit 47dd9e7

Please sign in to comment.