
    o[we                        d Z ddlmZmZmZmZ ddlZddlZddlZddl	m
Z
mZ ddlmZ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 ddlmZmZmZ ddlm Z  dd	l!m"Z" dd
l#m$Z$  ej%        d          Z& G d d          Z'ddZ(dS )z< Test cases for time series specific (freq conversion, etc)     )datedatetimetime	timedeltaN)
BaseOffset	to_offset)	DataFrameIndexNaTSeriesconcatisnato_datetime)DatetimeIndexbdate_range
date_range)PeriodPeriodIndexperiod_range)timedelta_range)_check_ticks_props)WeekOfMonth
matplotlibc            
          e Zd Zej                            d          d             Zd Zd Zd Z	d Z
d Zd Zej                            d	g d
          d             Zej                            d	g d          d             Zd Zd Zej                            d	ddg          d             Zd Zd Zej                            d	g d
          d             Zej                            dg d          d             Zej                            d	g d          d             Zej                            d	g d
          d             Zej                            dg d          d             Zej                            d          ej                            d	g d          d                         Zej                            d	g d          d             Zd Zd  Zd! Zd" Zej                             d#$          d%             Z!d& Z"d' Z#d( Z$d) Z%d* Z&d+ Z'd, Z(d- Z)ej                            d.          ej                            d/ e*j+                     e, e*j+                     e*j+                    d0z   d1          g          d2                         Z-d3 Z.d4 Z/d5 Z0d6 Z1d7 Z2d8 Z3ej        j4        d9             Z5d: Z6d; Z7d< Z8d= Z9d> Z:d? Z;d@ Z<dA Z=dB Z>dC Z?dD Z@dE ZAdF ZBdG ZCdH ZDdI ZEdJ ZFdK ZGdL ZHdM ZIdN ZJdO ZKdP ZLej                            d          dQ             ZMdR ZNdS ZOej                             dT$          dU             ZPdV ZQdW ZRdX ZSej                            dYdZd[g          d\             ZTej                            dYdZd[g          d]             ZUd^ ZVd_ ZWd` ZXda ZYdb ZZdc Z[dd Z\de Z]df Z^dg Z_dh Z`di Zadj Zbdk Zcdl Zdej                             d#$          dm             Zedn Zfdo Zgdp Zhdq Zidr Zjds Zkdt Zldu Zmdv Zndw Zodx Zpdy Zqdz Zrd{ Zsd| Ztej                             d}$          d~             Zud Zvd Zwd Zxd Zyd ZzdS )
TestTSPlotzignore::UserWarningc                    |}t          ddd|          }t          ddg|          }t          |j                   |                                }t	          t          |                                                                                    }|d         j        |d         j	        fd	k    sJ |d
         j        |d
         j	        fdk    sJ d S )N1/1/2011   H)periodsfreqtzg     g@g     t@indexr   r   r   )   r   )
r   r   _check_plot_worksplotnextiter	get_lines	get_xdatahourminute)selftz_aware_fixturer"   r$   tsaxxdatas          Glib/python3.11/site-packages/pandas/tests/plotting/test_datetimelike.pytest_ts_plot_with_tzzTestTSPlot.test_ts_plot_with_tz/   s     :qsrBBBUFO5111"'"""WWYYT",,..))**4466auQx/69999b	b	 01V;;;;;;    c                    t          t          j                            d                              d          t          d                    }t          j                                        \  }}|	                    d|           |
                                |                                z   D ]}|                                dk    sJ d S )Nr   )
   	   r9   r#   fontsizer3   )r	   nprandomdefault_rngstandard_normalrangemplpyplotsubplotsr)   get_xticklabelsget_yticklabelsget_fontsize)r0   df_r3   labels        r5   test_fontsize_set_correctlyz&TestTSPlot.test_fontsize_set_correctly<   s    I!!!$$44W==U2YY
 
 
 
