5858
5959
6060class _Window (PandasObject , SelectionMixin ):
61- _attributes = ['window' , 'min_periods' , 'freq' , ' center' , 'win_type' ,
61+ _attributes = ['window' , 'min_periods' , 'center' , 'win_type' ,
6262 'axis' , 'on' , 'closed' ]
6363 exclusions = set ()
6464
65- def __init__ (self , obj , window = None , min_periods = None , freq = None ,
65+ def __init__ (self , obj , window = None , min_periods = None ,
6666 center = False , win_type = None , axis = 0 , on = None , closed = None ,
6767 ** kwargs ):
6868
69- if freq is not None :
70- warnings .warn ("The freq kw is deprecated and will be removed in a "
71- "future version. You can resample prior to passing "
72- "to a window function" , FutureWarning , stacklevel = 3 )
73-
7469 self .__dict__ .update (kwargs )
7570 self .blocks = []
7671 self .obj = obj
7772 self .on = on
7873 self .closed = closed
7974 self .window = window
8075 self .min_periods = min_periods
81- self .freq = freq
8276 self .center = center
8377 self .win_type = win_type
8478 self .win_freq = None
@@ -117,16 +111,6 @@ def _convert_freq(self, how=None):
117111
118112 obj = self ._selected_obj
119113 index = None
120- if (self .freq is not None and
121- isinstance (obj , (ABCSeries , ABCDataFrame ))):
122- if how is not None :
123- warnings .warn ("The how kw argument is deprecated and removed "
124- "in a future version. You can resample prior "
125- "to passing to a window function" , FutureWarning ,
126- stacklevel = 6 )
127-
128- obj = obj .resample (self .freq ).aggregate (how or 'asfreq' )
129-
130114 return obj , index
131115
132116 def _create_blocks (self , how ):
@@ -374,14 +358,11 @@ class Window(_Window):
374358 Minimum number of observations in window required to have a value
375359 (otherwise result is NA). For a window that is specified by an offset,
376360 this will default to 1.
377- freq : string or DateOffset object, optional (default None)
378- .. deprecated:: 0.18.0
379- Frequency to conform the data to before computing the statistic.
380- Specified as a frequency string or DateOffset object.
381361 center : boolean, default False
382362 Set the labels at the center of the window.
383363 win_type : string, default None
384- Provide a window type. See the notes below.
364+ Provide a window type. If ``None``, all points are evenly weighted.
365+ See the notes below for further information.
385366 on : string, optional
386367 For a DataFrame, column on which to calculate
387368 the rolling window, rather than the index
@@ -479,10 +460,6 @@ class Window(_Window):
479460 By default, the result is set to the right edge of the window. This can be
480461 changed to the center of the window by setting ``center=True``.
481462
482- The `freq` keyword is used to conform time series data to a specified
483- frequency by resampling the data. This is done with the default parameters
484- of :meth:`~pandas.Series.resample` (i.e. using the `mean`).
485-
486463 To learn more about the offsets & frequency strings, please see `this link
487464 <http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases>`__.
488465
@@ -876,8 +853,6 @@ def sum(self, *args, **kwargs):
876853
877854 def max (self , how = None , * args , ** kwargs ):
878855 nv .validate_window_func ('max' , args , kwargs )
879- if self .freq is not None and how is None :
880- how = 'max'
881856 return self ._apply ('roll_max' , 'max' , how = how , ** kwargs )
882857
883858 _shared_docs ['min' ] = dedent ("""
@@ -891,8 +866,6 @@ def max(self, how=None, *args, **kwargs):
891866
892867 def min (self , how = None , * args , ** kwargs ):
893868 nv .validate_window_func ('min' , args , kwargs )
894- if self .freq is not None and how is None :
895- how = 'min'
896869 return self ._apply ('roll_min' , 'min' , how = how , ** kwargs )
897870
898871 def mean (self , * args , ** kwargs ):
@@ -909,8 +882,6 @@ def mean(self, *args, **kwargs):
909882 Method for down- or re-sampling""" )
910883
911884 def median (self , how = None , ** kwargs ):
912- if self .freq is not None and how is None :
913- how = 'median'
914885 return self ._apply ('roll_median_c' , 'median' , how = how , ** kwargs )
915886
916887 _shared_docs ['std' ] = dedent ("""
@@ -1060,9 +1031,9 @@ def corr(self, other=None, pairwise=None, **kwargs):
10601031
10611032 def _get_corr (a , b ):
10621033 a = a .rolling (window = window , min_periods = self .min_periods ,
1063- freq = self . freq , center = self .center )
1034+ center = self .center )
10641035 b = b .rolling (window = window , min_periods = self .min_periods ,
1065- freq = self . freq , center = self .center )
1036+ center = self .center )
10661037
10671038 return a .cov (b , ** kwargs ) / (a .std (** kwargs ) * b .std (** kwargs ))
10681039
@@ -1136,7 +1107,7 @@ def _validate_monotonic(self):
11361107 "monotonic" .format (formatted ))
11371108
11381109 def _validate_freq (self ):
1139- """ validate & return our freq """
1110+ """ validate & return window frequency """
11401111 from pandas .tseries .frequencies import to_offset
11411112 try :
11421113 return to_offset (self .window )
@@ -1346,10 +1317,6 @@ class Expanding(_Rolling_and_Expanding):
13461317 min_periods : int, default None
13471318 Minimum number of observations in window required to have a value
13481319 (otherwise result is NA).
1349- freq : string or DateOffset object, optional (default None)
1350- .. deprecated:: 0.18.0
1351- Frequency to conform the data to before computing the statistic.
1352- Specified as a frequency string or DateOffset object.
13531320 center : boolean, default False
13541321 Set the labels at the center of the window.
13551322 axis : int or string, default 0
@@ -1381,18 +1348,14 @@ class Expanding(_Rolling_and_Expanding):
13811348 -----
13821349 By default, the result is set to the right edge of the window. This can be
13831350 changed to the center of the window by setting ``center=True``.
1384-
1385- The `freq` keyword is used to conform time series data to a specified
1386- frequency by resampling the data. This is done with the default parameters
1387- of :meth:`~pandas.Series.resample` (i.e. using the `mean`).
13881351 """
13891352
1390- _attributes = ['min_periods' , 'freq' , ' center' , 'axis' ]
1353+ _attributes = ['min_periods' , 'center' , 'axis' ]
13911354
1392- def __init__ (self , obj , min_periods = 1 , freq = None , center = False , axis = 0 ,
1355+ def __init__ (self , obj , min_periods = 1 , center = False , axis = 0 ,
13931356 ** kwargs ):
13941357 super (Expanding , self ).__init__ (obj = obj , min_periods = min_periods ,
1395- freq = freq , center = center , axis = axis )
1358+ center = center , axis = axis )
13961359
13971360 @property
13981361 def _constructor (self ):
@@ -1611,9 +1574,6 @@ class EWM(_Rolling):
16111574 min_periods : int, default 0
16121575 Minimum number of observations in window required to have a value
16131576 (otherwise result is NA).
1614- freq : None or string alias / date offset object, default=None
1615- .. deprecated:: 0.18.0
1616- Frequency to conform to before computing statistic
16171577 adjust : boolean, default True
16181578 Divide by decaying adjustment factor in beginning periods to account
16191579 for imbalance in relative weightings (viewing EWMA as a moving average)
@@ -1651,10 +1611,6 @@ class EWM(_Rolling):
16511611 parameter descriptions above; see the link at the end of this section for
16521612 a detailed explanation.
16531613
1654- The `freq` keyword is used to conform time series data to a specified
1655- frequency by resampling the data. This is done with the default parameters
1656- of :meth:`~pandas.Series.resample` (i.e. using the `mean`).
1657-
16581614 When adjust is True (default), weighted averages are calculated using
16591615 weights (1-alpha)**(n-1), (1-alpha)**(n-2), ..., 1-alpha, 1.
16601616
@@ -1675,15 +1631,14 @@ class EWM(_Rolling):
16751631 More details can be found at
16761632 http://pandas.pydata.org/pandas-docs/stable/computation.html#exponentially-weighted-windows
16771633 """
1678- _attributes = ['com' , 'min_periods' , 'freq' , ' adjust' , 'ignore_na' , 'axis' ]
1634+ _attributes = ['com' , 'min_periods' , 'adjust' , 'ignore_na' , 'axis' ]
16791635
16801636 def __init__ (self , obj , com = None , span = None , halflife = None , alpha = None ,
1681- min_periods = 0 , freq = None , adjust = True , ignore_na = False ,
1637+ min_periods = 0 , adjust = True , ignore_na = False ,
16821638 axis = 0 ):
16831639 self .obj = obj
16841640 self .com = _get_center_of_mass (com , span , halflife , alpha )
16851641 self .min_periods = min_periods
1686- self .freq = freq
16871642 self .adjust = adjust
16881643 self .ignore_na = ignore_na
16891644 self .axis = axis
0 commit comments