Skip to content

Commit

Permalink
Remove maybe unused function (#57814)
Browse files Browse the repository at this point in the history
* Remove unused function

* Remove unused function
  • Loading branch information
tqa236 authored Mar 11, 2024
1 parent d8eb201 commit d6c2586
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 44 deletions.
23 changes: 0 additions & 23 deletions pandas/plotting/_matplotlib/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import datetime as pydt
from datetime import (
datetime,
timedelta,
tzinfo,
)
import functools
Expand Down Expand Up @@ -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

# -------------------------------------------------------------------------
Expand Down
21 changes: 0 additions & 21 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit d6c2586

Please sign in to comment.