3
3
""" Test cases for DataFrame.plot """
4
4
5
5
from datetime import date , datetime
6
+ import itertools
6
7
import string
7
8
import warnings
8
9
@@ -2604,12 +2605,6 @@ def test_errorbar_plot(self):
2604
2605
ax = _check_plot_works (df .plot , yerr = np .ones ((2 , 12 )) * 0.4 )
2605
2606
self ._check_has_errorbars (ax , xerr = 0 , yerr = 2 )
2606
2607
2607
- # yerr is iterator
2608
- import itertools
2609
-
2610
- ax = _check_plot_works (df .plot , yerr = itertools .repeat (0.1 , len (df )))
2611
- self ._check_has_errorbars (ax , xerr = 0 , yerr = 2 )
2612
-
2613
2608
# yerr is column name
2614
2609
for yerr in ["yerr" , "誤差" ]:
2615
2610
s_df = df .copy ()
@@ -2626,6 +2621,17 @@ def test_errorbar_plot(self):
2626
2621
with pytest .raises ((ValueError , TypeError )):
2627
2622
df .plot (yerr = df_err )
2628
2623
2624
+ @pytest .mark .xfail (reason = "Iterator is consumed" , raises = ValueError )
2625
+ @pytest .mark .slow
2626
+ def test_errorbar_plot_iterator (self ):
2627
+ with warnings .catch_warnings ():
2628
+ d = {"x" : np .arange (12 ), "y" : np .arange (12 , 0 , - 1 )}
2629
+ df = DataFrame (d )
2630
+
2631
+ # yerr is iterator
2632
+ ax = _check_plot_works (df .plot , yerr = itertools .repeat (0.1 , len (df )))
2633
+ self ._check_has_errorbars (ax , xerr = 0 , yerr = 2 )
2634
+
2629
2635
@pytest .mark .slow
2630
2636
def test_errorbar_with_integer_column_names (self ):
2631
2637
# test with integer column names
0 commit comments