@@ -122,36 +122,31 @@ def test_pct_change_shift_over_nas(self):
122
122
edf = DataFrame ({'a' : expected , 'b' : expected })
123
123
assert_frame_equal (chg , edf )
124
124
125
- def test_pct_change_periods_freq (self ):
125
+ @pytest .mark .parametrize ("freq, periods, fill_method, limit" ,
126
+ [('5B' , 5 , None , None ),
127
+ ('3B' , 3 , None , None ),
128
+ ('3B' , 3 , 'bfill' , None ),
129
+ ('7B' , 7 , 'pad' , 1 ),
130
+ ('7B' , 7 , 'bfill' , 3 ),
131
+ ('14B' , 14 , None , None )])
132
+ def test_pct_change_periods_freq (self , freq , periods , fill_method , limit ):
126
133
# GH 7292
127
- rs_freq = self .tsframe .pct_change (freq = '5B' )
128
- rs_periods = self .tsframe .pct_change (5 )
129
- assert_frame_equal (rs_freq , rs_periods )
130
-
131
- rs_freq = self .tsframe .pct_change (freq = '3B' , fill_method = None )
132
- rs_periods = self .tsframe .pct_change (3 , fill_method = None )
133
- assert_frame_equal (rs_freq , rs_periods )
134
-
135
- rs_freq = self .tsframe .pct_change (freq = '3B' , fill_method = 'bfill' )
136
- rs_periods = self .tsframe .pct_change (3 , fill_method = 'bfill' )
137
- assert_frame_equal (rs_freq , rs_periods )
138
-
139
- rs_freq = self .tsframe .pct_change (freq = '7B' ,
140
- fill_method = 'pad' ,
141
- limit = 1 )
142
- rs_periods = self .tsframe .pct_change (7 , fill_method = 'pad' , limit = 1 )
143
- assert_frame_equal (rs_freq , rs_periods )
144
-
145
- rs_freq = self .tsframe .pct_change (freq = '7B' ,
146
- fill_method = 'bfill' ,
147
- limit = 3 )
148
- rs_periods = self .tsframe .pct_change (7 , fill_method = 'bfill' , limit = 3 )
134
+ rs_freq = self .tsframe .pct_change (freq = freq ,
135
+ fill_method = fill_method ,
136
+ limit = limit )
137
+ rs_periods = self .tsframe .pct_change (periods ,
138
+ fill_method = fill_method ,
139
+ limit = limit )
149
140
assert_frame_equal (rs_freq , rs_periods )
150
141
151
142
empty_ts = DataFrame (index = self .tsframe .index ,
152
143
columns = self .tsframe .columns )
153
- rs_freq = empty_ts .pct_change (freq = '14B' )
154
- rs_periods = empty_ts .pct_change (14 )
144
+ rs_freq = empty_ts .pct_change (freq = freq ,
145
+ fill_method = fill_method ,
146
+ limit = limit )
147
+ rs_periods = empty_ts .pct_change (periods ,
148
+ fill_method = fill_method ,
149
+ limit = limit )
155
150
assert_frame_equal (rs_freq , rs_periods )
156
151
157
152
def test_frame_ctor_datetime64_column (self ):
0 commit comments