File tree 3 files changed +14
-0
lines changed
3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,7 @@ Bug Fixes
89
89
~~~~~~~~~
90
90
91
91
- Bug in ``Index.min`` and ``max`` doesn't handle ``nan`` and ``NaT`` properly (:issue:`7261`)
92
+ - Bug in ``resample`` where ``fill_method`` was ignored if you passed ``how`` (:issue:`7261`)
92
93
- Bug in ``TimeGrouper`` doesn't exclude column specified by ``key`` (:issue:`7227`)
93
94
- Bug in ``DataFrame`` and ``Series`` bar and barh plot raises ``TypeError`` when ``bottom``
94
95
and ``left`` keyword is specified (:issue:`7226`)
Original file line number Diff line number Diff line change @@ -252,6 +252,11 @@ def _resample_timestamps(self):
252
252
# downsample
253
253
grouped = obj .groupby (grouper , axis = self .axis )
254
254
result = grouped .aggregate (self ._agg_method )
255
+ # GH2073
256
+ if self .fill_method is not None :
257
+ result = result .fillna (method = self .fill_method ,
258
+ limit = self .limit )
259
+
255
260
else :
256
261
# upsampling shortcut
257
262
if self .axis :
Original file line number Diff line number Diff line change @@ -869,6 +869,14 @@ def test_monthly_upsample(self):
869
869
expected = expected .asfreq (targ , 'ffill' ).to_period ()
870
870
assert_series_equal (result , expected )
871
871
872
+ def test_fill_method_and_how_upsample (self ):
873
+ # GH2073
874
+ s = Series (range (9 ),
875
+ index = date_range ('2010-01-01' , periods = 9 , freq = 'Q' ))
876
+ last = s .resample ('M' , fill_method = 'ffill' )
877
+ both = s .resample ('M' , how = 'last' , fill_method = 'ffill' ).astype ('int64' )
878
+ assert_series_equal (last , both )
879
+
872
880
def test_weekly_upsample (self ):
873
881
targets = ['D' , 'B' ]
874
882
You can’t perform that action at this time.
0 commit comments