Skip to content

Commit b14d62e

Browse files
REGR: Bar plot axis timestamp to string conversion error (#46413)
* test: bar plot axis conversion regr test * test: added check plot works assertion
1 parent 3f366e4 commit b14d62e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/tests/plotting/test_misc.py

+13
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from pandas import (
99
DataFrame,
1010
Series,
11+
Timestamp,
1112
)
1213
import pandas._testing as tm
1314
from pandas.tests.plotting.common import (
@@ -549,3 +550,15 @@ def test_externally_shared_axes(self):
549550
assert not plots[0][0].xaxis.get_label().get_visible()
550551
assert plots[0][1].xaxis.get_label().get_visible()
551552
assert not plots[0][2].xaxis.get_label().get_visible()
553+
554+
def test_plot_bar_axis_units_timestamp_conversion(self):
555+
# GH 38736
556+
# Ensure string x-axis from the second plot will not be converted to datetime
557+
# due to axis data from first plot
558+
df = DataFrame(
559+
[1.0],
560+
index=[Timestamp("2022-02-22 22:22:22")],
561+
)
562+
_check_plot_works(df.plot)
563+
s = Series({"A": 1.0})
564+
_check_plot_works(s.plot.bar)

0 commit comments

Comments
 (0)