Skip to content

Commit df4b7dc

Browse files
committed
MNT: use a slightly simpler check odd Index behavior
This will fail on older version of pandas as well.
1 parent f30de35 commit df4b7dc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1326,10 +1326,12 @@ def _check_1d(x):
13261326
return np.atleast_1d(x)
13271327
else:
13281328
try:
1329-
shape = x[:, None].shape
1329+
ndim = x[:, None].ndim
13301330
# work around https://github.com/pandas-dev/pandas/issues/27775
1331-
# which mean the shape is not as expected
1332-
if len(shape) != 2:
1331+
# which mean the shape is not as expected. That this ever worked
1332+
# was an unintentional quirk of pandas the above line will raise
1333+
# an exception in the future.
1334+
if ndim < 2:
13331335
return np.atleast_1d(x)
13341336
return x
13351337
except (IndexError, TypeError):

0 commit comments

Comments
 (0)