Skip to content

Commit d6c2586

Browse files
authored
Remove maybe unused function (#57814)
* Remove unused function * Remove unused function
1 parent d8eb201 commit d6c2586

File tree

2 files changed

+0
-44
lines changed

2 files changed

+0
-44
lines changed

pandas/plotting/_matplotlib/converter.py

-23
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import datetime as pydt
55
from datetime import (
66
datetime,
7-
timedelta,
87
tzinfo,
98
)
109
import functools
@@ -460,28 +459,6 @@ def autoscale(self):
460459
return self.nonsingular(vmin, vmax)
461460

462461

463-
def _from_ordinal(x, tz: tzinfo | None = None) -> datetime:
464-
ix = int(x)
465-
dt = datetime.fromordinal(ix)
466-
remainder = float(x) - ix
467-
hour, remainder = divmod(24 * remainder, 1)
468-
minute, remainder = divmod(60 * remainder, 1)
469-
second, remainder = divmod(60 * remainder, 1)
470-
microsecond = int(1_000_000 * remainder)
471-
if microsecond < 10:
472-
microsecond = 0 # compensate for rounding errors
473-
dt = datetime(
474-
dt.year, dt.month, dt.day, int(hour), int(minute), int(second), microsecond
475-
)
476-
if tz is not None:
477-
dt = dt.astimezone(tz)
478-
479-
if microsecond > 999990: # compensate for rounding errors
480-
dt += timedelta(microseconds=1_000_000 - microsecond)
481-
482-
return dt
483-
484-
485462
# Fixed frequency dynamic tick locators and formatters
486463

487464
# -------------------------------------------------------------------------

pandas/tests/plotting/test_datetimelike.py

-21
Original file line numberDiff line numberDiff line change
@@ -295,27 +295,6 @@ def test_plot_multiple_inferred_freq(self):
295295
ser = Series(np.random.default_rng(2).standard_normal(len(dr)), index=dr)
296296
_check_plot_works(ser.plot)
297297

298-
@pytest.mark.xfail(reason="Api changed in 3.6.0")
299-
def test_uhf(self):
300-
import pandas.plotting._matplotlib.converter as conv
301-
302-
idx = date_range("2012-6-22 21:59:51.960928", freq="ms", periods=500)
303-
df = DataFrame(
304-
np.random.default_rng(2).standard_normal((len(idx), 2)), index=idx
305-
)
306-
307-
_, ax = mpl.pyplot.subplots()
308-
df.plot(ax=ax)
309-
axis = ax.get_xaxis()
310-
311-
tlocs = axis.get_ticklocs()
312-
tlabels = axis.get_ticklabels()
313-
for loc, label in zip(tlocs, tlabels):
314-
xp = conv._from_ordinal(loc).strftime("%H:%M:%S.%f")
315-
rs = str(label.get_text())
316-
if len(rs):
317-
assert xp == rs
318-
319298
def test_irreg_hf(self):
320299
idx = date_range("2012-6-22 21:59:51", freq="s", periods=10)
321300
df = DataFrame(

0 commit comments

Comments
 (0)