
    [6gr                         d Z ddlZddlZddlZddlZddlmZmZm	Z	m
Z
mZmZ ddlmZ ddlmZmZmZmZmZ ddlmZ  ej        d          Z ej        d          Zd Z G d	 d
          Z G d d          ZdS )z  Test cases for .boxplot method     N)	DataFrame
MultiIndexSeries
date_rangeplottingtimedelta_range)_check_axes_shape_check_box_return_type_check_plot_works_check_ticks_props_check_visible)pprint_thing
matplotlibzmatplotlib.pyplotc                     |                                 \  }}||                                 k    sJ ||                                 k    sJ d S N)get_ylimminmax)colaxy_miny_maxs       h/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/pandas/tests/plotting/test_boxplot_method.py_check_ax_limitsr       sK    ;;==LE5CGGIICGGII    c                      e Zd Zd Zej        j        ej                            dddidgdddgidgddgd	d
egdgd	dgd
dgdd	iegdd	dgiegddidgd	ddegg          d                         Z	d Z
d Zd Zd Zd Zd Zd Zd Zej                            dg d          d             Zd Zd Zd Zd Zd Zd  Zej                            d!d"d#d$d%d&d"d#d$d%d&fd'd"id'd"ifd"d"d"d"d"d&fg          d(             Zej                            d)d*d+d+d,d+d&fd-d.d.d/d.d&fg          d0             Zej                            d1d"d"d2d3fg          d4             Zej                            d5g d6          d7             Zej                            d8d9d:g          d;             Zej                            d8d9d:g          d<             Zej                            d8d9d:g          d=             Zej                            d8d9d:g          d>             Z ej                            d8d9d:g          d?             Z!dS )@TestDataFramePlotsc                 @   dd l m} d}t          t          j                            d                              g d|          t          j                            d                              g d|          t          j                            d                              g d|          dt          j        d|                    }|                    dd	          }d
 |	                                D             |j
                                        k    sJ |                    t          j        ddd                     |                                 d |	                                D             t          t          j        ddd                    k    sJ d S )Nr   P      )r      r       )Clinical	Confirmed	DiscardedindexbarT)kindstackedc                 P    g | ]#}t          |                                          $S  intget_text.0xs     r   
<listcomp>zDTestDataFramePlots.test_stacked_boxplot_set_axis.<locals>.<listcomp>5   (    @@@aAJJLL!!@@@r   
   c                 P    g | ]#}t          |                                          $S r,   r-   r0   s     r   r3   zDTestDataFramePlots.test_stacked_boxplot_set_axis.<locals>.<listcomp>8   r4   r   )matplotlib.pyplotpyplotr   nprandomdefault_rngchoicearangeplotget_xticklabelsr'   to_list
