Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 161c96c commit 237e492Copy full SHA for 237e492
lib/matplotlib/cbook.py
@@ -1657,7 +1657,7 @@ def safe_isfinite(val):
1657
raise RuntimeError("matplotlib does not "
1658
"support generators as input")
1659
else:
1660
- return next(val for val in obj if safe_isfinite(val))
+ return next((val for val in obj if safe_isfinite(val)), np.nan)
1661
1662
1663
def sanitize_sequence(data):
lib/matplotlib/tests/test_cbook.py
@@ -608,6 +608,12 @@ def test_flatiter():
608
assert 1 == next(it)
609
610
611
+def test__safe_first_finite_all_nan():
612
+ arr = np.full(2, np.nan)
613
+ ret = cbook._safe_first_finite(arr)
614
+ assert ret is np.nan
615
+
616
617
def test_reshape2d():
618
619
class Dummy:
0 commit comments