From 319795aa49cc0829d8666cf591ff4bf92f0ad73d Mon Sep 17 00:00:00 2001 From: Anh Trinh Date: Mon, 11 Mar 2024 21:11:06 +0100 Subject: [PATCH 1/2] Remove unused function --- pandas/plotting/_matplotlib/converter.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/pandas/plotting/_matplotlib/converter.py b/pandas/plotting/_matplotlib/converter.py index 0eb3318ac96c5..e2121526c16af 100644 --- a/pandas/plotting/_matplotlib/converter.py +++ b/pandas/plotting/_matplotlib/converter.py @@ -4,7 +4,6 @@ import datetime as pydt from datetime import ( datetime, - timedelta, tzinfo, ) import functools @@ -460,28 +459,6 @@ def autoscale(self): return self.nonsingular(vmin, vmax) -def _from_ordinal(x, tz: tzinfo | None = None) -> datetime: - ix = int(x) - dt = datetime.fromordinal(ix) - remainder = float(x) - ix - hour, remainder = divmod(24 * remainder, 1) - minute, remainder = divmod(60 * remainder, 1) - second, remainder = divmod(60 * remainder, 1) - microsecond = int(1_000_000 * remainder) - if microsecond < 10: - microsecond = 0 # compensate for rounding errors - dt = datetime( - dt.year, dt.month, dt.day, int(hour), int(minute), int(second), microsecond - ) - if tz is not None: - dt = dt.astimezone(tz) - - if microsecond > 999990: # compensate for rounding errors - dt += timedelta(microseconds=1_000_000 - microsecond) - - return dt - - # Fixed frequency dynamic tick locators and formatters # ------------------------------------------------------------------------- From 14eab90e9a0b3f0aa0e2198fcf7f1d15443ccb65 Mon Sep 17 00:00:00 2001 From: Anh Trinh Date: Mon, 11 Mar 2024 21:14:44 +0100 Subject: [PATCH 2/2] Remove unused function --- pandas/tests/plotting/test_datetimelike.py | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/pandas/tests/plotting/test_datetimelike.py b/pandas/tests/plotting/test_datetimelike.py index 2eb44ef4771e0..7164b7a046ff2 100644 --- a/pandas/tests/plotting/test_datetimelike.py +++ b/pandas/tests/plotting/test_datetimelike.py @@ -295,27 +295,6 @@ def test_plot_multiple_inferred_freq(self): ser = Series(np.random.default_rng(2).standard_normal(len(dr)), index=dr) _check_plot_works(ser.plot) - @pytest.mark.xfail(reason="Api changed in 3.6.0") - def test_uhf(self): - import pandas.plotting._matplotlib.converter as conv - - idx = date_range("2012-6-22 21:59:51.960928", freq="ms", periods=500) - df = DataFrame( - np.random.default_rng(2).standard_normal((len(idx), 2)), index=idx - ) - - _, ax = mpl.pyplot.subplots() - df.plot(ax=ax) - axis = ax.get_xaxis() - - tlocs = axis.get_ticklocs() - tlabels = axis.get_ticklabels() - for loc, label in zip(tlocs, tlabels): - xp = conv._from_ordinal(loc).strftime("%H:%M:%S.%f") - rs = str(label.get_text()) - if len(rs): - assert xp == rs - def test_irreg_hf(self): idx = date_range("2012-6-22 21:59:51", freq="s", periods=10) df = DataFrame(