Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2681d33

Browse filesBrowse files
anntzerMeeseeksDev[bot]
authored andcommitted
Backport PR #15007: FIX: support pandas 0.25
1 parent cb1983e commit 2681d33
Copy full SHA for 2681d33

File tree

Expand file treeCollapse file tree

2 files changed

+13
-1
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+13
-1
lines changed

‎lib/matplotlib/cbook/__init__.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook/__init__.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2061,7 +2061,13 @@ def _check_1d(x):
20612061
return np.atleast_1d(x)
20622062
else:
20632063
try:
2064-
x[:, None]
2064+
ndim = x[:, None].ndim
2065+
# work around https://github.com/pandas-dev/pandas/issues/27775
2066+
# which mean the shape is not as expected. That this ever worked
2067+
# was an unintentional quirk of pandas the above line will raise
2068+
# an exception in the future.
2069+
if ndim < 2:
2070+
return np.atleast_1d(x)
20652071
return x
20662072
except (IndexError, TypeError):
20672073
return np.atleast_1d(x)

‎lib/matplotlib/tests/test_axes.py

Copy file name to clipboardExpand all lines: lib/matplotlib/tests/test_axes.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5170,6 +5170,12 @@ def test_pandas_errorbar_indexing(pd):
51705170
ax.errorbar('x', 'y', xerr='xe', yerr='ye', data=df)
51715171

51725172

5173+
def test_pandas_index_shape(pd):
5174+
df = pd.DataFrame({"XX": [4, 5, 6], "YY": [7, 1, 2]})
5175+
fig, ax = plt.subplots()
5176+
ax.plot(df.index, df['YY'])
5177+
5178+
51735179
def test_pandas_indexing_hist(pd):
51745180
ser_1 = pd.Series(data=[1, 2, 2, 3, 3, 4, 4, 4, 4, 5])
51755181
ser_2 = ser_1.iloc[1:]

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.