Skip to content

Commit 9a78cd7

Browse files
committed
TimeFormatter: use round() for microseconds
1 parent 9efa68c commit 9a78cd7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pandas/plotting/_converter.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,9 @@ def __init__(self, locs):
192192
def __call__(self, x, pos=0):
193193
fmt = '%H:%M:%S.%f'
194194
s = int(x)
195-
ms = int((x - s) * 1e3)
196-
us = int((x - s) * 1e6 - ms * 1e3)
197-
msus = int((x - s) * 1e6)
195+
msus = int(round((x - s) * 1e6))
196+
ms = int(msus / 1e3)
197+
us = int(msus - ms * 1e3)
198198
m, s = divmod(s, 60)
199199
h, m = divmod(m, 60)
200200
_, h = divmod(h, 24)

0 commit comments

Comments
 (0)