##%%2
r"""''))B,>,>,@,@@ 	- 	-E%%''1,,,,,	- 	-r7   c                 0   t          ddd          }t          |j        d           }t          t          j                            d                              t          |          df          |          }t          |j
                   |d	d
                             |dd                   }t          t          j                            d                              t          |          df          |          }t          |j
                   d S )N1/1/1987MSd   r!   r    r!   r      r#   r   (   -   c   )r   r   valuesr	   r=   r>   r?   r@   lenr(   r)   union)r0   idxrH   df2s       r5   test_frame_inferredzTestTSPlot.test_frame_inferredF   s    $<<<CJT222I!!!$$44c#hh]CC3
 
 
 	"'""" !B$iooc"R%j))I!!!$$44c#hh]CC3
 
 
 	#(#####r7   c                    t          ddd          }t          |j        d           }t          t          j                            d                              t          |          df          |          }t          |j
                   d S )	Nz2008-1-1 00:15:0015Tr9   rP   rQ   r   rR   r#   )r   r   rV   r	   r=   r>   r?   r@   rW   r(   r)   r0   rY   rH   s      r5   test_frame_inferred_n_gt_1z%TestTSPlot.test_frame_inferred_n_gt_1W   s    ,5"EEECJT222I!!!$$44c#hh]CC3
 
 
 	"'"""""r7   c                     t          j        g d          }t          ||          }t          |j        |           t          |j        |           d S )Nr'   r   rR   r#   )xerr)yerr)r=   arrayr	   r(   r)   )r0   ias      r5   test_is_error_nozeroindexz$TestTSPlot.test_is_error_nozeroindex`   sW    HYYYaq!!!!&q))))!&q))))))r7   c                 R   t          ddd          }t          g dg dd|          }t          j                                        \  }}|                    |           t          |                                          d	k    sJ t          j                            |           d S )
NrM   ArR   rP   xyzra   ri   Br3   r'   )	r   r	   rB   rC   rD   r)   rW   r,   close)r0   rY   rH   figr3   s        r5   test_nonnumeric_excludez"TestTSPlot.test_nonnumeric_excludeg   s    #q999___999==sCC*%%''R
22<<>>""a''''
r7   c                     t          ddd          }t          g dg dd|          }d}t          j        t          |	          5  |d                                          d d d            d S # 1 swxY w Y   d S )
NrM   ri   rR   rP   rj   ra   rn   zno numeric data to plotmatch)r   r	   pytestraises	TypeErrorr)   )r0   rY   rH   msgs       r5   test_nonnumeric_exclude_errorz(TestTSPlot.test_nonnumeric_exclude_errorp   s    #q999___999==sCC']9C000 	 	sGLLNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A//A36A3r!   )STr   DWMQri   c                 2   t          d|d          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}t          |j        |           d S N
12/31/1999rO   rP   r   rp   )r   r   r=   r>   r?   r@   rW   rB   rC   rD   r(   r)   r0   r!   rY   serrI   r3   s         r5   test_tsplot_periodzTestTSPlot.test_tsplot_periodw   s{    <dC@@@RY**1--==c#hhGGMM
##%%2#(r******r7   )	r|   r}   r   r~   r   r   zQ-DECri   1B30Minc                 2   t          d|d          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}t          |j        |           d S r   )r   r   r=   r>   r?   r@   rW   rB   rC   rD   r(   r)   r   s         r5   test_tsplot_datetimezTestTSPlot.test_tsplot_datetime~   s}     D#>>>RY**1--==c#hhGGMM
##%%2#(r******r7   c                    t          j                    }t          j                                        \  }}|                    d|           d}||                                d                                         k    sJ d S )Nkstyler3   )        r   r   r'   r   )tmmakeTimeSeriesrB   rC   rD   r)   r,   	get_color)r0   r2   rI   r3   colors        r5   test_tsplotzTestTSPlot.test_tsplot   sr      
##%%2
cb!!!"q)3355555555r7   c                    t          j                    }d}t          j        t          |          5  |                    dd           d d d            n# 1 swxY w Y   |                    d          }t          j        t          |          5  |                    dd           d d d            d S # 1 swxY w Y   d S )NzCannot pass 'style' string with a color symbol and 'color' keyword argument. Please use one or the other or pass 'style' without a color symbolru   zb-z#000099)r   r   T)drop)r   r   rw   rx   
ValueErrorr)   reset_index)r0   r2   rz   ss       r5   test_both_style_and_colorz$TestTSPlot.test_both_style_and_color   s@     % 	
 ]:S111 	1 	1GG$iG000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 NNN%%]:S111 	0 	0FFYF///	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0 	0s#   AAAB66B:=B:msusc                 2   t           j                                        \  }}t          dd|          }t	          t
          j                            d                              t          |                    |          }t          |j        |           d S )N1/1/2012rO   r    r!   r   rp   )rB   rC   rD   r   r   r=   r>   r?   r@   rW   r(   r)   )r0   r!   rI   r3   rngr   s         r5   test_high_freqzTestTSPlot.test_high_freq   s{    
##%%2St<<<RY**1--==c#hhGGMM#(r******r7   c                    ddl m}  |d d          J  |dd          dk    sJ  |t          dd          d          t          dd          j        k    sJ  |dd          t          d	d          j        k    sJ d S )
Nr   )get_datevaluer~     ri   r   z1987-12rM   z1987-1-1)%pandas.plotting._matplotlib.converterr   r   ordinal)r0   r   s     r5   test_get_datevaluezTestTSPlot.test_get_datevalue   s    GGGGGG}T3''///}T3''4////}VD#..44y#8N8N8VVVVV}Z--
C1H1H1PPPPPPPr7   c                 Z   d }t          dt          ddd                    }t          j                                        \  }}|                    |            ||d	           t          dt          ddd
                    }|                    |            ||d           d S )Nc                     |                                  d         }|                                d         j        }|                                d         }||                     ||          k    sJ d S )Nr   )r,   r-   r   	get_ydataformat_coord)r3   expected_string
first_linefirst_xfirst_ys        r5   check_format_of_first_pointzITestTSPlot.test_ts_plot_format_coord.<locals>.check_format_of_first_point   sh    *J **,,Q/7G **,,Q/G"boogw&G&GGGGGGGr7   r'   z
2014-01-01rR   zA-DECr   r#   rp   zt = 2014  y = 1.000000r~   zt = 2014-01-01  y = 1.000000)r   r   rB   rC   rD   r)   )r0   r   annualrI   r3   dailys         r5   test_ts_plot_format_coordz$TestTSPlot.test_ts_plot_format_coord   s    	H 	H 	H L!'!R!R!RSSS
##%%2r##B(@AAA q
< M M MNNN

b
##B(FGGGGGr7   c                    t          d|d          }t          t          j                            d                              t          |                    |          }t          |j        |j	        j
                   d S Nr   rO   rP   r   )r   r   r=   r>   r?   r@   rW   r(   r)   r$   r!   r0   r!   rY   r   s       r5   test_line_plot_period_seriesz'TestTSPlot.test_line_plot_period_series   se    <dC@@@RY**1--==c#hhGGMM#(CIN33333r7   frqncy)1S3S5T7H4D8W11M3Ac                    t          d|d          }t          t          j                            d                              t          |                    |          }t          |j        |j	        j
        j                   d S r   )r   r   r=   r>   r?   r@   rW   r(   r)   r$   r!   	rule_code)r0   r   rY   r   s       r5    test_line_plot_period_mlt_seriesz+TestTSPlot.test_line_plot_period_mlt_series   sj     <fcBBB29((++;;CHHEEsKK!&!',"899999r7   c                    t          d|d          }t          t          j                            d                              t          |                    |          }t          |j        |j	        j
        j                   d S r   )r   r   r=   r>   r?   r@   rW   r(   r)   r$   r!   r   r   s       r5   test_line_plot_datetime_seriesz)TestTSPlot.test_line_plot_datetime_series   sj     D#>>>RY**1--==c#hhGGMM#(CIN$<=====r7   c                    t          d|d          }t          t          j                            d                              t          |          df          |g d          }t          |j        |j	        j
                   d S Nr   rO   rP   r   rR   )ri   ro   Cr$   columns)r   r	   r=   r>   r?   r@   rW   r(   r)   r$   r!   r0   r!   rY   rH   s       r5   test_line_plot_period_framez&TestTSPlot.test_line_plot_period_frame   s}    D#>>>I!!!$$44c#hh]CC#OO
 
 

 	"'28=11111r7   c                 V   t          d|d          }t          t          j                            d                              t          |          df          |g d          }|j                            |j        j	        j
                  j	        }t          |j        |           d S r   )r   r	   r=   r>   r?   r@   rW   r$   asfreqr!   r   r(   r)   )r0   r   rY   rH   r!   s        r5   test_line_plot_period_mlt_framez*TestTSPlot.test_line_plot_period_mlt_frame   s     <fcBBBI!!!$$44c#hh]CC#OO
 
 

 xrx}677<"'4(((((r7   z3ignore:PeriodDtype\[B\] is deprecated:FutureWarningc                 V   t          d|d          }t          t          j                            d                              t          |          df          |g d          }|j                            |j        j	        j
                  j	        }t          |j        |           d S r   )r   r	   r=   r>   r?   r@   rW   r$   	to_periodr!   r   r(   r)   r   s       r5   test_line_plot_datetime_framez(TestTSPlot.test_line_plot_datetime_frame   s    
 D#>>>I!!!$$44c#hh]CC#OO
 
 

 x!!"(-"9::?"'4(((((r7   c                    t          d|d          }t          t          j                            d                              t          |                    |          }t          |j        t          t          j	        |j
                                      }t          |j        |j
        j                   |j        g d         }t          |j                   d S )Nr   rO   rP   r   )r   rR         )r   r   r=   r>   r?   r@   rW   rV   r
   asarrayr$   r(   r)   inferred_freqilocr   s       r5   test_line_plot_inferred_freqz'TestTSPlot.test_line_plot_inferred_freq   s     D#>>>RY**1--==c#hhGGMMSZrz#)'<'<!=!=>>#(CI$;<<<h|||$#(#####r7   c                 P   t           j                                        \  }}t          dd          }t	          t          t          |                    |          }t          |d d         |dd          g          }|                    |           t          |d          rJ d S )Nz2001-1-1z	2001-1-10r#   rR   r   rp   r!   )
rB   rC   rD   r   r   rA   rW   r   r)   hasattr)r0   rI   r3   r   r2   s        r5   test_fake_inferred_businessz&TestTSPlot.test_fake_inferred_business	  s    
##%%2[11E#c((OO3///RVRV$%%
22v&&&&&&&r7   c                 T    t          j                    }t          |j                   d S )N)r   r   r(   r)   )r0   r   s     r5   test_plot_offset_freqz TestTSPlot.test_plot_offset_freq  s&    !!#(#####r7   c                     t          ddd          }t          t          j                            d                              t          |                    |          }t          |j                   d S )Nz
2023-01-01BQSr9   rP   r   r#   )	r   r   r=   r>   r?   r@   rW   r(   r)   r0   drr   s      r5   test_plot_offset_freq_businessz)TestTSPlot.test_plot_offset_freq_business  sb    5"===RY**1--==c"ggFFbQQQ#(#####r7   c           	      H   t          t          ddd          t          ddd          t          ddd          g          }t          t          j                            d                              t          |                    |          }t          |j	                   d S )N  r'   r      r   r#   )
r
   r   r   r=   r>   r?   r@   rW   r(   r)   r   s      r5    test_plot_multiple_inferred_freqz+TestTSPlot.test_plot_multiple_inferred_freq  s    HT1a(((4A*>*>qRT@U@UVWWRY**1--==c"ggFFbQQQ#(#####r7   zApi changed in 3.6.0)reasonc                    dd l mc mc m} t	          ddd          }t          t          j                            d          	                    t          |          df          |          }t          j                                        \  }}|                    |           |                                }|                                }|                                }t%          ||          D ]e\  }	}
|                    |	                              d	          }t+          |
                                          }t          |          r||k    sJ fd S )
Nr   z2012-6-22 21:59:51.960928L  rP   r   r#   rp   %H:%M:%S.%f)r   plotting_matplotlib	converterr   r	   r=   r>   r?   r@   rW   rB   rC   rD   r)   	get_xaxisget_ticklocsget_ticklabelszip_from_ordinalstrftimestrget_text)r0   convrY   rH   rI   r3   axistlocstlabelslocrJ   xprss                r5   test_uhfzTestTSPlot.test_uhf  sP   <<<<<<<<<<<<43LLLI!!!$$44c#hh]CC3
 
 
 
##%%2
2||~~!!##%%''eW-- 	  	 JC##C((11-@@BU^^%%&&B2ww  Rxxxx		  	 r7   c                 ~   t          ddd          }t          t          j                            d                              t          |          df          |          }|j        g d         }t          j	        
                                \  }}|                    |           t          |                                d	                                         d d d	f                                                   }d
}t          j        |dd          ||dz  |gz
            dk                                     sJ d S )N2012-6-22 21:59:51r|   r9   rP   r   r#   )r   r'   rR      rp   r   )QΠE>r'   :0yE>)r   r	   r=   r>   r?   r@   rW   r   rB   rC   rD   r)   r   r,   
get_xydatadifffabsall)r0   rY   rH   irregrI   r3   diffssecs           r5   test_irreg_hfzTestTSPlot.test_irreg_hf4  s   -CDDDI!!!$$44c#hh]CC3
 
 
 %
##%%2

b
r||~~a(3355aaad;<<AACC abb	S#'3$77884?DDFFFFFFFr7   c                    t          ddd          }t          t          j                            d                              t          |          df          |          }t          j        	                                \  }}|j
                            t                    |_
        |                    |           t          |                                d                                         d d df                                                   }d	}t          j        |d
d          |z
            dk                                     sJ d S )Nr  r|   r9   rP   r   r#   rp   r   r  r'   r  )r   r	   r=   r>   r?   r@   rW   rB   rC   rD   r$   astypeobjectr)   r   r,   r  r  r  r  )r0   rY   rZ   rI   r3   r
  r  s          r5   test_irreg_hf_objectzTestTSPlot.test_irreg_hf_objectB  s   -CDDDI!!!$$44c#hh]CC3
 
 
 
##%%2I$$V,,	Br||~~a(3355aaad;<<AACC abb	C((4/446666666r7   c                 Z   t          j                    }|j        g d         }t          j                                        \  }}|                    |          }|J t          |                                d         	                                |j
                  D ]\  }}||k    sJ d S )N)r   r'   r      rp   r   )r   r   r   rB   rC   rD   r)   r   r,   r-   r$   )r0   r   rI   r3   retr   r   s          r5   "test_irregular_datetime64_repr_bugz-TestTSPlot.test_irregular_datetime64_repr_bugN  s    !!h|||$
##%%2hh"hoo",,..+5577CC 	 	FB88888	 	r7   c                    t          j                    }d}|j        d                                         }t          j        t
          |          5  t          |t          |          d          |_        d d d            n# 1 swxY w Y   t          j	        
                                \  }}|                    |           |                                d                                         d         |j        d         j        k    sJ |                                d                                         }t          j        t
          |          5  t!          |          j        dk    sJ 	 d d d            d S # 1 swxY w Y   d S )	NPeriodDtype\[B\] is deprecatedr   ru   ro   startr    r!   rp   r%   data)r   makePeriodSeriesr$   to_timestampassert_produces_warningFutureWarningr   rW   rB   rC   rD   r)   r,   r  r   r-   r   freqstr)r0   btsrz   dtrI   r3   rY   s          r5   test_business_freqzTestTSPlot.test_business_freqZ  s   !##/Yq\&&(('SAAA 	K 	K$2s3xxcJJJCI	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K
##%%2B||~~a ++--d3sy|7KKKKKllnnQ))++'SAAA 	8 	8C(((0C77777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8s$   %BBBE<<F F c                 
   t          j        d                              d          }|                    d          }t          j                                        \  }}|                    |           |                                d         	                                d         |j
        d         j        k    sJ |                                d                                         }t          |          j        dk    sJ d S )Ni,  BMr   rp   r   r%   r  )r   r   r   r   rB   rC   rD   r)   r,   r  r$   r   r-   r   r  )r0   r   r2   rI   r3   rY   s         r5   test_business_freq_convertz%TestTSPlot.test_business_freq_convertg  s    $$++D11]]3
##%%2B||~~a ++--d3rx{7JJJJJllnnQ))++$$$,333333r7   c                    t                      }t          j        d                              |          }t          j                                        \  }}|                    |           |                                d         	                                }d}t          j        t          |          5  t          |           d d d            d S # 1 swxY w Y   d S )Nr   rp   r   z)freq not specified and cannot be inferredru   r  )r   r   r   r   rB   rC   rD   r)   r,   r-   rw   rx   r   r   )r0   r!   r   rI   r3   rY   rz   s          r5   test_freq_with_no_period_aliasz)TestTSPlot.test_freq_with_no_period_aliasp  s    }}""))$//
##%%2BllnnQ))++9]:S111 	" 	"S!!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"s   6CCCc                    t          ddd          t          d          z   }t          t          j        d          |          }t
          j                                        \  }}|                    |           |	                                d	         
                                }t          |          j        rJ d S )
Nz
2012-12-20   r   r      minutesr#   rp   r   )r   r   r	   r=   arangerB   rC   rD   r)   r,   r-   r
   is_normalized)r0   rY   rH   rI   r3   r   s         r5   test_nonzero_basezTestTSPlot.test_nonzero_base|  s    r<<<yQS?T?T?TTry}}C000
##%%2
2\\^^A((**99******r7   c                    t          dt          j                    i          }t          j                                        \  }}|                    |           |                                d                                         }d}t          j	        t          |          5  t          j        |j                                        t          |                     d d d            d S # 1 swxY w Y   d S )Nrf   rp   r   r  ru   )r	   r   r   rB   rC   rD   r)   r,   r-   r  r  assert_index_equalr$   r   r   )r0   r   rI   r3   rY   rz   s         r5   test_dataframezTestTSPlot.test_dataframe  s   b/11233
##%%2BllnnQ))++/'SAAA 	K 	K!#)"5"5"7"7S9I9IJJJ	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	Ks   #:C**C.1C.z8ignore:Period with BDay freq is deprecated:FutureWarningobjr'   rf   bc                    t           j                                        \  }}|                    |           |                                }|                    |d         dz
  |d         dz              |                                }|d         |d         dz
  k    sJ |d         |d         dz   k    sJ t          d|j                  t          d|j                  f}|                    dd           |                                }t          |d                   |d         j	        k    sJ t          |d                   |d         j	        k    sJ t          d|j                  t          d|j                  f}|                    t          ddd          t          dd	d                     |                                }t          |d                   |d         j	        k    sJ t          |d                   |d         j	        k    sJ |                                }t           j                            |           d S )
Nrp   r   r   r'   r9   1/1/2000z4/1/2000r   r  )rB   rC   rD   r)   get_xlimset_xlimr   r!   intr   r   
get_figurerq   )r0   r3  rI   r3   xlimresultexpectedrr   s           r5   test_axis_limitszTestTSPlot.test_axis_limits  s    
##%%2B{{}}
DGaKa2...ayDGaK''''ayDGbL(((( :rw//
BG1L1LM
J
+++6!9~~!!444446!9~~!!44444 :rw//
BG1L1LM
HT1a(((4A*>*>???6!9~~!!444446!9~~!!44444mmoo
r7   c                 :   dd l mc mc m} |                    t          d                    |j        k    sJ |                    t          d                    |j        k    sJ |                    t          d                    |j        k    sJ |                    t          d                    |j        k    sJ |                    t          d                    |j	        k    sJ |                    t          d                    |j        k    sJ d S )Nr   ro   r~   r   r   ri   r   )
r   r   r   r   
get_finderr   _daily_finder_monthly_finder_quarterly_finder_annual_finder)r0   r   s     r5   test_get_finderzTestTSPlot.test_get_finder  s   <<<<<<<<<<<<y~~..$2DDDDDy~~..$2DDDDDy~~..$2FFFFFy~~..$2HHHHHy~~..$2EEEEEy~~..$2DDDDDDDr7   c                    g d}d}t          j        t          |          5  t          dd          j        gt          |          z  x}}d d d            n# 1 swxY w Y   g }g }|D ]g}t          d|          }t          t          j	        
                    d                              t          |                    |          }	t          j                                        \  }
}|	                    |	           |                                }|                    |                                d
                    |                                \  }}|                    |dz   |           |                    |                                d
                    t          j                            |                                           i||k    sJ ||k    sJ d S )N)r9   rS      i  i  i
  '  z#Period with BDay freq is deprecatedru   z1999-1-1ro   rQ   r    r   rp   r   ?)r   r  r  r   r   rW   r   r   r=   r>   r?   r@   rB   rC   rD   r)   r   appendget_majorticklocsr8  r9  rq   r;  )r0   day_lstrz   xpl1xpl2rs1rs2nr   r   rI   r3   xaxisvminvmaxs                  r5   test_finder_dailyzTestTSPlot.test_finder_daily  s   6663'SAAA 	P 	P!*3777?@3w<<OOD4	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	P 	. 	.Aj!444C..q11AA#c((KKSQQCJ''))EArHHHOOOLLNNEJJu..003444JD$KKs
D)))JJu..003444JR]]__----d{{{{d{{{{{{s   *AAAc                 |   ddg}t          d          j        gt          |          z  x}}g }g }|D ]x}t          dt	          |dz            d          }t          t          j                            d          	                    t          |                    |          }t          j                                        \  }	}
|                    |
	           |
                                }|                    |                                d
                    |
                                \  }}|
                    |dz   |           |                    |                                d
                    t          j                            |
                                           z||k    sJ ||k    sJ d S )Ng      @r   1988Q11987Q2r  r   r   r   rp   r   rK  r   r   rW   r   r:  r   r=   r>   r?   r@   rB   rC   rD   r)   r   rL  rM  r8  r9  rq   r;  r0   yrsrO  rP  rQ  rR  rS  r   r   rI   r3   rT  rU  rV  s                 r5   test_finder_quarterlyz TestTSPlot.test_finder_quarterly  s{   Bih''/03s88;;t 	. 	.AxQU#FFFC..q11AA#c((KKSQQCJ''))EArHHHOOOLLNNEJJu..003444;;==LT4KKs
D)))JJu..003444JR]]__----d{{{{d{{{{{{r7   c                 |   g d}t          d          j        gt          |          z  x}}g }g }|D ]x}t          dt	          |dz            d          }t          t          j                            d          	                    t          |                    |          }t          j                                        \  }	}
|                    |
           |
                                }|                    |                                d	                    |
                                \  }}|
                    |d
z   |           |                    |                                d	                    t          j                            |
                                           z||k    sJ ||k    sJ d S )N)gffffff?g      @r  r   zJan 1988rZ     r   r   r   rp   r   rK  r[  r\  s                 r5   test_finder_monthlyzTestTSPlot.test_finder_monthly  s}      j))12SXX==t 	. 	.AxQV3GGGC..q11AA#c((KKSQQCJ''))EArHHHOOOLLNNEJJu..003444JD$KKs
D)))JJu..003444JR]]__----d{{{{d{{{{{{r7   c                    t          ddd          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |                                }|                                d         }t          dd          j        }||k    sJ d S )	NrY  i   r   r   r   rp   r   1989Q1)r   r   r=   r>   r?   r@   rW   rB   rC   rD   r)   r   rM  r   r   )r0   r   r   rI   r3   rT  r   r   s           r5   test_finder_monthly_longz#TestTSPlot.test_finder_monthly_long  s    8W3???RY**1--==c#hhGGMM
##%%2B$$&&q)Hc""*Rxxxxxxr7   c                 X   g d}d |D             }g }dD ]}t          d|d          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |                                }|                    |                                d	                    t          j                            |                                           ||k    sJ d S )
N)r   i    rf    i  i  iz  c                 :    g | ]}t          |d           j        S )ri   rQ   )r   r   .0rk   s     r5   
<listcomp>z1TestTSPlot.test_finder_annual.<locals>.<listcomp>  s(    666afQS!!!)666r7   )r   r9      1   rU      iW  i  1987ri   r   r   rp   r   )r   r   r=   r>   r?   r@   rW   rB   rC   rD   r)   r   rL  rM  rq   r;  )	r0   r   r   nyearsr   r   rI   r3   rT  s	            r5   test_finder_annualzTestTSPlot.test_finder_annual	  s   ===6626669 	. 	.FvvC@@@C..q11AA#c((KKSQQCJ''))EArHHHOOOLLNNEIIe--//2333JR]]__----Rxxxxxxr7   c                    d}t          dd|          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |                                }|                                d         }t          dd          j        }||k    sJ d S )	Ni@ 1/1/1999MinrP   r   rp   r   rQ   r   r   r=   r>   r?   r@   rW   rB   rC   rD   r)   r   rM  r   r   )	r0   nminutesr   r   rI   r3   rT  r   r   s	            r5   test_finder_minutelyzTestTSPlot.test_finder_minutely  s    %BBBRY**1--==c#hhGGMM
##%%2B$$&&q)JU+++3Rxxxxxxr7   c                    d}t          dd|          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |                                }|                                d         }t          dd          j        }||k    sJ d S )	N   rs  r   rP   r   rp   r   rQ   ru  )	r0   nhoursr   r   rI   r3   rT  r   r   s	            r5   test_finder_hourlyzTestTSPlot.test_finder_hourly%  s    #v>>>RY**1--==c#hhGGMM
##%%2B$$&&q)JS)))1Rxxxxxxr7   c                    t          j                    }t          j        |j        dd<   t
          j                                        \  }}|                    |           |	                                }t          |          dk    sJ |d         }|                                }t          j                            |t          |          t          j                  }t          |t          j        j        j                  sJ |j        }|dddf                                         sJ t
          j                            |                                           d S )Nr      rp   r'   r   mask
fill_value)r   r   r=   nanr   rB   rC   rD   r)   r,   rW   r  maMaskedArrayr   
isinstancecorer  r  rq   r;  r0   r2   rI   r3   linesliner  r  s           r5   	test_gapszTestTSPlot.test_gaps1  s     "
##%%2
25zzQQx  u  DJJ26 JJ$
 677777yAbD!G}  """""
)))))r7   c                    t          j                    }|j        g d         }t          j        |j        dd<   t
          j                                        \  }}|                    |          }|	                                }t          |          dk    sJ |d         }|                                }t          j                            |t          |          t          j                  }t          |t          j        j        j                  sJ |j        }|dddf                                         sJ t
          j                            |                                           d S N)	r   r'   r   r   r  r:   r`        r   r   rp   r'   r   r~  )r   r   r   r=   r  rB   rC   rD   r)   r,   rW   r  r  r  r   r  r  r  r  rq   r;  r  s           r5   test_gaps_irregularzTestTSPlot.test_gaps_irregularB  s$     W3334v!
