From bc1a7253b434803b375a12a19835a7cbdc0586b7 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Tue, 4 Aug 2020 19:29:46 -0400 Subject: [PATCH] Backport PR #18167: Catch Pandas AssertionError on deprecated multidimensional indexing. Closes #18158 --- lib/matplotlib/cbook/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index bb2dde98a170..7fcae5db0b66 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -1326,7 +1326,11 @@ def _check_1d(x): if ndim < 2: return np.atleast_1d(x) return x - except (IndexError, TypeError): + # In pandas 1.1.0, multidimensional indexing leads to an + # AssertionError for some Series objects, but should be + # IndexError as described in + # https://github.com/pandas-dev/pandas/issues/35527 + except (AssertionError, IndexError, TypeError): return np.atleast_1d(x)