Skip to content

REGR: Bar plot axis timestamp to string conversion error #46413

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
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
11 changes: 11 additions & 0 deletions pandas/tests/plotting/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from pandas import (
DataFrame,
Series,
Timestamp,
)
import pandas._testing as tm
from pandas.tests.plotting.common import (
Expand Down Expand Up @@ -549,3 +550,13 @@ def test_externally_shared_axes(self):
assert not plots[0][0].xaxis.get_label().get_visible()
assert plots[0][1].xaxis.get_label().get_visible()
assert not plots[0][2].xaxis.get_label().get_visible()

def test_plot_bar_axis_units_timestamp_conversion(self):
# GH 38736
# Ensure string x-axis from the second plot will not be converted to datetime
# due to axis data from first plot
DataFrame(
Copy link
Member

Choose a reason for hiding this comment

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

Could you add some sort of assertion to these calls instead of just being a smoke test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the _check_plot_works function to each plot.

I also want to assert the datatype of the axis of the plots (ie. datetime and string), but I am a bit lost on how I can achieve that.

[1.0],
index=[Timestamp("2022-02-22 22:22:22")],
).plot()
Series({"A": 1.0}).plot.bar()