##%%2WWW^^5zzQQx  u  DJJ26 JJ$
 677777yAaCF|!!!!!
)))))r7   c                    g d}t          t          j                            d                              t          |                    |          }t          j        |j        dd<   t          j	        
                                \  }}|                    |           |                                }t          |          dk    sJ |d         }|                                }t          j                            |t!          |          t          j                  }t#          |t          j        j        j                  sJ |j        }|dddf                                         sJ d S r  )r   r=   r>   r?   r@   rW   r  r   rB   rC   rD   r)   r,   r  r  r  r   r  r  r  r  )	r0   rY   r   rI   r3   r  r  r  r  s	            r5   test_gaps_non_tszTestTSPlot.test_gaps_non_tsU  s#   ,,,RY**1--==c#hhGGMM1
##%%2B5zzQQx  u  DJJ26 JJ$
 677777yAaCF|!!!!!!!r7   c                    t          j                    }t          j        |j        dd<   t
          j                                        \  }}|                    |           t          |j
        d         |j
        d         d          }t          t          j                            d                              t          |                    |          }|                    d	
           |                                }t          |          dk    sJ t          |j                                                  dk    sJ |d         }|                                }t          j                            |t+          |          t          j                  }t-          |t          j        j        j                  sJ |j        }	|	dddf                                         sJ d S )Nr   r}  rp   r   r&   12hrQ   r   Tsecondary_yr'   r~  )r   r   r=   r  r   rB   rC   rD   r)   r   r$   r   r>   r?   r@   rW   r,   right_axr  r  r  r   r  r  r  r  )
