Skip to content

Commit c86238c

Browse files
committed
TimeFormatter: Only show seconds if non-zero
1 parent 9a78cd7 commit c86238c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/plotting/_converter.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ def __call__(self, x, pos=0):
202202
return pydt.time(h, m, s, msus).strftime(fmt)
203203
elif ms != 0:
204204
return pydt.time(h, m, s, msus).strftime(fmt)[:-3]
205+
elif s != 0:
206+
return pydt.time(h, m, s).strftime('%H:%M:%S')
205207

206-
return pydt.time(h, m, s).strftime('%H:%M:%S')
208+
return pydt.time(h, m).strftime('%H:%M')
207209

208210

209211
# Period Conversion

0 commit comments

Comments
 (0)