Skip to content

CLN use pd.Timestamp for single element in converter #49148

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 4 commits into from
Oct 18, 2022
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
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