r0   lowrI   r3   idxhr   r  r  r  r  s
             r5   test_gap_upsamplezTestTSPlot.test_gap_upsamplef  s   !!2
##%%2B#)A,	"EBBB29((++;;CIIFFMM	4   5zzQ2;((**++q0000Qx  u  DJJ26 JJ$
 677777yAbD!G}  """""""r7   c                    t          t          j                            d                              d                    }t
          j                                        \  }}|                    d          }t          |d          sJ t          |d          rJ |
                                }|                                d         }t          |                                |                                          }t          j        ||           |                                                                dk    sJ |d                                                                         rJ t
          j                            |           d S )	Nr   r9   Tr  left_axr  r   right)r   r=   r>   r?   r@   rB   rC   rD   r)   r   get_axesr,   r   r-   r   assert_series_equal	get_yaxisget_ticks_positionget_visiblerq   )r0   r   rr   rI   r3   axesr  r   s           r5   test_secondary_yzTestTSPlot.test_secondary_y{  sA   RY**1--==bAABB$$&&QXX$X''r9%%%%%2z*****||~~||~~a DNN$$dnn&6&677
sB'''||~~0022g====7$$&&2244444
r7   c                 *   t          t          j                            d                              d                     t          t          j                            d                              d                    }t
          j                                        \  }}|                    |           |	                                
                                dk    sJ t
          j                            |                                           d S )Nr   r9   rp   left)r   r=   r>   r?   r@   rB   rC   rD   r)   r  r  rq   r;  )r0   ser2rI   ax2s       r5   test_secondary_y_yaxisz!TestTSPlot.test_secondary_y_yaxis  s    ry$$Q''77;;<<<bi++A..>>rBBCC$$&&3		S	}}1133v====
))*****r7   c                 6   t          t          j                            d                              d                    }t          t          j                            d                              d                    }|                                }|                    d          }|                                                                sJ t          |d          rJ t          |d          sJ t          |d          sJ t          |d          rJ d S )Nr   r9   Tr  r  r  )	r   r=   r>   r?   r@   r)   r  r  r   )r0   r   r  r3   r  s        r5   test_secondary_bothzTestTSPlot.test_secondary_both  s    RY**1--==bAABBbi++A..>>rBBCCYY[[hh4h((||~~))+++++2y)))))r:&&&&&sI&&&&&3
+++++++r7   c                 b   t          dd          }t          t          j                            d                              d          |          }t          j                                        \  }}|	                    d          }t          |d          sJ t          |d          rJ |                                }|                                d	         }t          |                                |                                                                          }t!          j        ||           |                                                                d
k    sJ |d	                                                                         rJ t          j                            |           d S )Nr7  r9   rJ  r   Tr  r  r  r   r  )r   r   r=   r>   r?   r@   rB   rC   rD   r)   r   r  r,   r   r-   r  r   r  r  r  r  rq   )	r0   rY   r   rr   rI   r3   r  r  r   s	            r5   test_secondary_y_tszTestTSPlot.test_secondary_y_ts  sa   R000RY**1--==bAA3GG$$&&QXX$X''r9%%%%%2z*****||~~||~~a DNN$$dnn&6&677DDFF
sB'''||~~0022g====7$$&&2244444
r7   c                    t          dd          }t          t          j                            d                              d          |          }t          j                                        \  }}|	                    |           |
                                                                dk    sJ t          j                            |                                           d S )Nr7  r9   rJ  r   rp   r  )r   r   r=   r>   r?   r@   rB   rC   rD   r)   r  r  rq   r;  )r0   rY   r  rI   r  s        r5   test_secondary_y_ts_yaxisz$TestTSPlot.test_secondary_y_ts_yaxis  s    R000bi++A..>>rBBCHH$$&&3		S	}}1133v====
))*****r7   c                     t          dd          }t          t          j                            d                              d          |          }|                                }|                                                                sJ d S )Nr7  r9   rJ  r   )	r   r   r=   r>   r?   r@   r)   r  r  )r0   rY   r  r3   s       r5   test_secondary_y_ts_visiblez&TestTSPlot.test_secondary_y_ts_visible  st    R000bi++A..>>rBBCHHYY[[||~~))+++++++r7   c                    t          j        d           t          t          j                            d                              d                    }t          j        	                                \  }}|
                    dd|          }t          |d          sJ t          |d          rJ |                                }|d	                                                                         d
k    sJ d S )Nscipyr   r9   Tdensityr  kindr3   r  r  r'   r  )rw   importorskipr   r=   r>   r?   r@   rB   rC   rD   r)   r   r  r  r  r0   r   rr   r3   r  s        r5   test_secondary_kdezTestTSPlot.test_secondary_kde  s    G$$$RY**1--==bAABB*%%''RXX$Y2X>>r9%%%%%2z*****||~~Aw  ""55777BBBBBBr7   c                    t          t          j                            d                              d                    }t
          j                                        \  }}|                    dd|           |	                                }|d         
                                                                dk    sJ d S )Nr   r9   Tbarr  r'   r  )r   r=   r>   r?   r@   rB   rC   rD   r)   r  r  r  r  s        r5   test_secondary_barzTestTSPlot.test_secondary_bar  s    RY**1--==bAABB*%%''RT"555||~~Aw  ""55777BBBBBBr7   c                    t          t          j                            d                              d          g d          }|                    ddgd          }|d	                                                                         d
k    sJ |d                                                                         dk    sJ |d                                                                         d
k    sJ d S )Nr   r   rR   rf   r5  cr   rf   r  T)r  rD   r   r  r'   r  r	   r=   r>   r?   r@   r)   r  r  r0   rH   r  s      r5   test_secondary_framezTestTSPlot.test_secondary_frame  s    I!!!$$44V<<ooo
 
 
 wwC:w==Aw  ""55777BBBBAw  ""55776AAAAAw  ""55777BBBBBBr7   c                    t          t          j                            d                              d          g d          }|                    dddgd	          }|d
                                                                         dk    sJ |d                                                                         dk    sJ |d                                                                         dk    sJ d S )Nr   r  r  r  r  rf   r  T)r  r  rD   r   r  r'   r  r  r  s      r5   test_secondary_bar_framez#TestTSPlot.test_secondary_bar_frame  s    I!!!$$44V<<ooo
 
 
 wwESzDwIIAw  ""55777BBBBAw  ""55776AAAAAw  ""55777BBBBBBr7   c                 t   t          j                    }|j        g d         }t          j                                        \  }}|                    |           |                    d|          }|                                }d}t          j        t          |          5  t          |d                                                   }t          |d                                                   }	t          j        ||j                            d	                     t          j        |	|j                            d	                     |                                \  }
}|j                                        }d d d            n# 1 swxY w Y   |
|d         j        k    sJ ||d
         j        k    sJ d S Nr   r   r9   r   r`        r  rp   gr   r  ru   r   r'   ro   r&   )r   r   r   rB   rC   rD   r)   r,   r  r  r   r-   r1  r$   r   r8  r   r0   s1s2rI   r3   r  r  rz   idx1idx2r  r  pidxs                r5   test_mixed_freq_regular_firstz(TestTSPlot.test_mixed_freq_regular_first  s     W3334 
##%%2
2ggCBg''/'SAAA 	( 	(uQx113344DuQx113344D!$(:(:3(?(?@@@!$(:(:3(?(?@@@,,..KD%8%%''D	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( tAw&&&&R(((((((s   "CFFFc                 v   t          j                    }|j        g d         }t          j                                        \  }}|                    d|           |                    |           t          |d          rJ |                                }|d         	                                }t          j
        ||j                            t                    j                   |d         	                                }t          j
        ||j                            t                    j                   d S Nr  r  r   rp   r!   r   r'   )r   r   r   rB   rC   rD   r)   r   r,   r-   assert_numpy_array_equalr$   r  r  rV   r0   r  r  rI   r3   r  x1x2s           r5   test_mixed_freq_irregular_firstz*TestTSPlot.test_mixed_freq_irregular_first  s      W3334
##%%2
cb!!!
22v&&&&&1X!!
#B(?(?(FGGG1X!!
#B(?(?(FGGGGGr7   c                    t          j                                                    }|j        g dd d f         }t          j                                        \  }}|                    |           |                    d|          }|                                }d}t          j	        t          |          5  t          |d                                                   }t          |d                                                   }	|                    |j                            d	                    sJ |	                    |j                            d	                    sJ |                                \  }
}|j                                        }d d d            n# 1 swxY w Y   |
|d         j        k    sJ ||d
         j        k    sJ d S r  )r   r   to_framer   rB   rC   rD   r)   r,   r  r  r   r-   equalsr$   r   r8  r   r  s                r5    test_mixed_freq_regular_first_dfz+TestTSPlot.test_mixed_freq_regular_first_df  s     ))++W333QQQ67
##%%2
2ggCBg''/'SAAA 	( 	(uQx113344DuQx113344D;;rx11#6677777;;rx11#6677777,,..KD%8%%''D	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( 	( tAw&&&&R(((((((s   8CF!!F%(F%c                    t          j                                                    }|j        g dd d f         }t          j                                        \  }}|                    d|           |                    |           t          |d          rJ |	                                }|d         
                                }t          j        ||j                            t                    j                   |d         
                                }t          j        ||j                            t                    j                   d S r  )r   r   r  r   rB   rC   rD   r)   r   r,   r-   r  r$   r  r  rV   r  s           r5   "test_mixed_freq_irregular_first_dfz-TestTSPlot.test_mixed_freq_irregular_first_df  s     ))++W333QQQ67
##%%2
cb!!!
22v&&&&&1X!!
#B(?(?(FGGG1X!!
#B(?(?(FGGGGGr7   c                    t          ddd          }t          ddd          }t          t          j                            d                              t          |                    |          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |
                    |           |                                D ]/}t          |                                	          j        dk    sJ 0d S )
Nrs  m  r~   r   r`  r   r   rp   r  r   r   r=   r>   r?   r@   rW   rB   rC   rD   r)   r,   r   r-   r!   r0   r  idxlhighr  rI   r3   r  s           r5   test_mixed_freq_hf_firstz#TestTSPlot.test_mixed_freq_hf_first"  s   *c<<<*bs;;;bi++A..>>s4yyII4PPRY**1--==c$iiHH$OO
##%%2		R	BLLNN 	B 	BDDNN$4$4555:cAAAAA	B 	Br7   c                 6   t          ddd          }t          j                            d                              d          }t          ||          }|                    d                                          }t          j	        
                                \  }}|                    |	          }|                    d
