Skip to content

Remove maybe unused function #57814

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

Merged
merged 2 commits into from
Mar 11, 2024
Merged
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
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