File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 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):
382382 if isinstance (loffset , compat .string_types ):
383383 loffset = to_offset (self .loffset )
384384
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 :
388391 result .index = result .index + loffset
389392
390393 return result
Original file line number Diff line number Diff line change @@ -945,7 +945,10 @@ def test_resample_loffset_count(self):
945945
946946 result = ts .resample ('10S' , loffset = '1s' ).count ()
947947
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+ )
949952 expected = pd .Series (10 , index = expected_index )
950953
951954 assert_series_equal (result , expected )
You can’t perform that action at this time.
0 commit comments