set_xticksdrawlist)selfpltndfr   s        r   test_stacked_boxplot_set_axisz0TestDataFramePlots.test_stacked_boxplot_set_axis'   s   ''''''I11!44;;LLL!LLY22155<<\\\1MMY22155<<\\\1MM 
 )Aq//
 
 
 WW%W..@@2+=+=+?+?@@@BHDTDTDVDVVVVV
bi2r**+++


@@2+=+=+?+?@@@DIaR  E
 E
 
 
 
 
 
 
r   zkwargs, warnreturn_typedictNcolumnonetwoindic)rK   byindic2rO   notchr!   )rO   rQ   c                 v   t          t          j                            d                              d          t          t          j        d d                   g d          }ddgdz  |d	<   g d
dz  |d<   t          j	        |d          5  t          |j        fi | d d d            d S # 1 swxY w Y   d S )Nr          rT   rL   rM   threefourr'   columnsfoor(   r"   rN   )r[   r(   r[   rP   Fcheck_stacklevel)r   r9   r:   r;   standard_normalrC   stringascii_letterstmassert_produces_warningr   boxplot)rD   kwargswarnrG   s       r   test_boxplot_legacy1z'TestDataFramePlots.test_boxplot_legacy1<   s    I!!!$$44V<<v+BQB/00333
 
 

 enq(7,,,q08 'uEEE 	4 	4bj33F333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s   B..B25B2c                     t          t          j                            d                              d                    }t          t          j        j        |d           d S )Nr    rT   rJ   )datarI   )	r   r9   r:   r;   r^   r   r   _corerc   )rD   sers     r   test_boxplot_legacy1_seriesz.TestDataFramePlots.test_boxplot_legacy1_seriesW   sM    RY**1--==a@@AA(.0sOOOOOOr   c                 t   t          t          j                            d                              d          ddg          }t	          g d          |d<   t	          dgd	z            |d
<   t          j        t          d          5  t          |j	        d           d d d            d S # 1 swxY w Y   d S )Nr    r5   r    Col1Col2rZ   
Arr   rr   rr   rr   Brs   rs   rs   rs   Xrr   r5   YFr\   rO   )
r   r9   r:   r;   r   ra   rb   UserWarningr   rc   rD   rG   s     r   test_boxplot_legacy2z'TestDataFramePlots.test_boxplot_legacy2[   s    I!!!$$++G44vv>N
 
 
 KKKLL3#$$3'eLLL 	2 	2bjS1111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2s   	B--B14B1c                 l   t          t          j                            d                              d          ddg          }t	          g d          |d<   t	          dgd	z            |d
<   t
          j                                        \  }}|                    dd|          }|j	        }||u sJ d S )Nr    rm   rn   ro   rp   rq   rt   rr   r5   ru   )rO   r   )
r   r9   r:   r;   r   mplr8   subplotsrc   axes)rD   rG   _r   r}   ax_axess         r   test_boxplot_legacy2_with_axz/TestDataFramePlots.test_boxplot_legacy2_with_axd   s    I!!!$$++G44vv>N
 
 
 KKKLL3#$$3 
##%%2zz&SRz00'$r   c                    t          t          j                            d                              d          ddg          }t	          g d          |d<   t	          dgd	z            |d
<   t
          j                                        \  }}|                    d
          	                    |d          }|j
        }||d         u sJ d S )Nr    rm   rn   ro   rp   rq   rt   rr   r5   ru   r}   r   rI   )r   r9   r:   r;   r   r{   r8   r|   groupbyrc   r}   )rD   rG   figr   r}   r   s         r   (test_boxplot_legacy2_with_ax_return_typez;TestDataFramePlots.test_boxplot_legacy2_with_ax_return_typeq   s    I!!!$$++G44vv>N
 
 
 KKKLL3#$$3*%%''Rzz#&&"&&AA'$s)######r   c                    t          t          j                            d                              d          ddg          }t	          g d          |d<   t	          dgd	z            |d
<   t
          j                                        \  }}t          j	        t                    5  |                    ddgd|d          }d d d            n# 1 swxY w Y   |d                                         |u sJ d S )Nr    rm   rn   ro   rp   rq   rt   rr   r5   ru   r}   )rK   rO   r   rI   )r   r9   r:   r;   r   r{   r8   r|   ra   rb   rw   rc   
get_figure)rD   rG   r   r   r}   s        r   #test_boxplot_legacy2_with_multi_colz6TestDataFramePlots.test_boxplot_legacy2_with_multi_col|   s;   I!!!$$++G44vv>N
 
 
 KKKLL3#$$3*%%''R'44 	 	::'CBF   D	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 F|&&((C//////s   (CCCc                 4   t          t          j                            d                              d          ddg          }t	          g d          |d<   t	          dgd	z            |d
<   t
          j                                        \  }}|                    |d          }t          t          j                            |                                                    }t          |                                          t          |          k    sJ d S )Nr    rm   rn   ro   rp   rq   rt   rr   r5   ru   rJ   r   )r   r9   r:   r;   r   r{   r8   r|   rc   rC   	itertoolschainfrom_iterablevalueslen	get_lines)rD   rG   r~   r   dliness         r   test_boxplot_legacy2_by_nonez/TestDataFramePlots.test_boxplot_legacy2_by_none   s    I!!!$$++G44vv>N
 
 
 KKKLL3#$$3 
##%%2JJ"&J11Y_22188::>>??2<<>>""c%jj000000r   c                 p    |                                 }t          |t          j        j                  sJ d S r   )rc   
isinstancer{   r8   Axes)rD   hist_dfresults      r   test_boxplot_return_type_nonez0TestDataFramePlots.test_boxplot_return_type_none   s1    ""&#*/2222222r   c                    t          t          j                            d                              d          t          t          j        d d                   g d          }d}t          j	        t          |          5  |                    d	           d d d            n# 1 swxY w Y   |                                }t          |d
           d S )Nr    rS   rT   rV   rY   z,return_type must be {'axes', 'dict', 'both'}match
NOT_A_TYPErI   r}   )r   r9   r:   r;   r^   rC   r_   r`   pytestraises
ValueErrorrc   r
   )rD   rG   msgr   s       r   test_boxplot_return_type_legacyz2TestDataFramePlots.test_boxplot_return_type_legacy   s    I!!!$$44V<<v+BQB/00333
 
 

 =]:S111 	1 	1JJ<J000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 vv.....s   B$$B(+B(rJ   r}   bothc                 p   t          t          j                            d                              d          t          t          j        d d                   g d          }t          j	        d          5  |
                    |          }d d d            n# 1 swxY w Y   t          ||           d S )Nr    rS   rT   rV   rY   Fr   )r   r9   r:   r;   r^   rC   r_   r`   ra   rb   rc   r
   )rD   rI   rG   r   s       r   +test_boxplot_return_type_legacy_return_typez>TestDataFramePlots.test_boxplot_return_type_legacy_return_type   s     I!!!$$44V<<v+BQB/00333
 
 

 '.. 	9 	9ZZKZ88F	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9 	9v{33333s   8BB"Bc                 \   |                                 }t          j                            d                              dd|j        d                   |d<   |                    ddgd	          \  }}t          |d         |           t          |d         |           |j        |k    sJ d S )
Nr    r!      r   ageheightweightcategoryrv   	copyr9   r:   r;   integersshaperc   r   _sharey)rD   r   rG   	height_ax	weight_axs        r   test_boxplot_axis_limitsz+TestDataFramePlots.test_boxplot_axis_limits   s    \\^^I))!,,55aRXa[II5	!zz8X*>:zNN	9Hy111Hy111 I------r   c                    |                                 }t          j                            d                              dd|j        d                   |d<   |                    g dd          }|d	         |d
         |d         }}}|d         }t          |d         |           t          |d         |           t          |d         |           |j        |k    sJ |j        |k    sJ |j        J d S )Nr    r!   r   r   r   )r   r   r   r   rv   )r   r   )r   r!   )r!   r   r!   r!   r   r   r   )rD   r   rG   pr   r   age_axdummy_axs           r   !test_boxplot_axis_limits_two_rowsz4TestDataFramePlots.test_boxplot_axis_limits_two_rows   s    \\^^I))!,,55aRXa[II5	JJ222zJBB'(w$4f9	T7Hy111Hy111EF+++ I----~****'''''r   c                     t          t          j                            d                              d                    }t          j        |j        d d df<   t          |j        d           d S )Nr    )r   rU   r   r}   r   )	r   r9   r:   r;   r^   nanlocr   rc   rx   s     r   test_boxplot_empty_columnz,TestDataFramePlots.test_boxplot_empty_column   s]    ry,,Q//??HHIIvqqq!t"*&999999r   c                    t          t          j                            d                              d          g d          }|                    dd          }|j        j        j        dk    sJ |j        j        j        d	k    sJ d S )
