Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v2.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ Period

Plotting
^^^^^^^^
-
- ``ax.set_xlim`` was sometimes raising ``UserWarning`` which users couldn't address due to ``set_xlim`` not accepting parsing arguments - the converter now uses :func:`Timestamp` instead (:issue:`49148`)
-

Groupby/resample/rolling
Expand Down
2 changes: 1 addition & 1 deletion pandas/plotting/_matplotlib/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ def _to_ordinalf(tm: pydt.time) -> float:

def time2num(d):
if isinstance(d, str):
parsed = tools.to_datetime(d)
parsed = Timestamp(d)
Copy link
Member

Choose a reason for hiding this comment

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

This probably changes error messages? If yes, should add a whatsnew

Copy link
Member

Choose a reason for hiding this comment

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

i think this also makes the check/raise on the next two lines unnecesary

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah good call, looks like they're uncovered as it is anyway https://app.codecov.io/gh/pandas-dev/pandas/blob/main/pandas/plotting/_matplotlib/converter.py

if not isinstance(parsed, datetime):
raise ValueError(f"Could not parse time {d}")
return _to_ordinalf(parsed.time())
Expand Down