|           |j        d                                         d         |j        d                                         d         k    sJ d S )Nz2012-01-01 13:00
2012-01-02r   rQ   r   r`  r#   r}   rp   rr   r   r'   )r   r=   r>   r?   r@   r   r   interpolaterB   rC   rD   r)   r  r-   )r0   ts_indts_datar2   ts2rI   r3   s          r5   test_mixed_freq_alignmentz$TestTSPlot.test_mixed_freq_alignment-  s    .3GGG)''**::2>>G6***iinn((**
##%%2WWW^^sr"""x{$$&&q)RXa[-B-B-D-DQ-GGGGGGGr7   c                 f   t          ddd          }t          ddd          }t          t          j                            d                              t          |                    |          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    d|	           |
                    d|	           |                                D ]/}t          |                                
          j        dk    sJ 0|                                }t          |j                  dk    sJ t          j                            |                                           d S )Nrs  r  r~   r   r`  r   r   T)legendr3   r  )r   r   r=   r>   r?   r@   rW   rB   rC   rD   r)   r,   r   r-   r!   
get_legendtextsrq   r;  )	r0   r  r  r  r  rI   r3   r  legs	            r5   test_mixed_freq_lf_firstz#TestTSPlot.test_mixed_freq_lf_first:  sb   *c<<<*bs;;;bi++A..>>s4yyII4PPRY**1--==c$iiHH$OO
##%%2$$$		"	%%%LLNN 	B 	BDDNN$4$4555:cAAAAAmmoo39~~""""
)))))r7   c                    t          ddd          }t          ddd          }t          t          j                            d                              t          |                    |          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |
                    |           |                                D ]/}t          |                                	          j        dk    sJ 0d S )
Nrs     r}   r   r  r   r   rp   r  r  r  s           r5   test_mixed_freq_lf_first_hourlyz*TestTSPlot.test_mixed_freq_lf_first_hourlyH  s   *c<<<*ac:::bi++A..>>s4yyII4PPRY**1--==c$iiHH$OO
##%%2B		R	LLNN 	B 	BDDNN$4$4555:cAAAAA	B 	Br7   c                    t          j                    }|j        g d         }d}t          j        t          |          5  t          ddd          }d d d            n# 1 swxY w Y   t          t          j        	                    d          
                    t          |                    |          }t          j                                        \  }}|                    |	           |                    |	           d S )
N)r   r'   r   rR   r  r   r   r     r:   r9   r              r  ru   z1/3/2000r*  ro   r   r   rp   )r   r   r   r  r  r   r   r=   r>   r?   r@   rW   rB   rC   rD   r)   )r0   r2   r	  rz   r   psrI   r3   s           r5   test_mixed_freq_irreg_periodz'TestTSPlot.test_mixed_freq_irreg_periodS  s+     NNNO/'SAAA 	A 	Az2C@@@C	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	A 	ABI))!,,<<SXXFFLL
##%%2

b

2s    AA#&A#c                    t          ddd          }|d d                             |dd                    }t          t          t	          |                    |          }t          t          t	          |                    |          }t
          j                            dd          \  }\  }}|                    |	           |                    |	           |j	        dk    sJ |j	        dk    sJ |j
        d
                                         d         |j
        d
                                         d         k    sJ d S )N
2015-01-01rR   r   r   r'   r   T)nrowssharexrp   r   r%   )r   rX   r   rA   rW   rB   rC   rD   r)   r!   r  r  r0   r  r  r  r  rI   ax1r  s           r5   test_mixed_freq_shared_axz$TestTSPlot.test_mixed_freq_shared_ax_  s   ,<<<BQBx~~d122h''E#d))$$d++E#d))$$d++
++!D+AA:C
3
3x3x3y|&&((.#)A,2I2I2K2KD2QQQQQQQr7   c                 z   t          ddd          }|d d                             |dd                    }t          t          t	          |                    |          }t          t          t	          |                    |          }t
          j                                        \  }}|                                }|	                    |           |	                    |           |j
        d                                         d	         |j
        d                                         d	         k    sJ d S 
Nr   rR   r   r   r'   r   rp   r   r%   r   rX   r   rA   rW   rB   rC   rD   twinxr)   r  r  r  s           r5    test_mixed_freq_shared_ax_twin_xz+TestTSPlot.test_mixed_freq_shared_ax_twin_xn  s    ,<<<BQBx~~d122h''E#d))$$d++E#d))$$d++$$&&3iikk
3
3y|&&((.#)A,2I2I2K2KD2QQQQQQQr7   zTODO (GH14330, GH14322)c                 z   t          ddd          }|d d                             |dd                    }t          t          t	          |                    |          }t          t          t	          |                    |          }t
          j                                        \  }}|                                }|	                    |           |	                    |           |j
        d                                         d	         |j
        d                                         d	         k    sJ d S r  r  r  s           r5   0test_mixed_freq_shared_ax_twin_x_irregular_firstz;TestTSPlot.test_mixed_freq_shared_ax_twin_x_irregular_first|  s     ,<<<BQBx~~d122h''E#d))$$d++E#d))$$d++$$&&3iikk
3
3y|&&((.#)A,2I2I2K2KD2QQQQQQQr7   c                 F   t           j                                        \  }}t          dt          dg          }t          t          t          |                    |          }|                    |           |	                                d         
                                }|j                                        t          |                                          k    sJ t          |                                          |j                                        k    sJ d S )Nr   z
2015-01-03rp   r   )rB   rC   rD   r   r   r   rA   rW   r)   r,   r-   r$   minmax)r0   rI   r3   dtir   r4   s         r5   test_nat_handlingzTestTSPlot.test_nat_handling  s    
##%%2\3=>>5S??C((	"q!++--w{{}}u 1 1 3 33333e}}  ""agkkmm333333r7   c                    t          ddd          }t          ddd          }t          t          j                            d                              t          |                    |          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |
                    |           |                                D ]4}t          |                                	          j        |j        k    sJ 5d S )
Nrs  4   r   r   r`  r   r   rp   r  r  r  s           r5   test_to_weekly_resamplingz$TestTSPlot.test_to_weekly_resampling  s   *bs;;;*bs;;;bi++A..>>s4yyII4PPRY**1--==c$iiHH$OO
##%%2		R	BLLNN 	H 	HDDNN$4$4555:diGGGGG	H 	Hr7   c                    t          ddd          }t          ddd          }t          t          j                            d                              t          |                    |          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |
                    |           |                                j                            t          j                  }t          j        g d	t          j        
          }|                                D ]}	t#          |	                                          j        |j        k    sJ |	                    d          }
t          |
          dk    rt)          j        |
|           st)          j        |
|           d S )Nrs  r  r   r   r`  r   r   rp   i  i  i  i  i  i   i  i  i  i  i  i  dtyper  Forig)r   r   r=   r>   r?   r@   rW   rB   rC   rD   r)   r   asi8r  float64rd   r,   r   r-   r!   r   r  )r0   r  r  r  r  rI   r3   
expected_h
expected_lr  r4   s              r5   test_from_weekly_resamplingz&TestTSPlot.test_from_weekly_resampling  s   *bs;;;*bs;;;bi++A..>>s4yyII4PPRY**1--==c$iiHH$OO
##%%2B		R	^^%%*11"*==
XTTT*
 
 

 LLNN 	? 	?DDNN$4$4555:diGGGGNNN..E5zzR+E:>>>>+E:>>>>	? 	?r7   zkind1, kind2)r  area)r   r  c                 p   t          ddd          }t          ddd          }t          t          j                            d                              t          |          df          |g d	
          }t          t          j                            d                              t          |          df          |g d	
          }t          j                                        \  }}|	                    |d|           |	                    |d|           t          j
        g dt          j                  }	t          j        t          |	          t          j                  }
t          d          D ]}|j        |         }t          |                                          j        |j        k    sJ t%          j        |                    d          |	           |
||         j        z  }
t%          j        |                    d          |
           |                                j                            t          j                  }	t          j        t          |	          t          j                  }
t          d          D ]}|j        d|z            }t          |                                          j        |j        k    sJ t%          j        |                    d          |	           |
||         j        z  }
t%          j        |                    d          |
           d S )Nrs  r  r   r   r`  r   r   rR   r   r'   r   r   Tr  stackedr3   r  r  Fr  r  )r   r	   r=   r>   r?   rW   rB   rC   rD   r)   rd   r  zerosrA   r  r   r-   r!   r   r  rV   r   r   r  r  )r0   kind1kind2r  r  r  r  rI   r3   
expected_x
expected_yre   r  s                r5   $test_from_resampling_area_line_mixedz/TestTSPlot.test_from_resampling_area_line_mixed  s   *bs;;;*bs;;;I!!!$$++SYYN;;II
 
 

 I!!!$$++SYYN;;II
 
 
 
##%%2eTb111		udr	222 X   *
 
 

" Xc*ooRZ@@@
q 	P 	PA8A;Dt~~//005BBBB'E(B(BJOOO#a&-'J'E(B(BJOOOO ^^%%*11"*==
Xc*ooRZ@@@
q 	P 	PA8AE?DDNN$4$4555:diGGGG'E(B(BJOOO$q'.(J'E(B(BJOOOO	P 	Pr7   c                 r   t          ddd          }t          ddd          }t          t          j                            d                              t          |          df          |g d	
          }t          t          j                            d                              t          |          df          |g d	
          }t          j                                        \  }}|	                    |d|           |	                    |d|           |
                                j                            t          j                  }	t          j        t          |	          t          j                  }
t          d          D ]}|j        |         }t#          |                                          j        |j        k    sJ t)          j        |                    d          |	           |
||         j        z  }
t)          j        |                    d          |
           t          j        g dt          j                  }	t          j        t          |	          t          j                  }
t          d          D ]}|j        d|z            }t#          |                                          j        |j        k    sJ t)          j        |                    d          |	           |
||         j        z  }
t)          j        |                    d          |
           d S )Nrs  r  r   r   r`  r   r   rR   r"  r   Tr#  r  r  Fr  r  )r   r	   r=   r>   r?   rW   rB   rC   rD   r)   r   r  r  r  r%  rA   r  r   r-   r!   r   r  rV   r   rd   )r0   r&  r'  r  r  r  r  rI   r3   r(  r)  re   r  r  s                 r5   0test_from_resampling_area_line_mixed_high_to_lowz;TestTSPlot.test_from_resampling_area_line_mixed_high_to_low  s   *bs;;;*bs;;;I!!!$$++SYYN;;II
 
 

 I!!!$$++SYYN;;II
 
 

 
