Skip to content

Commit c43652e

Browse files
authored
CLN: resolve UserWarning in pandas/plotting/_matplotlib/core.py pandas-dev#35945 (pandas-dev#35946)
1 parent 3967131 commit c43652e

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pandas/plotting/_matplotlib/core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1223,8 +1223,8 @@ def get_label(i):
12231223
if self._need_to_set_index:
12241224
xticks = ax.get_xticks()
12251225
xticklabels = [get_label(x) for x in xticks]
1226-
ax.set_xticklabels(xticklabels)
12271226
ax.xaxis.set_major_locator(FixedLocator(xticks))
1227+
ax.set_xticklabels(xticklabels)
12281228

12291229
condition = (
12301230
not self._use_dynamic_x()

pandas/tests/plotting/test_frame.py

+6-4
Original file line numberDiff line numberDiff line change
@@ -2796,10 +2796,12 @@ def test_table(self):
27962796
_check_plot_works(df.plot, table=True)
27972797
_check_plot_works(df.plot, table=df)
27982798

2799-
ax = df.plot()
2800-
assert len(ax.tables) == 0
2801-
plotting.table(ax, df.T)
2802-
assert len(ax.tables) == 1
2799+
# GH 35945 UserWarning
2800+
with tm.assert_produces_warning(None):
2801+
ax = df.plot()
2802+
assert len(ax.tables) == 0
2803+
plotting.table(ax, df.T)
2804+
assert len(ax.tables) == 1
28032805

28042806
def test_errorbar_scatter(self):
28052807
df = DataFrame(np.random.randn(5, 2), index=range(5), columns=["x", "y"])

0 commit comments

Comments
 (0)