File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -382,9 +382,12 @@ def _apply_loffset(self, result):
382
382
if isinstance (loffset , compat .string_types ):
383
383
loffset = to_offset (self .loffset )
384
384
385
- if isinstance (loffset , (DateOffset , timedelta )) and \
386
- isinstance (result .index , DatetimeIndex ) and \
387
- len (result .index ) > 0 :
385
+ needs_offset = (
386
+ isinstance (loffset , (DateOffset , timedelta )) and
387
+ isinstance (result .index , DatetimeIndex ) and
388
+ len (result .index ) > 0
389
+ )
390
+ if needs_offset :
388
391
result .index = result .index + loffset
389
392
390
393
return result
Original file line number Diff line number Diff line change @@ -945,7 +945,10 @@ def test_resample_loffset_count(self):
945
945
946
946
result = ts .resample ('10S' , loffset = '1s' ).count ()
947
947
948
- expected_index = date_range (start_time , periods = 10 , freq = '10S' ) + timedelta (seconds = 1 )
948
+ expected_index = (
949
+ date_range (start_time , periods = 10 , freq = '10S' ) +
950
+ timedelta (seconds = 1 )
951
+ )
949
952
expected = pd .Series (10 , index = expected_index )
950
953
951
954
assert_series_equal (result , expected )
You can’t perform that action at this time.
0 commit comments