58
58
59
59
60
60
class _Window (PandasObject , SelectionMixin ):
61
- _attributes = ['window' , 'min_periods' , 'freq' , ' center' , 'win_type' ,
61
+ _attributes = ['window' , 'min_periods' , 'center' , 'win_type' ,
62
62
'axis' , 'on' , 'closed' ]
63
63
exclusions = set ()
64
64
65
- def __init__ (self , obj , window = None , min_periods = None , freq = None ,
65
+ def __init__ (self , obj , window = None , min_periods = None ,
66
66
center = False , win_type = None , axis = 0 , on = None , closed = None ,
67
67
** kwargs ):
68
68
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
-
74
69
self .__dict__ .update (kwargs )
75
70
self .blocks = []
76
71
self .obj = obj
77
72
self .on = on
78
73
self .closed = closed
79
74
self .window = window
80
75
self .min_periods = min_periods
81
- self .freq = freq
82
76
self .center = center
83
77
self .win_type = win_type
84
78
self .win_freq = None
@@ -117,16 +111,6 @@ def _convert_freq(self, how=None):
117
111
118
112
obj = self ._selected_obj
119
113
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
-
130
114
return obj , index
131
115
132
116
def _create_blocks (self , how ):
@@ -374,14 +358,11 @@ class Window(_Window):
374
358
Minimum number of observations in window required to have a value
375
359
(otherwise result is NA). For a window that is specified by an offset,
376
360
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.
381
361
center : boolean, default False
382
362
Set the labels at the center of the window.
383
363
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.
385
366
on : string, optional
386
367
For a DataFrame, column on which to calculate
387
368
the rolling window, rather than the index
@@ -479,10 +460,6 @@ class Window(_Window):
479
460
By default, the result is set to the right edge of the window. This can be
480
461
changed to the center of the window by setting ``center=True``.
481
462
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
-
486
463
To learn more about the offsets & frequency strings, please see `this link
487
464
<http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases>`__.
488
465
@@ -876,8 +853,6 @@ def sum(self, *args, **kwargs):
876
853
877
854
def max (self , how = None , * args , ** kwargs ):
878
855
nv .validate_window_func ('max' , args , kwargs )
879
- if self .freq is not None and how is None :
880
- how = 'max'
881
856
return self ._apply ('roll_max' , 'max' , how = how , ** kwargs )
882
857
883
858
_shared_docs ['min' ] = dedent ("""
@@ -891,8 +866,6 @@ def max(self, how=None, *args, **kwargs):
891
866
892
867
def min (self , how = None , * args , ** kwargs ):
893
868
nv .validate_window_func ('min' , args , kwargs )
894
- if self .freq is not None and how is None :
895
- how = 'min'
896
869
return self ._apply ('roll_min' , 'min' , how = how , ** kwargs )
897
870
898
871
def mean (self , * args , ** kwargs ):
@@ -909,8 +882,6 @@ def mean(self, *args, **kwargs):
909
882
Method for down- or re-sampling""" )
910
883
911
884
def median (self , how = None , ** kwargs ):
912
- if self .freq is not None and how is None :
913
- how = 'median'
914
885
return self ._apply ('roll_median_c' , 'median' , how = how , ** kwargs )
915
886
916
887
_shared_docs ['std' ] = dedent ("""
@@ -1060,9 +1031,9 @@ def corr(self, other=None, pairwise=None, **kwargs):
1060
1031
1061
1032
def _get_corr (a , b ):
1062
1033
a = a .rolling (window = window , min_periods = self .min_periods ,
1063
- freq = self . freq , center = self .center )
1034
+ center = self .center )
1064
1035
b = b .rolling (window = window , min_periods = self .min_periods ,
1065
- freq = self . freq , center = self .center )
1036
+ center = self .center )
1066
1037
1067
1038
return a .cov (b , ** kwargs ) / (a .std (** kwargs ) * b .std (** kwargs ))
1068
1039
@@ -1136,7 +1107,7 @@ def _validate_monotonic(self):
1136
1107
"monotonic" .format (formatted ))
1137
1108
1138
1109
def _validate_freq (self ):
1139
- """ validate & return our freq """
1110
+ """ validate & return window frequency """
1140
1111
from pandas .tseries .frequencies import to_offset
1141
1112
try :
1142
1113
return to_offset (self .window )
@@ -1346,10 +1317,6 @@ class Expanding(_Rolling_and_Expanding):
1346
1317
min_periods : int, default None
1347
1318
Minimum number of observations in window required to have a value
1348
1319
(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.
1353
1320
center : boolean, default False
1354
1321
Set the labels at the center of the window.
1355
1322
axis : int or string, default 0
@@ -1381,18 +1348,14 @@ class Expanding(_Rolling_and_Expanding):
1381
1348
-----
1382
1349
By default, the result is set to the right edge of the window. This can be
1383
1350
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`).
1388
1351
"""
1389
1352
1390
- _attributes = ['min_periods' , 'freq' , ' center' , 'axis' ]
1353
+ _attributes = ['min_periods' , 'center' , 'axis' ]
1391
1354
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 ,
1393
1356
** kwargs ):
1394
1357
super (Expanding , self ).__init__ (obj = obj , min_periods = min_periods ,
1395
- freq = freq , center = center , axis = axis )
1358
+ center = center , axis = axis )
1396
1359
1397
1360
@property
1398
1361
def _constructor (self ):
@@ -1611,9 +1574,6 @@ class EWM(_Rolling):
1611
1574
min_periods : int, default 0
1612
1575
Minimum number of observations in window required to have a value
1613
1576
(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
1617
1577
adjust : boolean, default True
1618
1578
Divide by decaying adjustment factor in beginning periods to account
1619
1579
for imbalance in relative weightings (viewing EWMA as a moving average)
@@ -1651,10 +1611,6 @@ class EWM(_Rolling):
1651
1611
parameter descriptions above; see the link at the end of this section for
1652
1612
a detailed explanation.
1653
1613
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
-
1658
1614
When adjust is True (default), weighted averages are calculated using
1659
1615
weights (1-alpha)**(n-1), (1-alpha)**(n-2), ..., 1-alpha, 1.
1660
1616
@@ -1675,15 +1631,14 @@ class EWM(_Rolling):
1675
1631
More details can be found at
1676
1632
http://pandas.pydata.org/pandas-docs/stable/computation.html#exponentially-weighted-windows
1677
1633
"""
1678
- _attributes = ['com' , 'min_periods' , 'freq' , ' adjust' , 'ignore_na' , 'axis' ]
1634
+ _attributes = ['com' , 'min_periods' , 'adjust' , 'ignore_na' , 'axis' ]
1679
1635
1680
1636
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 ,
1682
1638
axis = 0 ):
1683
1639
self .obj = obj
1684
1640
self .com = _get_center_of_mass (com , span , halflife , alpha )
1685
1641
self .min_periods = min_periods
1686
- self .freq = freq
1687
1642
self .adjust = adjust
1688
1643
self .ignore_na = ignore_na
1689
1644
self .axis = axis
0 commit comments