Skip to content

Commit 47dd9e7

Browse files
committed
DEPR: deprecate pandas.ols, #6077
1 parent 4378153 commit 47dd9e7

File tree

7 files changed

+137
-64
lines changed

7 files changed

+137
-64
lines changed

doc/source/whatsnew/v0.18.0.txt

+2-4
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ Deprecations
253253
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.
254254

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

258259
.. _whatsnew_0180.prior_deprecations:
259260

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

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

351351
- Bug in ``DataFrame`` when masking an empty ``DataFrame`` (:issue:`11859`)
352-
=======
353-
>>>>>>> DEPR: deprecate pandas.fama_macbeth, #6077

pandas/stats/fama_macbeth.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self, y, x, intercept=True, nw_lags=None,
3535
import warnings
3636
warnings.warn("The pandas.stats.fama_macbeth module is deprecated and will be "
3737
"removed in a future version. We refer to external packages "
38-
"like statsmodels. ",
38+
"like statsmodels, see here: http://statsmodels.sourceforge.net/stable/index.html",
3939
FutureWarning, stacklevel=4)
4040

4141
if dropped_dummies is None:

pandas/stats/ols.py

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ class OLS(StringMixin):
4747

4848
def __init__(self, y, x, intercept=True, weights=None, nw_lags=None,
4949
nw_overlap=False):
50+
import warnings
51+
warnings.warn("The pandas.stats.ols module is deprecated and will be "
52+
"removed in a future version. We refer to external packages "
53+
"like statsmodels, see some examples here: http://statsmodels.sourceforge.net/stable/regression.html",
54+
FutureWarning, stacklevel=4)
55+
5056
try:
5157
import statsmodels.api as sm
5258
except ImportError:

pandas/stats/plm.py

+11
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ def __init__(self, y, x, weights=None, intercept=True, nw_lags=None,
3434
entity_effects=False, time_effects=False, x_effects=None,
3535
cluster=None, dropped_dummies=None, verbose=False,
3636
nw_overlap=False):
37+
import warnings
38+
warnings.warn("The pandas.stats.plm module is deprecated and will be "
39+
"removed in a future version. We refer to external packages "
40+
"like statsmodels, see some examples here: http://statsmodels.sourceforge.net/stable/mixed_linear.html",
41+
FutureWarning, stacklevel=4)
3742
self._x_orig = x
3843
self._y_orig = y
3944
self._weights = weights
@@ -732,6 +737,12 @@ def __init__(self, y, x, window_type='full_sample', window=None,
732737
min_periods=None, intercept=True, nw_lags=None,
733738
nw_overlap=False):
734739

740+
import warnings
741+
warnings.warn("The pandas.stats.plm module is deprecated and will be "
742+
"removed in a future version. We refer to external packages "
743+
"like statsmodels, see some examples here: http://statsmodels.sourceforge.net/stable/mixed_linear.html",
744+
FutureWarning, stacklevel=4)
745+
735746
for attr in self.ATTRIBUTES:
736747
setattr(self.__class__, attr, create_ols_attr(attr))
737748

pandas/stats/tests/test_math.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def test_solve_rect(self):
5252

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

5859
def test_inv_illformed(self):

0 commit comments

Comments
 (0)