8000 Catch Pandas AssertionError on deprecated multidimensional indexing · matplotlib/matplotlib@5f66d83 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5f66d83

Browse files
committed
Catch Pandas AssertionError on deprecated multidimensional indexing
Fixes #18158 due to pandas-dev/pandas#35527
1 parent ede8e56 commit 5f66d83

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,8 +1323,11 @@ def _check_1d(x):
13231323
"always",
13241324
category=Warning,
13251325
message='Support for multi-dimensional indexing')
1326-
1327-
ndim = x[:, None].ndim
1326+
try:
1327+
ndim = x[:, None].ndim
1328+
except AssertionError:
1329+
# catch https://github.com/pandas-dev/pandas/issues/35527
1330+
return np.asanyarray(x)
13281331
# we have definitely hit a pandas index or series object
13291332
# cast to a numpy array.
13301333
if len(w) > 0:

0 commit comments

Comments
 (0)
0