8000 Merge pull request #6997 from maahn/fixPandas · matplotlib/matplotlib@018fa1c · GitHub
[go: up one dir, main page]

Skip to content

Commit 018fa1c

Browse files
committed
Merge pull request #6997 from maahn/fixPandas
FIX: Only try to find unit converter for first element of sequence Conflicts: lib/matplotlib/units.py - master branch lost six import, kept in place in backport
1 parent 591b6d6 commit 018fa1c

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/matplotlib/units.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def default_units(x, axis):
4747

4848
import six
4949

50-
from matplotlib.cbook import iterable, is_numlike
50+
from matplotlib.cbook import iterable, is_numlike, safe_first_element
5151
import numpy as np
5252

5353

@@ -158,14 +158,11 @@ def get_converter(self, x):
158158
converter = self.get_converter(next_item)
159159
return converter
160160

161-
if converter is None and iterable(x):
162-
for thisx in x:
163-
# Make sure that recursing might actually lead to a solution,
164-
# if we are just going to re-examine another item of the same
165-
# kind, then do not look at it.
166-
if classx and classx != getattr(thisx, '__class__', None):
167-
converter = self.get_converter(thisx)
168-
return converter
161+
if converter is None and iterable(x) and (len(x) > 0):
162+
thisx = safe_first_element(x)
163+
if classx and classx != getattr(thisx, '__class__', None):
164+
converter = self.get_converter(thisx)
165+
return converter
169166

170167
#DISABLED self._cached[idx] = converter
171168
return converter

0 commit comments

Comments
 (0)
0