Skip to content

FIX: revert part of #11770 #13131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions doc/source/whatsnew/v0.18.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,4 @@ Bug Fixes







- Bug in ``AutoDataFormatter``, restore second scaled formatting and readd musecond scaled formatting (:issue:`13131`)
18 changes: 18 additions & 0 deletions pandas/tseries/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from dateutil.relativedelta import relativedelta

import matplotlib
import matplotlib.units as units
import matplotlib.dates as dates

Expand All @@ -23,6 +24,16 @@
from pandas.tseries.frequencies import FreqGroup
from pandas.tseries.period import Period, PeriodIndex

# constants
HOURS_PER_DAY = 24.
MIN_PER_HOUR = 60.
SEC_PER_MIN = 60.

SEC_PER_HOUR = SEC_PER_MIN * MIN_PER_HOUR
SEC_PER_DAY = SEC_PER_HOUR * HOURS_PER_DAY

MUSEC_PER_DAY = 1e6 * SEC_PER_DAY


def register():
units.registry[lib.Timestamp] = DatetimeConverter()
Expand Down Expand Up @@ -221,6 +232,13 @@ def __init__(self, locator, tz=None, defaultfmt='%Y-%m-%d'):
if self._tz is dates.UTC:
self._tz._utcoffset = self._tz.utcoffset(None)

# For mpl > 2.0 the format strings are controlled via rcparams
# so do not mess with them. For mpl < 2.0 change the second
# break point and add a musec break point
if matplotlib.compare_versions('2.0.0', matplotlib.__version__):
self.scaled[1. / SEC_PER_DAY] = '%H:%M:%S'
self.scaled[1. / MUSEC_PER_DAY] = '%H:%M:%S.%f'


class PandasAutoDateLocator(dates.AutoDateLocator):

Expand Down