##%%2		udr	222eTb111 ^^%%*11"*==
Xc*ooRZ@@@
q 	P 	PA8A;DDNN$4$4555:diGGGG'E(B(BJOOO$q'.(J'E(B(BJOOOO X   *
 
 

" Xc*ooRZ@@@
q 	Q 	QAHQUOEEOO$5$5666;tyHHHH'U(C(CZPPP#a&-'J'U(C(CZPPPP	Q 	Qr7   c                    t          ddd          }t          ddd          }t          t          j                            d                              t          |                    |          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |
                    |           t          |                                          dk    sJ |                                D ]/}t          |                                	          j        d
k    sJ 0d S Nz2014-07-01 09:00r|   2   rP   100Lr   r   rp   r  r   r  r  s           r5   "test_mixed_freq_second_millisecondz-TestTSPlot.test_mixed_freq_second_millisecond#  s@   ,3CCC,63GGGbi++A..>>s4yyII4PPRY**1--==c$iiHH$OO
##%%2		R	B2<<>>""a''''LLNN 	B 	BDDNN$4$4555:cAAAAA	B 	Br7   c                    t          ddd          }t          ddd          }t          t          j                            d                              t          |                    |          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |
                    |           t          |                                          dk    sJ |                                D ]/}t          |                                	          j        d
