Skip to content
Merged
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions pandas/plotting/_matplotlib/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,7 @@ def _get_periods_per_ymd(freq: BaseOffset) -> tuple[int, int, int]:
return ppd, ppm, ppy


@functools.cache
def _daily_finder(vmin, vmax, freq: BaseOffset) -> np.ndarray:
# error: "BaseOffset" has no attribute "_period_dtype_code"
dtype_code = freq._period_dtype_code # type: ignore[attr-defined]
Expand Down Expand Up @@ -755,6 +756,7 @@ def _second_finder(label_interval: int) -> None:
return info


@functools.cache
def _monthly_finder(vmin, vmax, freq: BaseOffset) -> np.ndarray:
_, _, periodsperyear = _get_periods_per_ymd(freq)

Expand Down Expand Up @@ -826,6 +828,7 @@ def _monthly_finder(vmin, vmax, freq: BaseOffset) -> np.ndarray:
return info


@functools.cache
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No chance of getting non-hashable inputs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think vmax/vmin are always floats. I'll type these so we have some validation

def _quarterly_finder(vmin, vmax, freq: BaseOffset) -> np.ndarray:
_, _, periodsperyear = _get_periods_per_ymd(freq)
vmin_orig = vmin
Expand Down Expand Up @@ -873,6 +876,7 @@ def _quarterly_finder(vmin, vmax, freq: BaseOffset) -> np.ndarray:
return info


@functools.cache
def _annual_finder(vmin, vmax, freq: BaseOffset) -> np.ndarray:
# Note: small difference here vs other finders in adding 1 to vmax
(vmin, vmax) = (int(vmin), int(vmax + 1))
Expand Down