Nr    )r5      )rr   rs   CDErp   r}   )      )rI   figsizer   r   )	r   r9   r:   r;   rc   figurebbox_incheswidthr   )rD   rG   r   s      r   test_figsizezTestDataFramePlots.test_figsize   s    I!!!$$++G44>W>W>W
 
 
 @@}(."4444}(/1444444r   c                 z    t          dg di          }t          |                    dd          dd           d S )Nar!   r    r"   rU   r   rT      )fontsize
xlabelsize
ylabelsizer   r   rc   rx   s     r   test_fontsizez TestDataFramePlots.test_fontsize   sG    ///0112::cB:77BSUVVVVVVr   c                    t          t          dd          t          j                            d                              d          t          j                            d                              d          dz   t          dd                              t                    t          ddd          t          dd          d          }|	                    d	
          }d |
                                D             ddgk    sJ d S )Nz
2012-01-01d   )periodsr    UTC)r   tzz1 days)r   bcr   efbox)r)   c                 6    g | ]}|                                 S r,   r/   r0   s     r   r3   z@TestDataFramePlots.test_boxplot_numeric_data.<locals>.<listcomp>   s     ;;;

;;;r   r   r   )r   r   r9   r:   r;   r^   astypestrr   r>   r?   )rD   rG   r   s      r   test_boxplot_numeric_dataz,TestDataFramePlots.test_boxplot_numeric_data   s    c:::Y**1--==cBBY**1--==cBBQFc:::AA#FFceDDD$Xs;;; 	
 	
 WW%W  ;;b&8&8&:&:;;;SzIIIIIIr   zcolors_kwd, expectedrr   gr   )boxeswhiskersmedianscapsr   c                 2   t          t          j                            d                              d                    }|                    |d          }|                                D ]+\  }}||         d                                         |k    sJ ,d S )Nr    rm   rJ   colorrI   r   )r   r9   r:   r;   rc   items	get_color)rD   