k    sJ 0d S r.  r  r  s           r5   .test_mixed_freq_second_millisecond_low_to_highz9TestTSPlot.test_mixed_freq_second_millisecond_low_to_high1  s@   ,3CCC,63GGGbi++A..>>s4yyII4PPRY**1--==c$iiHH$OO
##%%2B		R	2<<>>""a''''LLNN 	B 	BDDNN$4$4555:cAAAAA	B 	Br7   c                 X   t          ddd          t          ddd          t          ddd          g}t          t          j                            d                              t          |          df          t          |t                              }t          |j
                   d S )Nr   r'   r   r  r   rR   r  )r   r	   r=   r>   r?   r@   rW   r
   r  r(   r)   r^   s      r5   test_irreg_dtypeszTestTSPlot.test_irreg_dtypes?  s    D!QdAq!1!14a3D3DEI!!!$$44c#hh]CC#V$$$
 
 	"'"""""r7   c                 x   t          dd          }|g d                             t                    }t          t          j                            d                              t          |          df          |          }t          j
                                        \  }}t          |j        |           d S )Nr7  r9   rJ  )r   r   r   r:   r   rR   rp   )r   r  r  r	   r=   r>   r?   r@   rW   rB   rC   rD   r(   r)   )r0   rY   rH   rI   r3   s        r5   test_irreg_dtypes_dt64z!TestTSPlot.test_irreg_dtypes_dt64H  s    R000,,,&&v..ry,,Q//??S1NNPSTT
##%%2"'b))))))r7   c                 d   t          dddddd          t          j                            d                              ddd                                          }t          j        fd|D                       }t          t          j                            d                              t          |                    t          j                            d                              t          |                    d|	          }t          j                                        \  }}|                    |
           |                                }|                                }t!          ||          D ]\  }}	t#          t%          |          d          \  }
}t#          |
d          \  }}
|	                                }t          |          dk    rW|dk    r%t)          ||
|                              d          }n$t)          ||
|                              d          }||k    sJ d S )Nr'   rR   r*  r   r   r  c                 t    g | ]4}t          t          |                     z                                   5S r+  r   r:  r   rj  rk   ts     r5   rk  z(TestTSPlot.test_time.<locals>.<listcomp>S  ;    NNN!Ic!ff5555;;==NNNr7   r4  r#   rp   <   %H:%M:%S%H:%M)r   r=   r>   r?   integerscumsumrd   r	   r@   rW   rB   rC   rD   r)   
get_xticksrE   r   divmodr:  r   r   r   r0   deltasr2   rH   rI   r3   tickslabels_tick_labelmr   hr   r   r=  s                  @r5   	test_timezTestTSPlot.test_timeP  s   Q1aQ''&&q))221b!<<CCEEXNNNNvNNNOOY**1--==c"ggFFY**1--==c"ggFF  
 
 
 
##%%2
2 ##%% // 		  		 ME6#e**b))DAq!R==DAq""B2ww{{66aA//
;;BBaA//88BRxxxx		  		 r7   c                 n   t          dddddd          t          j                            d                              ddd                                          }t          j        fd|D                       }t          t          j                            d                              t          |                    t          j                            d                              t          |                    d|	          }t          j                                        \  }}|                    |
           |                                }|                                }t!          ||          D ]\  }}	t#          t%          |          d          \  }
}t#          |
d          \  }}
|	                                }t          |          dk    rW|dk    r%t)          ||
|                              d          }n$t)          ||
|                              d          }||k    sJ |                    dd           |                                }|                                }t!          ||          D ]\  }}	t#          t%          |          d          \  }
}t#          |
d          \  }}
|	                                }t          |          dk    rW|dk    r%t)          ||
|                              d          }n$t)          ||
|                              d          }||k    sJ d S )Nr'   rR   r*  r   r   r  c                 t    g | ]4}t          t          |                     z                                   5S r:  r;  r<  s     r5   rk  z4TestTSPlot.test_time_change_xlim.<locals>.<listcomp>o  r>  r7   r4  r#   rp   r?  r@  rA  z1:30z5:00)r   r=   r>   r?   rB  rC  rd   r	   r@   rW   rB   rC   rD   r)   rD  rE   r   rE  r:  r   r   r   r9  rF  s                  @r5   test_time_change_xlimz TestTSPlot.test_time_change_xliml  s   Q1aQ''&&q))221b!<<CCEEXNNNNvNNNOOY**1--==c"ggFFY**1--==c"ggFF  
 
 
 
##%%2
2 ##%% // 		  		 ME6#e**b))DAq!R==DAq""B2ww{{66aA//
;;BBaA//88BRxxxx 	FF### ##%% // 		  		 ME6#e**b))DAq!R==DAq""B2ww{{66aA//
;;BBaA//88BRxxxx		  		 r7   c                 |   t          dddddd          t          j                            d                              ddd                                          }t          j        fd|D                       }t          t          j                            d                              t          |                    t          j                            d                              t          |                    d|	          }t          j                                        \  }}|                    |
          }|                                }|                                }t!          ||          D ]A\  }}	t#          t%          |          d          \  }
}t'          |t%          |          z
  dz            }t#          |
d          \  }}
|	                                }t          |          dk    r|dz  dk    r&t+          ||
||                              d          }n|dz  dk    r.t+          ||
||                              d          d d         }nQ|dk    r&t+          ||
||                              d          }n%t+          ||
||                              d          }||k    sJ Cd S )Nr'   rR   r*  r   r   r  c                 t    g | ]4}t          t          |                     z                                   5S ))microsecondsr;  r<  s     r5   rk  z.TestTSPlot.test_time_musec.<locals>.<listcomp>  s;    SSSqI3q66::::@@BBSSSr7   r4  r#   rp   r?  g    .Ai  r   r@  rA  )r   r=   r>   r?   rB  rC  rd   r	   r@   rW   rB   rC   rD   r)   rD  rE   r   rE  r:  roundr   r   r   )r0   rG  r2   rH   rI   r3   rH  rI  rJ  rK  rL  r   r   rM  r   r   r=  s                   @r5   test_time_museczTestTSPlot.test_time_musec  s   Q1aQ''&&q))221b!<<CCEEXSSSSFSSSTTY**1--==c"ggFFY**1--==c"ggFF  
 
 
 
##%%2WWW^^ ##%% // 	  	 ME6#e**b))DAqE

*c122B!R==DAq""B2ww{{I!##aAr**33MBBBBDjQ&&aAr**33MBB3B3GBB!VVaAr**33J??BBaAr**33G<<BRxxxx!	  	 r7   c                 |   t          ddd          }t          ddd          }t          t          j                            d                              t          |                    |          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}|
                    |           |
                    d	|
          }|                                D ].}t          |                                          j        dk    sJ /t          |d          sJ t          |d          rJ |j                                        D ].}t          |                                          j        dk    sJ /d S )Nrs  r  r~   r   r`  r   r   rp   Tr  r3   r  r  )r   r   r=   r>   r?   r@   rW   rB   rC   rD   r)   r,   r   r-   r!   r   r  r  s           r5   test_secondary_upsamplez"TestTSPlot.test_secondary_upsample  s   *c<<<*bs;;;bi++A..>>s4yyII4PPRY**1--==c$iiHH$OO
##%%2BYY4BY//LLNN 	= 	=Dt~~//005<<<<<r9%%%%%2z*****J((** 	= 	=Dt~~//005<<<<<	= 	=r7   c                     t           j                                        }|                    d          }t	          j                    }|                    ddg|           |                                }t          |	                                          dk    sJ |
                                d                                         dk    sJ |
                                d                                         d	k    sJ |
                                d
                                         dk    sJ |
                                d                                         dk    sJ |j                                        J t                      }|	                                D ])}|                    |                                           *t          |          dk    sJ t           j                            |           d S )N   ri   ro   rY  r  r   	A (right)r'   z	B (right)r   r   rR   r~   )rB   rC   figureadd_subplotr   makeTimeDataFramer)   r  rW   r,   	get_textsr   r  setaddr   rq   )r0   rr   r3   rH   r  colorsr  s          r5   test_secondary_legendz TestTSPlot.test_secondary_legend  s   j!!__S!! !##
S#J2...mmoo3==??##q((((}}q!**,,;;;;}}q!**,,;;;;}}q!**,,3333}}q!**,,3333{%%''///MMOO 	) 	)DJJt~~''(((( 6{{a
r7   c                 
   t          j                    }t          j                                        }|                    d          }|                    ddgd|           |                                }t          |	                                          dk    sJ |
                                d                                         dk    sJ |
                                d                                         d	k    sJ |
                                d
                                         dk    sJ |
                                d                                         dk    sJ t          j                            |           d S )Nr\  ri   r   F)r  
mark_rightr3   r  r   r'   ro   r   rR   r~   )r   r`  rB   rC   r^  r_  r)   r  rW   r,   ra  r   rq   r0   rH   rr   r3   r  s        r5   test_secondary_legend_rightz&TestTSPlot.test_secondary_legend_right  sB   !##j!!__S!!
S#J5R@@@mmoo3==??##q((((}}q!**,,3333}}q!**,,3333}}q!**,,3333}}q!**,,3333
r7   c                    t          j                    }t          j                                        \  }}|                    ddg|           |                                }|                                d                                         dk    sJ |                                d                                         dk    sJ t          j        	                    |           d S )Nr  ri   )r  r  r3   r   r]  r'   ro   
r   r`  rB   rC   rD   r)   r  ra  r   rq   rh  s        r5   test_secondary_legend_barz$TestTSPlot.test_secondary_legend_bar  s    !##*%%''R
U"555mmoo}}q!**,,;;;;}}q!**,,3333
r7   c                    t          j                    }t          j                                        \  }}|                    ddgd|           |                                }|                                d                                         dk    sJ |                                d                                         dk    sJ t          j        	                    |           d S )Nr  ri   F)r  r  rg  r3   r   r'   ro   rk  rh  s        r5   test_secondary_legend_bar_rightz*TestTSPlot.test_secondary_legend_bar_right  s    !##*%%''R
U%BGGGmmoo}}q!**,,3333}}q!**,,3333
r7   c                    t          j                    }t          j                                        }|                    d          }t          j                    }|                    ddg|          }|                                }t          |	                                          dk    sJ |j
                                        J t                      }|	                                D ])}|                    |                                           *t          |          dk    sJ t          j                            |           d S Nr\  r   r~   rY  r  )r   r`  rB   rC   r^  r_  r)   r  rW   r,   r  rb  rc  r   rq   r0   rH   rr   r3   r  rd  r  s          r5   test_secondary_legend_multi_colz*TestTSPlot.test_secondary_legend_multi_col   s   !##j!!__S!!!##WW#sW33mmoo3==??##q(((({%%''///MMOO 	) 	)DJJt~~''(((( 6{{a
r7   c                 n   t          j                    }t          j                                        }|                    d          }|                    ddg|          }|                                }t          |	                                          dk    sJ |j
                                        J t                      }|	                                D ])}|                    |                                           *t          |          dk    sJ t          j                                         d S )Nr\  ri   ro   rY  r  )r   makeDataFramerB   rC   r^  r_  r)   r  rW   r,   r  rb  rc  r   rq   rq  s          r5   test_secondary_legend_nontsz&TestTSPlot.test_secondary_legend_nonts  s   j!!__S!!WW#sW33mmoo3==??##q(((({%%''///MMOO 	) 	)DJJt~~''(((( 6{{a
r7   c                 2   t          j                    }t          j                                        }|                    d          }|                    ddg|          }|                                }t          |	                                          dk    sJ |j
                                        J t                      }|	                                D ])}|                    |                                           *t          |          dk    sJ d S rp  )r   rt  rB   rC   r^  r_  r)   r  rW   r,   r  rb  rc  r   rq  s          r5   %test_secondary_legend_nonts_multi_colz0TestTSPlot.test_secondary_legend_nonts_multi_col"  s    j!!__S!!WW#sW33mmoo3==??##q(((({%%''///MMOO 	) 	)DJJt~~''(((( 6{{ar7   c                 
   t          ddd          }t          t          j                            d                              t          |          df          |          }t          j        	                                \  }}|
                    |          }|                                }|                                D ]A}t          |                                          dk    r|                                d	k    sJ Bd S )
Nr   r`  r   r   r   rR   rp   r   r*  )r   r	   r=   r>   r?   r@   rW   rB   rC   rD   r)   r   r   r   get_rotation)r0   r   rH   rI   r3   rT  r  s          r5   test_format_date_axisz TestTSPlot.test_format_date_axis2  s    Rc:::ry,,Q//??S1NNPSTT
##%%2WWW^^((** 	1 	1D4==??##a''((**b0000	1 	1r7   c                 b   t          ddd          }t          t          t          |                              }t          j                                        \  }}|                    ||d          }t          j	        t          |d                                                   |           d S )Nr  r9   r~   r  Y)rJ   r   )r   listrA   rW   rB   rC   rD   r)   r   r1  r   r-   )r0   rk   rl   rI   r3   r  s         r5   test_ax_plotzTestTSPlot.test_ax_plot=  s    \2C@@@s1vv
##%%21C((
mE!H,>,>,@,@AA1EEEEEr7   c                    t          ddd          t          ddd          g}t          j        ddd          }t          j        dd	d          }d
dd}t          j                                        \  }} |j        d |D             |fi |  |j        d |D             |fi | |                                \  }}t          j        d |D             t          j	                  }	t          j        |                                d d df         |	           t          j        d |D             t          j	                  }	t          j        |                                d d df         |	           d S )N  r`     i  r'   g      $@g      &@g      ?g      (@-r  )fmtlwc                 6    g | ]}|                                 S  	toordinalri  s     r5   rk  z0TestTSPlot.test_mpl_nopandas.<locals>.<listcomp>L       333akkmm333r7   c                 6    g | ]}|                                 S r  r  ri  s     r5   rk  z0TestTSPlot.test_mpl_nopandas.<locals>.<listcomp>M  r  r7   c                 6    g | ]}|                                 S r  r  ri  s     r5   rk  z0TestTSPlot.test_mpl_nopandas.<locals>.<listcomp>Q       555!555r7   r  r   c                 6    g | ]}|                                 S r  r  ri  s     r5   rk  z0TestTSPlot.test_mpl_nopandas.<locals>.<listcomp>S  r  r7   )r   r=   r-  rB   rC   rD   	plot_dater,   rd   r  r   r  r  )
r0   datesvalues1values2kwrI   r3   line1line2exps
             r5   test_mpl_nopandaszTestTSPlot.test_mpl_nopandasD  s}   dB##T$2%6%67)D$,,)D$,,""
##%%233U333WCCCCC33U333WCCCCC||~~uh55u555RZHHH
#E$4$4$6$6qqq!t$<cBBBh55u555RZHHH
#E$4$4$6$6qqq!t$<cBBBBBr7   c                    ddl m} t          j                    d d         }|j        g d         }t
          j                                        \  }}|d d                             |           |dd                              |           |	                                \  }}||
                    |j                                        d|          k    sJ ||
                    |j                                        d|          k    sJ d S )Nr   DatetimeConverterr  r'   r  r   r   r  r:   r9   r`  r  r  r  r  r  r   rp    r   r  r   r   r   rB   rC   rD   r)   r8  convertr$   r  r  r0   r  r2   ts_irregularrI   r3   r  r  s           r5    test_irregular_ts_shared_ax_xlimz+TestTSPlot.test_irregular_ts_shared_ax_xlimV  s   KKKKKK  "%wMMMN 
##%%2RaR$$$QRR$$$ kkmme(001C1G1G1I1I2rRRRRRR)11,2D2H2H2J2JBPRSSSSSSSSr7   c                 r   g d}g d}t          d|          }t          d|          }t          j                                        \  }}|                    |           |                                \  }}|                    d|           |                                \  }	}
||	k    sJ ||
k     sJ d S )	N)r'   r   rR   r  )r   r   r  r  r'   r#   r   rp   TrY  )r   rB   rC   rD   r)   r8  r0   index_1index_2r  r  rI   r3   left_beforeright_before
left_afterright_afters              r5   test_secondary_y_non_ts_xlimz'TestTSPlot.test_secondary_y_non_ts_xlimg  s    ,,,,AW%%%AW%%%
##%%2
2$&KKMM!\
DR((("$++--
Kj((((k))))))r7   c                    t          ddd          }t          ddd          }t          d|          }t          d|          }t          j                                        \  }}|                    |	           |                                \  }}|                    d
|           |                                \  }	}
||	k    sJ ||
k     sJ d S )N
2000-01-01r  r~   r  z
2000-01-05r'   r#   r   rp   TrY  )r   r   rB   rC   rD   r)   r8  r  s              r5    test_secondary_y_regular_ts_xlimz+TestTSPlot.test_secondary_y_regular_ts_xlimw  s    <EEE<EEEAW%%%AW%%%
##%%2
2$&KKMM!\
DR((("$++--
Kj((((k))))))r7   c                    t          ddd          }t          d|          }t          j                                        \  }}|                    |           |                                \  }}|                    d                                                              d	|
           |                                \  }}||k    sJ ||k    sJ d S )Nr  rI  r  r   r'   r#   rp   r~   TrY  )	r   r   rB   rC   rD   r)   r8  resamplemean)	r0   r   r2   rI   r3   r  r  r  r  s	            r5   #test_secondary_y_mixed_freq_ts_xlimz.TestTSPlot.test_secondary_y_mixed_freq_ts_xlim  s    u5AAAAS!!!
##%%2
2$&KKMM!\
C$$"$==="$++--
K j(((({******r7   c                 \   ddl m} t          j                    d d         }|j        g d         }t
          j                                        \  }}|d d                             |           |dd                              d|           |d d                             |           |	                                \  }}||
                    |j                                        d	|          k    sJ ||
                    |j                                        d	|          k    sJ d S )
Nr   r  r  r  r   rp   TrY  r  r  r  s           r5   "test_secondary_y_irregular_ts_xlimz-TestTSPlot.test_secondary_y_irregular_ts_xlim  s5   KKKKKK  "%wMMMN
##%%2RaR$$$QRR$2666RaR$$$kkmme(001C1G1G1I1I2rRRRRRR)11,2D2H2H2J2JBPRSSSSSSSSr7   c                 (   t          ddd          t          ddd          g}t          j                                        \  }}|                    |           t          dddd          t          dddd          g}|                    |           d S )Ni  r'   r   r`  )r   rB   rC   rD   r)   r   )r0   rV   rI   r3   s       r5   test_plot_outofbounds_datetimez)TestTSPlot.test_plot_outofbounds_datetime  s    tQ""Dq!$4$45
##%%2
4Ar**HT1a,D,DE
r7   c                 D   d t          j        d          D             }t          ddd          }t          t           j                            d                              t          |          df          |          }t          j	        
                                \  }}|                    d|           t          j	                                         |                                }d	 |D             }t          |          t          |          k    sJ ||k    sJ d S )
Nc                     g | ]}d |d	S )z00:00:00.0000000z0>2dr  )rj  re   s     r5   rk  zATestTSPlot.test_format_timedelta_ticks_narrow.<locals>.<listcomp>  s$    NNN16a666NNNr7   r9   0nsr   r   rR   r;   c                 6    g | ]}|                                 S r  r   ri  s     r5   rk  zATestTSPlot.test_format_timedelta_ticks_narrow.<locals>.<listcomp>       666!666r7   )r=   r-  r   r	   r>   r?   r@   rW   rB   rC   rD   r)   drawrE   r0   expected_labelsr   rH   rI   r3   rI  result_labelss           r5   "test_format_timedelta_ticks_narrowz-TestTSPlot.test_format_timedelta_ticks_narrow  s   NN	"NNNc2D999ry,,Q//??S1NNPSTT
##%%2
r"""
##%%66v666=!!S%9%99999//////r7   c                    g d}t          ddd          }t          t          j                            d                              t          |          df          |          }t          j        	                                \  }}|
                    d|          }t          j                                         |                                }d	 |D             }t          |          t          |          k    sJ ||k    sJ d S )
