Skip to content

TST: GH39126 Test barh plot with string and integer at the same column #47306

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 3 commits into from
Jun 10, 2022
Merged
Changes from all 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
15 changes: 15 additions & 0 deletions pandas/tests/plotting/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,21 @@ def test_bar_plot(self):
for a, b in zip(plot_bar.get_xticklabels(), expected)
)

def test_barh_plot_labels_mixed_integer_string(self):
# GH39126
# Test barh plot with string and integer at the same column
from matplotlib.text import Text

df = DataFrame([{"word": 1, "value": 0}, {"word": "knowledg", "value": 2}])
plot_barh = df.plot.barh(x="word", legend=None)
expected_yticklabels = [Text(0, 0, "1"), Text(0, 1, "knowledg")]
assert all(
actual.get_text() == expected.get_text()
for actual, expected in zip(
plot_barh.get_yticklabels(), expected_yticklabels
)
)

def test_has_externally_shared_axis_x_axis(self):
# GH33819
# Test _has_externally_shared_axis() works for x-axis
Expand Down