colors_kwdexpectedrG   r   kvs          r   test_color_kwdz!TestDataFramePlots.test_color_kwd   s     ry,,Q//66w??@@*&AANN$$ 	1 	1DAq!9Q<))++q00000	1 	1r   zscheme,expecteddark_backgroundz#8dd3c7z#bfbbd9defaultz#1f77b4z#2ca02cc                 z   t          t          j                            d                              d                    }dd lm} |j                            |           |j        	                    d          }|
                                D ]+\  }}||         d                                         |k    sJ ,d S )Nr    rm   r   rJ   r   )r   r9   r:   r;   r7   r8   styleuser>   r   r   r   )rD   schemer   rG   rE   r   r   r   s           r   test_colors_in_themez'TestDataFramePlots.test_colors_in_theme  s    2 ry,,Q//66w??@@''''''	f00NN$$ 	1 	1DAq!9Q<))++q00000	1 	1r   zdict_colors, msg)r   invalid_keyzinvalid key 'invalid_key'c                    t          t          j                            d                              d                    }t	          j        t          |          5  |                    |d           d d d            d S # 1 swxY w Y   d S )Nr    rm   r   rJ   r   )r   r9   r:   r;   r   r   r   rc   )rD   dict_colorsr   rG   s       r   test_color_kwd_errorsz(TestDataFramePlots.test_color_kwd_errors#  s     ry,,Q//66w??@@]:S111 	> 	>JJ[fJ===	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	> 	>s   B  BBzprops, expected))boxpropsr   )whiskerpropsr   )cappropsr   )medianpropsr   c                     t          d dD                       }|ddii} |j        dddi|}||         d                                         dk    sJ d S )	Nc                 t    i | ]5}|t           j                            d                               d          6S )r    r5   )r9   r:   r;   )r1   r   s     r   
<dictcomp>z?TestDataFramePlots.test_specified_props_kwd.<locals>.<dictcomp>8  s8    NNN1290033::2>>NNNr   ABCr   C1rI   rJ   r   r,   )r   rc   r   )rD   propsr   rG   kwdr   s         r   test_specified_props_kwdz+TestDataFramePlots.test_specified_props_kwd-  sw     NNNNNOOwo&666#66h",,..$666666r   vertTFc                    t          t          j                            d                              d          t          j                            d                              d          t          j                            d                              ddgd          d          }d\  }}|                    d|||          }|                                |k    sJ |                                |k    sJ d S )	Nr    r5   group1group2r   r   groupr2   yr   )r)   r  xlabelylabel)	r   r9   r:   r;   r^   r<   r>   
get_xlabel
get_ylabelrD   r  rG   r  r  r   s         r   test_plot_xlabel_ylabelz*TestDataFramePlots.test_plot_xlabel_ylabel>  s    Y**1--==bAAY**1--==bAA..q1188(H9MrRR 
 
 "WW%d6&WII}}&((((}}&((((((r   c                    t           j                            d          }t          |                    ddd          t          d                    }t          |                    ddd          t          d                    }d\  }}t                              dd	d
          \  }}|j        	                    |d         |||           |j        	                    |d         |||           |D ]6}	|	
                                |k    sJ |	                                |k    sJ 7t          j                                         d S )Nr    r   r   )r   rU   sizeABCDrp   r  )r5      T)ncolsr   sharey)r   r  r  r  r!   )r9   r:   r;   r   r   rC   rE   r|   r>   r   r  r  r{   r8   close)
rD   r  rngdf1df2r  r  r~   axsr   s
             r   test_plot_boxz TestDataFramePlots.test_plot_boxL  s/    i##A&&Q(;;T&\\RRRQ(;;T&\\RRR!AwtDD3AT&HHHAT&HHH 	- 	-B==??f,,,,==??f,,,,,
r   c                    t          t          j                            d                              d          t          j                            d                              d          t          j                            d                              ddgd          d          }d\  }}|                    |||          }|                                |k    sJ |                                |k    sJ d S )Nr    r5   r  r  r  r  )r  r  r  )	r   r9   r:   r;   r^   r<   rc   r  r  r  s         r   test_boxplot_xlabel_ylabelz-TestDataFramePlots.test_boxplot_xlabel_ylabel\  s    Y**1--==bAAY**1--==bAA..q1188(H9MrRR 
 
 "ZZT&Z@@}}&((((}}&((((((r   c                 <   t          t          j                            d                              d          t          j                            d                              d          t          j                            d                              ddgd          d          }d\  }}|                    d|||          }|D ]6}|                                |k    sJ |                                |k    sJ 7t          j
                                         d S )	Nr    r5   r  r  r  r  r  )rO   r  r  r  )r   r9   r:   r;   r^   r<   rc   r  r  r{   r8   r   )rD   r  rG   r  r  r   subplots          r    test_boxplot_group_xlabel_ylabelz3TestDataFramePlots.test_boxplot_group_xlabel_ylabelj  s   Y**1--==bAAY**1--==bAA..q1188(H9MrRR 
 
 "ZZ7fVZLL 	2 	2G%%''61111%%''611111
r   c                 F   t          t          j                            d                              d          t          j                            d                              d          t          j                            d                              ddgd          d          }|                    d|          }|D ]B}|r|                                n|                                }|t          dg          k    sJ Ct          j                                         d S )Nr    r5   r  r  r  r  )rO   r  )r   r9   r:   r;   r^   r<   rc   r  r  r   r{   r8   r   )rD   r  rG   r   r)  target_labels         r   #test_boxplot_group_no_xlabel_ylabelz6TestDataFramePlots.test_boxplot_group_no_xlabel_ylabelz  s
   Y**1--==bAAY**1--==bAA..q1188(H9MrRR 
 
 ZZ7Z.. 	; 	;G37Q7--///W=O=O=Q=QL<	#:#::::::
r   )"__name__
__module____qualname__rH   r   markslowparametrizerw   rf   rk   ry   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r
  r  r%  r'  r*  r-  r,   r   r   r   r   &   s}       
 
 
* [[V$d+'.g66D':;;TBG_k*Wh'(+6q\4 a((+6		
 4 4  4P P P2 2 2  	$ 	$ 	$0 0 01 1 13 3 3
/ / / [],D,D,DEE
4 
4 FE
4. . .( ( (: : :
5 5 5W W WJ J J [ 33LL33LL s^gs^,CSS#NNO	

 
1 1
 
1 [ "& )(%	  & )(%	 	
 .1 1/ .1 [
,
,.I	JK > >	 > [	
 	
 	
 7 7 7 [VdE]33) ) 43) [VdE]33  43 [VdE]33) ) 43) [VdE]33  43 [VdE]33  43  r   r   c            
          e Zd Zd Zd Zej        j        d             Zej        j        d             Z	ej        
                    ddeddgg d	g          d
             Zd Zd Zej        j        d             Zej        j        d             Zej        j        ej        
                    dg d          d                         Zej        j        ej        
                    dg d          d                         Zej        j        d             Zej        j        d             Zej        j        d             Zej        j        ej        
                    dg dg dg dg          d                         Zej        j        ej        
                    dddgddgddgg          d                          Zej        j        d!             Zej        j        ej        
                    d"d#d$g          d%                         Zej        j        ej        
                    d&d'd'gd$dgg          d(                         Zej        j        ej        
                    d)d'd'gd$dgg          d*                         Zej        j        d+             Zej        j        d,             Zej        j        d-             Zd. Zej        
                    d/d0g d1fd0gg d1fd2g d3fd0d2gg d4fd5g d4fg          d6             Z d7 Z!d8 Z"d5S )9TestDataFrameGroupByPlotsc                    |                     d          }t          j        t          d          5  t	          |j        d          }d d d            n# 1 swxY w Y   t          t          |j                  dd	           d S )
Ngenderrv   Fr\   r}   r   r    )r!   r    axes_numlayout)	r   ra   rb   rw   r   rc   r	   rC   r   rD   r   groupedr}   s       r   rf   z.TestDataFrameGroupByPlots.test_boxplot_legacy1  s    //X/..'eLLL 	J 	J$W_&IIID	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J$t{++aGGGGGGs   AAAc                     |                     d          }t          |j        dd          }t          |dd           d S )	Nr7  rv   Fr}   r|   rI   r!   r   r8  )r   r   rc   r	   r;  s       r    test_boxplot_legacy1_return_typez:TestDataFrameGroupByPlots.test_boxplot_legacy1_return_type  sF    //X/.. 5fUUU$6::::::r   c                    t          t          j        d d         t          d                    }t	          t
          j                            d                              d          t          j	        |                    }|
                    d          }t          j        t          d          5  t          |j        d	
          }d d d            n# 1 swxY w Y   t!          t#          |j                  dd           d S )Nr5   r    r5   r"   r&   r!   levelFr\   r}   r   )rU   r"   r8  )zipr_   r`   ranger   r9   r:   r;   r   from_tuplesr   ra   rb   rw   r   rc   r	   rC   r   rD   tuplesrG   r<  r}   s        r   ry   z.TestDataFrameGroupByPlots.test_boxplot_legacy2  s0   V)#2#.b		::I!!!$$++G44(00
 
 
 **1*%%'eLLL 	J 	J$W_&IIID	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J$t{++bHHHHHHs   4CCCc                    t          t          j        d d         t          d                    }t	          t
          j                            d                              d          t          j	        |                    }|
                    d          }t          |j        dd	          }t          |dd
           d S )Nr5   r    rA  r&   r!   rB  Fr}   r>  r   r8  )rD  r_   r`   rE  r   r9   r:   r;   r   rF  r   r   rc   r	   rG  s        r    test_boxplot_legacy2_return_typez:TestDataFrameGroupByPlots.test_boxplot_legacy2_return_type  s    V)#2#.b		::I!!!$$++G44(00
 
 
 **1*%% 5fUUU$6::::::r   z subplots, warn, axes_num, layoutTr"   r    r    )FNr!   r   c                 x   t          t          j        d d         t          d                    }t	          t
          j                            d                              d          t          j	        |                    }d}t          j        t          |          5  |                    d                              d	d
          }d d d            n# 1 swxY w Y   t          j        |d          5  t          |j        |d          }	d d d            n# 1 swxY w Y   t#          |	||           d S )Nr5   r    rA  r&   z+DataFrame.groupby with axis=1 is deprecatedr   r!   rB  r   )rC  axisFr\   r}   r>  r8  )rD  r_   r`   rE  r   r9   r:   r;   r   rF  ra   rb   FutureWarningunstackr   r   rc   r	   )
rD   r|   re   r9  r:  rH  rG   r   r<  r}   s
             r   test_boxplot_legacy3z.TestDataFrameGroupByPlots.test_boxplot_legacy3  s   
 V)#2#.b		::I!!!$$++G44(00
 
 
 <'SAAA 	C 	Cjjqj))111BBG	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C 	C'uEEE 	 	$(  D	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	$&AAAAAAs$    ,CCC9DD!$D!c                 n   d}t          t          j                            d                              dd|                    }t          t          j                            d                              dd|                    }t          j                            d                              ddg|          }t          |||d	          }|                    d
          }|                                }t          t          j                                                  dk    sJ t          |          dk    sJ t                              d           |                    d          }t          t          j                                                  dk    sJ t          |          dk    sJ d S )Nr5   r       r   r  <   malefemaler   r   r7  r7  allr}   r   r!   )r   r9   r:   r;   normalr<   r   r   r>   r   r{   r8   get_fignumsrE   r   rc   )rD   rF   r   r   r7  rG   gbress           r   test_grouped_plot_fignumsz3TestDataFrameGroupByPlots.test_grouped_plot_fignums  sj   	--a0077Ra7HHII	--a0077BQ7GGHH&&q))00&(1C!0LL&FfMMNNZZ!!ggii3:))++,,11113xx1}}}}		%jjVj,,3:))++,,11113xx1}}}}}}r   c                    d}t          t          j                            d                              dd|                    }t          t          j                            d                              dd|                    }t          j                            d                              ddg|          }t          |||d	          }|                    d
                                           d S )Nr5   r    rR  r   r  rS  rT  rU  rV  r7  )	r   r9   r:   r;   rX  r<   r   r   hist)rD   rF   r   r   r7  rG   s         r   &test_grouped_plot_fignums_excluded_colz@TestDataFrameGroupByPlots.test_grouped_plot_fignums_excluded_col  s    	--a0077Ra7HHII	--a0077BQ7GGHH&&q))00&(1C!0LL&FfMMNN


8!!#####r   c                     |}|                     d          }t          |t          j                  sJ t	          |d g d           d S )Nr7  rv   r   r   r   expected_keys)rc   r   r9   ndarrayr
   rD   r   rG   r   s       r   test_grouped_box_return_typez6TestDataFrameGroupByPlots.test_grouped_box_return_type  sc     x((&"*-----D(H(H(H	
 	
 	
 	
 	
 	
r   c                     |}|                     d                              d          }t          |dddg           d S )Nr7  rJ   r   MaleFemalerb  r   rc   r
   re  s       r   $test_grouped_box_return_type_groupbyz>TestDataFrameGroupByPlots.test_grouped_box_return_type_groupby  sI    H%%--&-AAvvfh=OPPPPPPr   rI   r   c                     |}|                     d                              |          }t          ||g d           |                    d|          }t          ||g d           d S )N	classroomr   rr   rs   r   rb  rO   rI   ra  rj  )rD   r   rI   rG   returneds        r    test_grouped_box_return_type_argz:TestDataFrameGroupByPlots.test_grouped_box_return_type_arg  s     ::k**22{2KKxOOOTTTT::+:FFk1Q1Q1Q	
 	
 	
 	
 	
 	
r   c                    d                                 }t          t          j                            d                              d          |          }d                                 }|dz  |d<   |                    d                              |          }t          |||	           |                    d|
          }t          |||	           d S )Nz	X B C D Ar    )rT   r   rp   zA Br"   r   r   rb  ro  )	splitr   r9   r:   r;   r^   r   rc   r
   )rD   rI   columns2r#  categories2rp  s         r   .test_grouped_box_return_type_arg_duplcate_catszHTestDataFrameGroupByPlots.test_grouped_box_return_type_arg_duplcate_cats  s     $$&&I!!!$$44V<<h
 
 
 kkmm%/J;;z**22{2KKxKPPPP;;*+;FFxHMMMMMMr   c                     |}d}t          j        t          |          5  |                    ddg|j        d           d d d            d S # 1 swxY w Y   d S )Nz1Layout of 1x1 must be larger than required size 2r   r   r   r   rK   rO   r:  r   r   r   rc   r7  rD   r   rG   r   s       r   !test_grouped_box_layout_too_smallz;TestDataFrameGroupByPlots.test_grouped_box_layout_too_small	  s    A]:S111 	Q 	QJJx2ryJPPP	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q 	Q    AAAc                     |}d}t          j        t          |          5  |                    g ddd           d d d            d S # 1 swxY w Y   d S )Nz7The 'layout' keyword is not supported when 'by' is Noner   ra  )r    r!   rJ   rK   r:  rI   )r   r   r   rc   rz  s       r    test_grouped_box_layout_needs_byz:TestDataFrameGroupByPlots.test_grouped_box_layout_needs_by  s    G]:S111 	 	JJ777"    	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAc                     |}d}t          j        t          |          5  |                    ddg|j        d           d d d            d S # 1 swxY w Y   d S )Nz1At least one dimension of layout must be positiver   r   r   )r  rx  ry  rz  s       r   'test_grouped_box_layout_positive_layoutzATestDataFrameGroupByPlots.test_grouped_box_layout_positive_layout  s    A]:S111 	S 	SJJx2ryJRRR	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	S 	Sr|  zgb_key, axes_num, rows)r7  r    r!   )r   rU   r    )rm  r"   r    c                 .   |}t          j        t          d          5  t          |                    |          j        dd           d d d            n# 1 swxY w Y   t          t          j        	                                j
        ||df           d S )NFr\   r   rJ   rK   rI   r    r8  ra   rb   rw   r   r   rc   r	   r{   r8   gcfr}   )rD   r   gb_keyr9  rowsrG   s         r   ,test_grouped_box_layout_positive_layout_axeszFTestDataFrameGroupByPlots.test_grouped_box_layout_positive_layout_axes#  s     'eLLL 	 	

6""*8   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	#*..**/(DRS9UUUUUUs   +AAAzcol, visibler   Fr   r   c                 L   |}|                     g ddd          }t          t          j                                        j        dd           ||         }t          |                                |           t          |j        	                                g|           d S )	Nra  r7  r}   )rK   rO   rI   r"   rK  r8  )visible)
rc   r	   r{   r8   r  r}   r   r?   xaxis	get_label)rD   r   r   r  rG   r}   r   s          r   test_grouped_box_layout_visiblez9TestDataFrameGroupByPlots.test_grouped_box_layout_visible3  s    
 zz333f  
 
 	#*..**/!FKKKK#Yr))++W====**,,-w??????r   c                     |}|                     d                              g dd           t          t          j                                        j        dd           d S )Nrm  ra  rJ   r  r"   rK  r8  r   rc   r	   r{   r8   r  r}   )rD   r   rG   s      r   test_grouped_box_layout_shapez7TestDataFrameGroupByPlots.test_grouped_box_layout_shapeB  sg    


;''333 	( 	
 	
 	
 	#*..**/!FKKKKKKr   colsr    r  c                 0   |}t          j        t          d          5  t          |                    d          j        dd|fd           d d d            n# 1 swxY w Y   t          t          j        	                                j
        dd	
           d S )NFr\   r   r   r"   rJ   r~  rU   )r"   r    r8  r  )rD   r   r  rG   s       r   test_grouped_box_layout_worksz7TestDataFrameGroupByPlots.test_grouped_box_layout_worksJ  s     'eLLL 	 	

:&&.4y"	   	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	#*..**/!FKKKKKKs   .AAAz	rows, resrU   c                     |}|                     g dd|df           t          t          j                                        j        d|df           d S )Nra  r7  r!   rx  r"   r8  )rc   r	   r{   r8   r  r}   )rD   r   r  r[  rG   s        r   'test_grouped_box_layout_axes_shape_rowszATestDataFrameGroupByPlots.test_grouped_box_layout_axes_shape_rowsW  sf     


333$PQ 	 	
 	
 	
 	#*..**/!S!HMMMMMMr   z	cols, resc                     |}|                     d                              g dd|fd           t          t          j                                        j        dd|f           d S )Nrm  ra  r!   rJ   r~  r"   r8  r  )rD   r   r  r[  rG   s        r   /test_grouped_box_layout_axes_shape_cols_groupbyzITestDataFrameGroupByPlots.test_grouped_box_layout_axes_shape_cols_groupby`  su     


;''333t9 	( 	
 	
 	

 	#*..**/!QHMMMMMMr   c                 p   |}t          j        t                    5  t          j                            dd          \  }}|                    d                              dd|           t          t          j        	                                j
        dd           d d d            d S # 1 swxY w Y   d S )	Nr    r   r   r}   rK   rI   r   rU   rK  r8  )ra   rb   rw   r{   r8   r|   r   rc   r	   r  r}   )rD   r   rG   r~   r}   s        r   test_grouped_box_multiple_axesz8TestDataFrameGroupByPlots.test_grouped_box_multiple_axesk  s      '44 	P 	Pj))!Q//GAtJJz""**(SW*XXXcjnn..3aOOOO	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	Ps   BB++B/2B/c                 L   |}t           j                            dd          \  }}t          j        t
                    5  |                    g ddd|d                   }d d d            n# 1 swxY w Y   t          j        t          |j
                            }t          |dd	           t          j        ||d                    |d         j        |u sJ t          j        t
                    5  |                    d
                              g dd|d                   }d d d            n# 1 swxY w Y   t          j        t          |j
                            }t          |dd	           t          j        ||d                    |d         j        |u sJ d S )Nr    r"   ra  r7  r}   r   )rK   rO   rI   r   )r!   r"   r8  rm  r!   r  )r{   r8   r|   ra   rb   rw   rc   r9   arrayrC   r   r	   assert_numpy_array_equalr   r   )rD   r   rG   r   r}   rp  s         r   %test_grouped_box_multiple_axes_on_figz?TestDataFrameGroupByPlots.test_grouped_box_multiple_axes_on_figz  s    J''1--	T'44 	 	zz777"7	 "  H	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 8D1122(Qv>>>>
#Hd1g666{!S(((( '44 	 	zz+..66777VPTUVPW 7  H	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 8D1122(Qv>>>>
#Hd1g666{!S((((((s#   "A--A14A154D55D9<D9c                 p   |}d}t          j        t          |          5  t          j                            dd          \  }}t          j        t                    5  |	                    d          
                    |          }d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nz@The number of passed axes must be 3, the same as the output plotr   r    r"   rm  )r   )r   r   r   r{   r8   r|   ra   rb   rw   r   rc   )rD   r   rG   r   r   r}   s         r   'test_grouped_box_multiple_axes_ax_errorzATestDataFrameGroupByPlots.test_grouped_box_multiple_axes_ax_error  sO    P]:S111 	@ 	@
++Aq11IC+K88 @ @zz+..66$6??@ @ @ @ @ @ @ @ @ @ @ @ @ @ @	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s5   =B+*BB+B	B+B	B++B/2B/c                     t          g dg dd          }t          |                    ddd          dd           d S )	Nr   )r   r   r   r!   r!   r!   )r   r   r   r   r   )rO   r   r   r   rx   s     r   r   z'TestDataFrameGroupByPlots.test_fontsize  s_    ///6H6H6HIIJJJJssRJ00RB	
 	
 	
 	
 	
 	
r   zcol, expected_xticklabelr   )(a, v)(b, v)(c, v)(d, v)(e, v)v1)(a, v1)(b, v1)(c, v1)(d, v1)(e, v1))
r  r  r  r  r  r  r  r  r  r  Nc                    t          t          j                            d                              t          d          d          t          j                            d                              d          t          j                            d                              d          d          }|                    d          }t          |j        d|d          }d	 |	                                D             }||k    sJ d S )
Nr    abcder   )catr   r  r  Fr}   )r|   rK   rI   c                 6    g | ]}|                                 S r,   r   r0   s     r   r3   zQTestDataFrameGroupByPlots.test_groupby_boxplot_subplots_false.<locals>.<listcomp>       JJJaQZZ\\JJJr   )
r   r9   r:   r;   r<   rC   r   r   rc   r?   )rD   r   expected_xticklabelrG   r<  r}   result_xticklabels          r   #test_groupby_boxplot_subplots_falsez=TestDataFrameGroupByPlots.test_groupby_boxplot_subplots_false  s    P y,,Q//66tG}}cJJY**1--44S99i++A..55c:: 
 
 **U## OeCV
 
 
 KJ43G3G3I3IJJJ"&7777777r   c                     |                     d          }|                    d          }d}t          j        t          |          5  t          |j        d           d d d            d S # 1 swxY w Y   d S )Nobjectr7  z:boxplot method requires numerical columns, nothing to plotr   F)r|   )r   r   r   r   r   r   rc   )rD   r   rG   r<  r   s        r   test_groupby_boxplot_objectz5TestDataFrameGroupByPlots.test_groupby_boxplot_object  s    ^^H%%**X&&J]:S111 	? 	?go>>>>	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	? 	?s   A,,A03A0c                    g dg dg}t          t          |           }t          j        |ddg          }t	          t
          j                            d                              d          g d|	          }d
dg}t          |j
        |d          }ddg}d |                                D             }||k    sJ d S )N)r(   r(   bazr  r[   r[   quxr  )rL   rM   rL   rM   rL   rM   rL   rM   firstsecond)namesr    )r"   r   rn  rY   )r(   rL   )r(   rM   r}   r  z
(bar, one)z
(bar, two)c                 6    g | ]}|                                 S r,   r   r0   s     r   r3   zLTestDataFrameGroupByPlots.test_boxplot_multiindex_column.<locals>.<listcomp>  r  r   )rC   rD  r   rF  r   r9   r:   r;   r^   r   rc   r?   )	rD   arraysrH  r'   rG   r   r}   r  r  s	            r   test_boxplot_multiindex_columnz8TestDataFrameGroupByPlots.test_boxplot_multiindex_column  s     EDDDDD
 c6l##&vgx5HIIII!!!$$44V<<!//
 
 
 ~. CVLLL+\:JJ43G3G3I3IJJJ"&7777777r   )#r.  r/  r0  rf   r?  r   r1  r2  ry   rJ  r3  rw   rP  r\  r_  rf  rk  rq  rv  r{  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r  r,   r   r   r5  r5    s       H H H; ; ;
 [	I 	I 	I [; ; ; [*
Q	')A)A)AB B B	 B  "$ $ $ [
 
 
 [Q Q Q [[],D,D,DEE	
 	
 FE 	
 [[],D,D,DEEN N FE N [Q Q Q [   [S S S [[ 			---/B/B/BC 	V 	V	  
	V [[(E*Xt,<z4>PQ 	@ 	@  	@ [L L L [[VaW--	L 	L .- 	L [[[Aq6B7*;<<N N =< N [[[Aq6B7*;<<N N =< N [P P P [) ) )4 [@ @ @
 
 
 ["DDDEUFFFGJJJKd      '"	
% %L8 8M% %L8$? ? ?8 8 8 8 8r   r5  )__doc__r   r_   numpyr9   r   pandasr   r   r   r   r   r   pandas._testing_testingra   pandas.tests.plotting.commonr	   r
   r   r   r   pandas.io.formats.printingr   importorskipr{   rE   r   r   r5  r,   r   r   <module>r     s   & &                                             4 3 3 3 3 3f,''f-..  a a a a a a a aHo8 o8 o8 o8 o8 o8 o8 o8 o8 o8r   