Skip to content

Commit 394bf0e

Browse files
author
Si Wei How
committed
Change BusinessHour.repr
1 parent a5e12ae commit 394bf0e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

pandas/tests/tseries/offsets/test_offsets.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -800,11 +800,11 @@ def test_repr(self):
800800
assert repr(self.offset6) == '<BusinessHour: BH=20:00-05:00>'
801801
assert repr(self.offset7) == '<-2 * BusinessHours: BH=21:30-06:30>'
802802
assert (repr(self.offset8) ==
803-
'<BusinessHour: BH=09:00,13:00-12:00,17:00>')
803+
'<BusinessHour: BH=09:00-12:00,13:00-17:00>')
804804
assert (repr(self.offset9) ==
805-
'<3 * BusinessHours: BH=09:00,22:00-13:00,03:00>')
805+
'<3 * BusinessHours: BH=09:00-13:00,22:00-03:00>')
806806
assert (repr(self.offset10) ==
807-
'<-1 * BusinessHour: BH=13:00,23:00-17:00,02:00>')
807+
'<-1 * BusinessHour: BH=13:00-17:00,23:00-02:00>')
808808

809809
def test_with_offset(self):
810810
expected = Timestamp('2014-07-01 13:00')

pandas/tseries/offsets.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -862,10 +862,10 @@ def _onOffset(self, dt):
862862

863863
def _repr_attrs(self):
864864
out = super()._repr_attrs()
865-
start = ','.join(st.strftime('%H:%M') for st in self.start)
866-
end = ','.join(en.strftime('%H:%M') for en in self.end)
867-
attrs = ['{prefix}={start}-{end}'.format(prefix=self._prefix,
868-
start=start, end=end)]
865+
hours = ','.join('{}-{}'.format(st.strftime('%H:%M'), en.strftime('%H:%M'))
866+
for st, en in zip(self.start, self.end))
867+
attrs = ['{prefix}={hours}'.format(prefix=self._prefix,
868+
hours=hours)]
869869
out += ': ' + ', '.join(attrs)
870870
return out
871871

0 commit comments

Comments
 (0)