N)	z00:00:00z1 days 03:46:40z2 days 07:33:20z3 days 11:20:00z4 days 15:06:40z5 days 18:53:20z6 days 22:40:00z8 days 02:26:40z9 days 06:13:20r  r9   1 dr   r   rR   r;   c                 6    g | ]}|                                 S r  r  ri  s     r5   rk  z?TestTSPlot.test_format_timedelta_ticks_wide.<locals>.<listcomp>  r  r7   )r   r	   r=   r>   r?   r@   rW   rB   rC   rD   r)   r  rE   r  s           r5    test_format_timedelta_ticks_widez+TestTSPlot.test_format_timedelta_ticks_wide  s    

 

 

 c2E:::ry,,Q//??S1NNPSTT
##%%2WWaBW''
##%%66v666=!!S%9%99999//////r7   c                     t          t          d          t          dd                    }t          j                                        \  }}t          |j        |           d S )Nr   1dayrJ  rp   )r   rA   r   rB   rC   rD   r(   r)   )r0   r   rI   r3   s       r5   test_timedelta_plotzTestTSPlot.test_timedelta_plot  sV    588_VQ???@@
##%%2!&R((((((r7   c                 2   t          ddd          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}t          |j        |           d S )N1 day 2 hr 30 min 10 sr9   r  r   r   rp   r   r   r=   r>   r?   r@   rW   rB   rC   rD   r(   r)   r0   r$   r   rI   r3   s        r5   test_timedelta_long_periodz%TestTSPlot.test_timedelta_long_period  s|     8"5QQQ29((++;;CJJGGOO
##%%2!&R((((((r7   c                 2   t          ddd          }t          t          j                            d                              t          |                    |          }t          j        	                                \  }}t          |j        |           d S )Nr  r9   z1 nsr   r   rp   r  r  s        r5   test_timedelta_short_periodz&TestTSPlot.test_timedelta_short_period  s|     8"6RRR29((++;;CJJGGOO
##%%2!&R((((((r7   c                    t          ddd          }|}t          j        ddd          }t          j        ddd          d d d         }t          j                                        \  }}|                    ||g||g	           d S )
Nr   r9   r   r   r   r'   g?r&   )weights)r   r=   r-  rB   rC   rD   hist)r0   r   rk   w1w2rI   r3   s          r5   	test_histzTestTSPlot.test_hist  s    Rc:::Yq!S!!Yq!S!!$$B$'
##%%2
AR)))))r7   c           
         t          g dt          ddd          t          ddd          t          ddd          g          }t          g dt          ddd          t          d	dd          t          d
dd          g          }t          j                                        \  }}|                    |           |                    |           |                    |           d S )Nra   rg  r`  r  r   i  r#   i  i  r  rp   )r   r   rB   rC   rD   r)   )r0   r  r  rI   r3   s        r5   test_overlapping_datetimez$TestTSPlot.test_overlapping_datetime  s    IIr2&&r2&&r2&&
 
 
 IIr2&&r2&&r2&&
 
 
 
##%%2
2
2
2r7   z1GH9053 matplotlib does not use ax.xaxis.converterc                    t          t          j                            d                              d          t          dd                    }|                                }t          j        t                    5  |                    |j
        |j        d           d d d            n# 1 swxY w Y   |j        \  }}t          j        |                                |                                           d S )Nr   r9   z
1970-01-02rJ  r#   r  )r   )r   r=   r>   r?   r@   r   r)   r   r  DeprecationWarningr$   rV   r  r  r  )r0   r   r3   l1l2s        r5   test_add_matplotlib_datetime64z)TestTSPlot.test_add_matplotlib_datetime64  s   
 I!!!$$44R88\2666
 
 
 VVXX'(:;; 	2 	2GGAGQXSG111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 B
#BMMOOR]]__EEEEEs   >#B--B14B1c                    t          t          j                            d                              d          ddg          }t	          ddd	          |d
<   t
          j                                        \  }}|                    d
d|           t
          j        	                                 |
                                d         }d}|                                |k    sJ d S )Nr   )r9   r   rk   rl   r  z
2018-01-01r9   r~   r   r   )rk   rl   r  r   )r	   r=   r>   r?   r   rB   rC   rD   scatterr  rE   r   )r0   rH   rI   r3   rJ   r>  s         r5   "test_matplotlib_scatter_datetime64z-TestTSPlot.test_matplotlib_scatter_datetime64  s    ry,,Q//66w??#sTTTbsCCC6

##%%2


Vs
,,,
""$$Q'~~8++++++r7   c                     t          g d          }t          |g dd          }|                    dd          }t          |d           d S )N)
2020-05-01
2020-05-02z
2020-05-03ra   rk   rl   rk   rl   r   xrotr   r	   r)   r   r0   rk   rH   r  s       r5   test_check_xticks_rotz TestTSPlot.test_check_xticks_rot)  s_     BBBCCQYYY//00www$$4a((((((r7   c                     t          g d          }t          |g dd          }|                    dd          }t          |d           d S )Nr  r  z
2020-05-04ra   r  rk   rl   r*  r  r  r  s       r5   test_check_xticks_rot_irregularz*TestTSPlot.test_check_xticks_rot_irregular1  s]    BBBCCQYYY//00www$$4b))))))r7   c                 <   t          g d          }t          |g dd          }|                    d                              dd          }t	          |d	           |                    d                              dd
          }t	          |d	           d S )Nr  ra   r  rk   rl   T)rl   	use_indexr*  r  Fr   )r   r	   	set_indexr)   r   r  s       r5   test_check_xticks_rot_use_idxz(TestTSPlot.test_check_xticks_rot_use_idx8  s    BBBCCQYYY//00||C  %%t%<<4b))))||C  %%u%==4a((((((r7   c                     t          g d          }t          |g dd          }|                    dddd          }t          |d	           |                    dddd
          }t          |d	           d S )Nr  ra   r  rk   rl   T)rk   rl   rD   r  r*  r  Fr   r  r  s       r5   test_check_xticks_rot_sharexz'TestTSPlot.test_check_xticks_rot_sharexB  s    BBBCCQYYY//00wwd4w@@4b))))wwd5wAA4a((((((r7   N){__name__
__module____qualname__rw   markfilterwarningsr6   rK   r[   r_   rg   rs   r{   parametrizer   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   xfailr   r  r  r  r"  r%  r'  r/  r2  r   r   r	   r?  rF  rW  r^  ra  rd  rq  slowrw  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  r  r  r  r*  r,  r1  r3  r5  r7  rN  rQ  rW  rZ  re  ri  rl  rn  rr  ru  rw  rz  r~  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r7   r5   r   r   .   sZ
       [ 566
< 
< 76
<- - -$ $ $"# # #* * *     [V%M%M%MNN+ + ON+ [GGG + + +6 6 60 0 0 [VdD\22+ + 32+Q Q QH H H$ [V%M%M%MNN4 4 ON4
 [CCC : : : [GGG > > >
 [V%M%M%MNN2 2 ON2 [CCC ) ) ) [ VWW[GGG ) )  XW) [GGG $ $ $' ' '$ $ $$ $ $
$ $ $
 [455    65 (G G G
7 
7 
7
 
 
8 8 84 4 4
" 
" 
"+ + +K K K [B  [BI-B-//6Gb6G6I6IA6MNNOO	
    2E E E  0  ,  ,     [
 
 

 
 
* * *"* * *&" " ""# # #*  + + +	, 	, 	,  + + +, , ,C C CC C CC C CC C C) ) )0H H H) ) )&H H H	B 	B 	BH H H* * *	B 	B 	B [ VWW	 	 XW	R R RR R R [788
R 
R 98
R	4 	4 	4	H 	H 	H? ? ?, [^.>@P-QRR5P 5P SR5Pn [^.>@P-QRR3Q 3Q SR3QjB B BB B B# # #* * *     8+  +  + Z!  !  ! F= = =  ,        "  "       [4551 1 651F F FC C C$T T T"* * * * * * + + +T T T$  0 0 00 0 00) ) )) ) )) ) )* * *  4 [QRRF F SRF	, 	, 	,) ) )* * *) ) )) ) ) ) )r7   r   c                    dd l m} |                                }	 |                                 |                    d          }|                    d|                                          }t          |dd           }	 | |i |}
|
J |                    d|                                          }|7|j        j	        }t          |t                    r|j        }|	|j	        |k    sJ ||	|j	        |k    sJ |                    d          }||d<    | |i |}
|
J t          j        d          5 }|                    |           d d d            n# 1 swxY w Y   t          j        d          5 }t!          j        ||           d d d            n# 1 swxY w Y   |                    |           d S # |                    |           w xY w)Nr   r\  r3   r!      T)return_filelike)matplotlib.pyplotrC   gcfclfr_  popgcagetattrr$   r!   r  r   r   r   ensure_cleansavefigpickledumprq   )fr!   seriesargskwargspltrr   r3   orig_axorig_axfreqr  dfreqpaths                r5   r(   r(   M  sT   ######
''))C 			__S!!**T37799--gvt44a   ZZcggii((L%E%,, ("w%'''' 37d????__S!!ta   _T222 	dKK	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 _T222 	#dKT"""	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 	# 			#		#sT   DF= 7EF= EF=  E!F= 9FF= FF= "F#F= =G)NN))__doc__r   r   r   r   r  numpyr=   rw   pandas._libs.tslibsr   r   pandasr	   r
   r   r   r   r   r   pandas._testing_testingr   pandas.core.indexes.datetimesr   r   r   pandas.core.indexes.periodr   r   r   pandas.core.indexes.timedeltasr   pandas.tests.plotting.commonr   pandas.tseries.offsetsr   r  rB   r   r(   r  r7   r5   <module>r     s   B B                        
                                
         
 ; : : : : : ; ; ; ; ; ; . . . . . .f,''\) \) \) \) \) \) \) \)~0% % % % % %r7   