@@ -60,7 +60,6 @@ def test_rolling(self):
60
60
r = g .rolling (window = 4 )
61
61
62
62
for f in ["sum" , "mean" , "min" , "max" , "count" , "kurt" , "skew" ]:
63
-
64
63
result = getattr (r , f )()
65
64
expected = g .apply (lambda x : getattr (x .rolling (4 ), f )())
66
65
tm .assert_frame_equal (result , expected )
@@ -70,8 +69,16 @@ def test_rolling(self):
70
69
expected = g .apply (lambda x : getattr (x .rolling (4 ), f )(ddof = 1 ))
71
70
tm .assert_frame_equal (result , expected )
72
71
73
- result = r .quantile (0.5 )
74
- expected = g .apply (lambda x : x .rolling (4 ).quantile (0.5 ))
72
+ @pytest .mark .parametrize (
73
+ "interpolation" , ["linear" , "lower" , "higher" , "midpoint" , "nearest" ]
74
+ )
75
+ def test_rolling_quantile (self , interpolation ):
76
+ g = self .frame .groupby ("A" )
77
+ r = g .rolling (window = 4 )
78
+ result = r .quantile (0.4 , interpolation = interpolation )
79
+ expected = g .apply (
80
+ lambda x : x .rolling (4 ).quantile (0.4 , interpolation = interpolation )
81
+ )
75
82
tm .assert_frame_equal (result , expected )
76
83
77
84
def test_rolling_corr_cov (self ):
@@ -142,8 +149,16 @@ def test_expanding(self):
142
149
expected = g .apply (lambda x : getattr (x .expanding (), f )(ddof = 0 ))
143
150
tm .assert_frame_equal (result , expected )
144
151
145
- result = r .quantile (0.5 )
146
- expected = g .apply (lambda x : x .expanding ().quantile (0.5 ))
152
+ @pytest .mark .parametrize (
153
+ "interpolation" , ["linear" , "lower" , "higher" , "midpoint" , "nearest" ]
154
+ )
155
+ def test_expanding_quantile (self , interpolation ):
156
+ g = self .frame .groupby ("A" )
157
+ r = g .expanding ()
158
+ result = r .quantile (0.4 , interpolation = interpolation )
159
+ expected = g .apply (
160
+ lambda x : x .expanding ().quantile (0.4 , interpolation = interpolation )
161
+ )
147
162
tm .assert_frame_equal (result , expected )
148
163
149
164
def test_expanding_corr_cov (self ):
0 commit comments