
    .i                     L   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 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jN                  d      Z( ejN                  d      Z)ddl*m+c m,c m-Z.  G d d      Z/ddZ0y)z:Test cases for time series specific (freq conversion, etc)    )datedatetimetime	timedeltaN)
BaseOffset	to_offset)PeriodDtype)	DataFrameIndexNaTSeriesconcatisnato_datetime)DatetimeIndexbdate_range
date_range)PeriodPeriodIndexperiod_range)timedelta_range)_check_ticks_props)WeekOfMonth
matplotlibzmatplotlib.pyplotc                   
   e Zd Zej                  j                  d      d        Zd Zd Zd Z	d Z
d Zd Zej                  j                  d	g d
      d        Zej                  j                  d	g d      d        Zd Zej                  j                  dd edd      g      d        Zej                  j                  d	ddg      d        Zd Zej                  j                  dddgddgg      d        Zej                  j                  d	g d
      d        Zej                  j                  d g d!      d"        Zej                  j                  d	g d      d#        Zej                  j                  d	g d$      d%        Zej                  j                  d g d!      d&        Zej                  j                  d'      ej                  j                  d	g d      d(               Zej                  j                  d	g d      d)        Zd* Zd+ Zd, Zd- Z d. Z!d/ Z"d0 Z#d1 Z$d2 Z%d3 Z&d4 Z'd5 Z(ej                  j                  d6      ej                  j                  d7 e) e*jV                  de*jX                  8       edd      9       e- e) e*jV                  de*jX                  8       edd      9       e) e*jV                  de*jX                  8       edd      9      d:z   d;      g      d<               Z.d= Z/d> Z0d? Z1d@ Z2dA Z3dB Z4ej                  jj                  dC        Z6dD Z7dE Z8dF Z9dG Z:dH Z;dI Z<dJ Z=dK Z>dL Z?dM Z@dN ZAdO ZBdP ZCdQ ZDdR ZEdS ZFdT ZGdU ZHdV ZIdW ZJdX ZKdY ZLdZ ZMej                  j                  d'      d[        ZNd\ ZOd] ZPej                  j                  d^_      d`        ZRda ZSdb ZTdc ZUdd ZVej                  j                  dedfdgg      dh        ZWej                  j                  dedfdgg      di        ZXdj ZYdk ZZdl Z[dm Z\dn Z]do Z^dp Z_dq Z`dr Zads Zbdt Zcdu Zddv Zedw Zfdx Zgej                  j                  dy_      dz        Zhd{ Zid| Zjd} Zkd~ Zld Zmd Znd Zod Zpd Zqd Zrd Zsd Ztd Zud Zvd Zwej                  j                  d_      d        Zxd Zyd Zzd Z{d Z|d Z}ej                  j                  d edd       eddd       e~ddd       eddd       edD  cg c]  }t        dd:|       c}}} e8       ed      g      d        Zyc c}}} w )
TestTSPlotzignore::UserWarningc                 z   |}t        ddd|      }t        ddg|      }t        |j                         |j                         }t	        t        |j                                     j                         }|d   j                  |d   j                  fd	k(  sJ |d
   j                  |d
   j                  fdk(  sJ y )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          e/var/www/app/trading-bot/venv/lib/python3.12/site-packages/pandas/tests/plotting/test_datetimelike.pytest_ts_plot_with_tzzTestTSPlot.test_ts_plot_with_tz5   s     :qsrBUFO51"''"WWYT",,.)*446auQx/6999b	b	 0 01V;;;    c                 f   t        t        j                  j                  d      j	                  d      t        d            }t        j                  j                         \  }}|j                  d|       |j                         |j                         z   D ]  }|j                         dk(  rJ  y )Nr   )
   	   r:   r$   fontsizer4   )r
   nprandomdefault_rngstandard_normalrangemplpyplotsubplotsr*   get_xticklabelsget_yticklabelsget_fontsize)r1   df_r4   labels        r6   test_fontsize_set_correctlyz&TestTSPlot.test_fontsize_set_correctlyB   s    II!!!$44W=U2Y
 

##%2
r"'')B,>,>,@@ 	-E%%'1,,,	-r8   c                    t        ddd      }t        |j                  d       }t        t        j
                  j                  d      j                  t        |      df      |      }t        |j                         |d	d
 j                  |dd        }t        t        j
                  j                  d      j                  t        |      df      |      }t        |j                         y )N1/1/1987MSr:   r"   r!   r"   r      r$   r         )r   r   valuesr
   r>   r?   r@   rA   lenr)   r*   union)r1   idxrI   df2s       r6   test_frame_inferredzTestTSPlot.test_frame_inferredL   s    $;CJJT2II!!!$44c#h]C3
 	"''" !AhnnSW%II!!!$44c#h]C3
 	#((#r8   c                     t        ddd      }t        |j                  d       }t        t        j
                  j                  d      j                  t        |      df      |      }t        |j                         y )	Nz2008-1-1 00:15:0015minr:   rP   rQ   r   rR   r$   )r   r   rU   r
   r>   r?   r@   rA   rV   r)   r*   r1   rX   rI   s      r6   test_frame_inferred_n_gt_1z%TestTSPlot.test_frame_inferred_n_gt_1]   s`    ,7BGCJJT2II!!!$44c#h]C3
 	"''"r8   c                     t        j                  g d      }t        ||      }t        |j                  |       t        |j                  |       y )Nr(   r   rR   r$   )xerr)yerr)r>   arrayr
   r)   r*   )r1   ias      r6   test_is_error_nozeroindexz$TestTSPlot.test_is_error_nozeroindexf   s8    HHYaq!!&&q)!&&q)r8   c                     t        ddd      }t        g dg dd|      }t        j                  j	                         \  }}|j                  |       t        |j                               d	k(  sJ y )
NrN   YErR   rP   xyzr`   ABr4   r(   )r   r
   rC   rD   rE   r*   rV   r-   )r1   rX   rI   figr4   s        r6   test_nonnumeric_excludez"TestTSPlot.test_nonnumeric_excludem   s]    $:_9=sC**%%'R
22<<>"a'''r8   c                     t        ddd      }t        g dg dd|      }d}t        j                  t        |	      5  |d
   j                          d d d        y # 1 sw Y   y xY w)NrN   rh   rR   rP   ri   r`   rm   zno numeric data to plotmatchrn   )r   r
   pytestraises	TypeErrorr*   )r1   rX   rI   msgs       r6   test_nonnumeric_exclude_errorz(TestTSPlot.test_nonnumeric_exclude_erroru   sV    $:_9=sC']]9C0 	sGLLN	 	 	s   AA%r"   )sminr    DWMQYc                    t        d|d      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}t        |j                  |       y N
12/31/1999r:   rP   r   rp   )r   r   r>   r?   r@   rA   rV   rC   rD   rE   r)   r*   r1   r"   rX   serrJ   r4   s         r6   test_tsplot_periodzTestTSPlot.test_tsplot_period|   s^    <dB?RYY**1-==c#hGM

##%2#((r*r8   )	r{   r|   r    r}   r~   MEzQE-DECrh   1B30Minc                    t        d|d      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}t        |j                  |       y r   )r   r   r>   r?   r@   rA   rV   rC   rD   rE   r)   r*   r   s         r6   test_tsplot_datetimezTestTSPlot.test_tsplot_datetime   s`     D"=RYY**1-==c#hGM

##%2#((r*r8   c                 2   t        t        j                  dt        j                        t	        dd            }t
        j                  j                         \  }}|j                  d|       d}||j                         d	   j                         k(  sJ y )
Nr:   dtype
2020-01-01r!   r$   kstyler4   )        r   r   r(   r   )r   r>   arangefloat64r   rC   rD   rE   r*   r-   	get_color)r1   r3   rJ   r4   colors        r6   test_tsplotzTestTSPlot.test_tsplot   sw    IIb

+:lTV3W
 

##%2
cb!"q)335555r8   r%   Nr   r:   r   c                     t        t        j                  dt        j                        |      }d}t	        j
                  t        |      5  |j                  dd       d d d        y # 1 sw Y   y xY w)	Nr:   r   r$   zCannot pass 'style' string with a color symbol and 'color' keyword argument. Please use one or the other or pass 'style' without a color symbolrt   zb-z#000099)r   r   )r   r>   r   r   rv   rw   
ValueErrorr*   )r1   r%   r3   ry   s       r6   test_both_style_and_colorz$TestTSPlot.test_both_style_and_color   s\    BIIb

35A% 	
 ]]:S1 	1GG$iG0	1 	1 	1s   A++A4msusc                    t         j                  j                         \  }}t        dd|      }t	        t
        j                  j                  d      j                  t        |            |      }t        |j                  |       y )N1/1/2012r:   r!   r"   r   rp   )rC   rD   rE   r   r   r>   r?   r@   rA   rV   r)   r*   )r1   r"   rJ   r4   rngr   s         r6   test_high_freqzTestTSPlot.test_high_freq   s^    

##%2Rd;RYY**1-==c#hGM#((r*r8   c                 :   t        j                  d d      J t        j                  dd      dk(  sJ t        j                  t        dd      d      t        dd      j                  k(  sJ t        j                  dd      t        dd      j                  k(  sJ y )Nr}     r   r   z1987-12rN   z1987-1-1)conv_get_datevaluer   ordinalr1   s    r6   test_get_datevaluezTestTSPlot.test_get_datevalue   s    ""4-555""4-555tS 137i%--.	
. "":s3vj#7N7V7VVVVr8   zfreq, expected_stringzYE-DECzt = 2014  y = 1.000000r}   zt = 2014-01-01  y = 1.000000c                 P   t        dt        dd|            }t        j                  j	                         \  }}|j                  |       |j                         d   }|j                         d   j                  }|j                         d   }||j                  ||      k(  sJ y )Nr(   z
2014-01-01rR   r   r$   rp   r   )r   r   rC   rD   rE   r*   r-   r.   r   	get_ydataformat_coord)	r1   r"   expected_stringr   rJ   r4   
first_linefirst_xfirst_ys	            r6   test_ts_plot_format_coordz$TestTSPlot.test_ts_plot_format_coord   s    
 QjqtLM

##%2B\\^A&
&&(+33&&(+"//'7"CCCCr8   c                     t        d|d      }t        t        j                  j	                  d      j                  t        |            |      }t        |j                  |j                  j                         y Nr   r:   rP   r   )r   r   r>   r?   r@   rA   rV   r)   r*   r%   r"   r1   r"   rX   r   s       r6   test_line_plot_period_seriesz'TestTSPlot.test_line_plot_period_series   sP    <dB?RYY**1-==c#hGM#((CIINN3r8   frqncy)1s3s5min7h4D8W11M3Yc                 
   t        d|d      }t        t        j                  j	                  d      j                  t        |            |      }t        |j                  |j                  j                  j                         y r   )r   r   r>   r?   r@   rA   rV   r)   r*   r%   r"   	rule_code)r1   r   rX   r{   s       r6    test_line_plot_period_mlt_seriesz+TestTSPlot.test_line_plot_period_mlt_series   sX     <fbA299((+;;CHEsK!&&!'',,"8"89r8   c                 
   t        d|d      }t        t        j                  j	                  d      j                  t        |            |      }t        |j                  |j                  j                  j                         y r   )r   r   r>   r?   r@   rA   rV   r)   r*   r%   r"   r   r   s       r6   test_line_plot_datetime_seriesz)TestTSPlot.test_line_plot_datetime_series   sX     D"=RYY**1-==c#hGM#((CIINN$<$<=r8   )r{   r|   r    r}   r~   r   QErh   c                    t        d|d      }t        t        j                  j	                  d      j                  t        |      df      |g d      }t        |j                  |j                  j                         y Nr   r:   rP   r   rR   )rn   ro   Cr%   columns)r   r
   r>   r?   r@   rA   rV   r)   r*   r%   r"   r1   r"   rX   rI   s       r6   test_line_plot_period_framez&TestTSPlot.test_line_plot_period_frame   s]    D"=II!!!$44c#h]C#

 	"''288==1r8   c                    t        d|d      }t        t        j                  j	                  d      j                  t        |      df      |g d      }|j                  j                  j                  }t        |j                  |       y r   )r   r
   r>   r?   r@   rA   rV   r%   r"   r   r)   r*   )r1   r   rX   rI   r"   s        r6   test_line_plot_period_mlt_framez*TestTSPlot.test_line_plot_period_mlt_frame   sj     <fbAII!!!$44c#h]C#

 xx}}&&"''4(r8   z3ignore:PeriodDtype\[B\] is deprecated:FutureWarningc                 v   t        d|d      }t        t        j                  j	                  d      j                  t        |      df      |g d      }t        |j                  j                        j                  }|j                  j                  |      j                  }t        |j                  |       y r   )r   r
   r>   r?   r@   rA   rV   r	   r%   r"   _freqstr	to_periodr)   r*   r   s       r6   test_line_plot_datetime_framez(TestTSPlot.test_line_plot_datetime_frame   s    
 D"=II!!!$44c#h]C#

 288==)22xx!!$',,"''4(r8   c                    t        d|d      }t        t        j                  j	                  d      j                  t        |            |      }t        |j                  t        t        j                  |j                                    }t        |j                  |j                  j                         |j                  g d   }t        |j                         y )Nr   r:   rP   r   )r   rR      rT   )r   r   r>   r?   r@   rA   rV   rU   r   asarrayr%   r)   r*   inferred_freqilocr   s       r6   test_line_plot_inferred_freqz'TestTSPlot.test_line_plot_inferred_freq   s     D"=RYY**1-==c#hGMSZZrzz#))'<!=>#((CII$;$;<hh|$#((#r8   c                    t         j                  j                         \  }}t        dd      }t	        t        t        |            |      }t        |d d |dd  g      }|j                  |       t        |d      rJ y )Nz2001-1-1z	2001-1-10r$   rR   r   rp   r"   )
rC   rD   rE   r   r   rB   rV   r   r*   hasattr)r1   rJ   r4   r   r3   s        r6   test_fake_inferred_businessz&TestTSPlot.test_fake_inferred_business
  ss    

##%2[1E#c(O3/RVRV$%
22v&&&&r8   c                     t        t        j                  dt        j                        t	        dd            }t        |j                         y )Nr:   r   r   r   r$   )r   r>   r   r   r   r)   r*   )r1   r   s     r6   test_plot_offset_freqz TestTSPlot.test_plot_offset_freq  s6    IIb

+:lTV3W
 	#((#r8   c                     t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        |j                         y )Nz
2023-01-01BQSr:   rP   r   r$   )	r   r   r>   r?   r@   rA   rV   r)   r*   r1   drr   s      r6   test_plot_offset_freq_businessz)TestTSPlot.test_plot_offset_freq_business  sF    5"=RYY**1-==c"gFbQ#((#r8   c           	         t        t        ddd      t        ddd      t        ddd      g      }t        t        j                  j                  d      j                  t        |            |      }t        |j                         y )N  r(   rT      r   r$   )
r   r   r   r>   r?   r@   rA   rV   r)   r*   r   s      r6    test_plot_multiple_inferred_freqz+TestTSPlot.test_plot_multiple_inferred_freq  se    HT1a((4A*>qRT@UVWRYY**1-==c"gFbQ#((#r8   c                    t        ddd      }t        t        j                  j	                  d      j                  t        |      df      |      }|j                  g d   }t        j                  j                         \  }}|j                  |       t        |j                         d	   j                         d d d	f         j                         }d
}t        j                   |dd  ||dz  |gz
        dk  j#                         sJ y )N2012-6-22 21:59:51r{   r:   rP   r   r$   )r   r(   rR   rS   rp   r   )QΠE>r(   :0yE>)r   r
   r>   r?   r@   rA   rV   r   rC   rD   rE   r*   r   r-   
get_xydatadifffabsall)r1   rX   rI   irregrJ   r4   diffssecs           r6   test_irreg_hfzTestTSPlot.test_irreg_hf"  s    -CDII!!!$44c#h]C3
 %

##%2

b
r||~a(335ad;<AAC ab	S#'3$7784?DDFFFr8   c                 4   t        ddd      }t        t        j                  j	                  d      j                  t        |      df      |      }t        j                  j                         \  }}|j                  j                  t              |_
        |j                  |       t        |j                         d   j!                         d d df         j#                         }d	}t        j$                  |d
d  |z
        dk  j'                         sJ y )Nr   r{   r:   rP   r   r$   rp   r   r   r(   r   )r   r
   r>   r?   r@   rA   rV   rC   rD   rE   r%   astypeobjectr*   r   r-   r   r   r   r   )r1   rX   rY   rJ   r4   r   r   s          r6   test_irreg_hf_objectzTestTSPlot.test_irreg_hf_object0  s    -CDII!!!$44c#h]C3
 

##%2II$$V,	Br||~a(335ad;<AAC ab	C(4/44666r8   c                    t        t        j                  dt        j                        t	        dd            }|j
                  g d   }t        j                  j                         \  }}|j                  |      }|J t        |j                         d   j                         |j                  d	
      D ]  \  }}||k(  rJ  y )Nr:   r   r   r   r$   )r   r(   r      rp   r   Tstrict)r   r>   r   r   r   r   rC   rD   rE   r*   zipr-   r.   r%   )r1   r   rJ   r4   retrsxps          r6   "test_irregular_datetime64_repr_bugz-TestTSPlot.test_irregular_datetime64_repr_bug<  s    IIb

+:lTV3W
 hh|$

##%2hh"ho",,.+5574P 	FB8O8	r8   c                    t        t        d      t        dd            }d}|j                  d   j	                         }t        j                  t        |      5  t        |t        |      d      |_        d d d        t        j                  j                         \  }}|j                  |	       |j                         d   j                         d
   |j                  d   j                  k(  sJ |j                         d   j!                         }t        j                  t        |      5  t#        |      j$                  dk(  sJ 	 d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nr   r   r   PeriodDtype\[B\] is deprecatedr   rt   ro   startr!   r"   rp   r&   data)r   rB   r   r%   to_timestamptmassert_produces_warningFutureWarningrV   rC   rD   rE   r*   r-   r   r   r.   r   freqstr)r1   btsry   dtrJ   r4   rX   s          r6   test_business_freqzTestTSPlot.test_business_freqJ  s%   U1X|L!DE/YYq\&&(''SA 	K$2s3xcJCI	K

##%2B||~a ++-d3syy|7K7KKKKllnQ))+''SA 	8C(00C777	8 	8	K 	K	8 	8s   E/E!E!E*c                    t        t        j                  dt        j                        t	        ddd            j                  d      }|j                  d      }t        j                  j                         \  }}|j                  |	       |j                         d
   j                         d   |j                  d
   j                  k(  sJ |j                         d
   j                         }t!        |      j"                  dk(  sJ y )N2   r   r   ro   r   r$   BMEr   rp   r   r&   r  )r   r>   r   r   r   asfreqr   rC   rD   rE   r*   r-   r   r%   r   r.   r   r
  )r1   r  r3   rJ   r4   rX   s         r6   test_business_freq_convertz%TestTSPlot.test_business_freq_convertW  s    IIb

+\2C@
 &- 	 ]]3

##%2B||~a ++-d3rxx{7J7JJJJllnQ))+$,,333r8   c                    t               }t        t        j                  dt        j                        t        dd            j                  |      }t        j                  j                         \  }}|j                  |       |j                         d   j                         }d}t        j                  t        |	      5  t!        |
       d d d        y # 1 sw Y   y xY w)Nr:   r   r   r   r$   rp   r   z)freq not specified and cannot be inferredrt   r  )r   r   r>   r   r   r   r  rC   rD   rE   r*   r-   r.   rv   rw   r   r   )r1   r"   r  rJ   r4   rX   ry   s          r6   test_freq_with_no_period_aliasz)TestTSPlot.test_freq_with_no_period_aliasc  s    }IIb

+:lTV3W

&, 	 

##%2BllnQ))+9]]:S1 	"S!	" 	" 	"s   CC%c                 P   t        ddd      t        d      z   }t        t        j                  d      |      }t
        j                  j                         \  }}|j                  |       |j                         d	   j                         }t        |      j                  rJ y )
Nz
2012-12-20   r    r      minutesr$   rp   r   )r   r   r
   r>   r   rC   rD   rE   r*   r-   r.   r   is_normalized)r1   rX   rI   rJ   r4   r   s         r6   test_nonzero_basezTestTSPlot.test_nonzero_baseq  s    r<yQS?TTryy}C0

##%2
2\\^A((*9*****r8   c           
         t        dt        t        j                  dt        j                        t        dd            i      }t        j                  j                         \  }}|j                  |       |j                         d   j                         }t        j                  |j                  j                         t!        |             y )	Nre   r:   r   r   r   r$   rp   r   )r
   r   r>   r   r   r   rC   rD   rE   r*   r-   r.   r  assert_index_equalr%   r   r   )r1   r  rJ   r4   rX   s        r6   test_dataframezTestTSPlot.test_dataframez  s    VIIb

3$\2>
 

##%2BllnQ))+
cii113[5EFr8   z8ignore:Period with BDay freq is deprecated:FutureWarningobjr   r$   r(   re   bc                    t         j                  j                         \  }}|j                  |       |j	                         }|j                  |d   dz
  |d   dz          |j	                         }|d   |d   dz
  k(  sJ |d   |d   dz   k(  sJ t        d|j                        t        d|j                        f}|j                  dd       |j	                         }t        |d         |d   j                  k(  sJ t        |d         |d   j                  k(  sJ t        d|j                        t        d|j                        f}|j                  t        ddd      t        dd	d             |j	                         }t        |d         |d   j                  k(  sJ t        |d         |d   j                  k(  sJ y )
Nrp   r   r   r(   r:   1/1/2000z4/1/2000r   rS   )rC   rD   rE   r*   get_xlimset_xlimr   r"   intr   r   )r1   r  rJ   r4   xlimresultexpecteds          r6   test_axis_limitszTestTSPlot.test_axis_limits  s   4 

##%2B{{}
DGaKa2.ayDGaK'''ayDGbL((( :rww/
BGG1LM
J
+6!9~!!4!44446!9~!!4!4444 :rww/
BGG1LM
HT1a((4A*>?6!9~!!4!44446!9~!!4!4444r8   c                 P   t        j                  t        d            t         j                  k(  sJ t        j                  t        d            t         j                  k(  sJ t        j                  t        d            t         j                  k(  sJ t        j                  t        d            t         j
                  k(  sJ t        j                  t        d            t         j                  k(  sJ t        j                  t        d            t         j                  k(  sJ y )Nro   r}   r   r   rh   r~   )r   
get_finderr   _daily_finder_monthly_finder_quarterly_finder_annual_finderr   s    r6   test_get_finderzTestTSPlot.test_get_finder  s    y~.$2D2DDDDy~.$2D2DDDDy/43G3GGGGy/43I3IIIIy/43F3FFFFy~.$2D2DDDDr8   c                 H   g d}d}t        j                  t        |      5  t        dd      j                  gt        |      z  x}}d d d        g }g }|D ]-  }t        d|      }t        t        j                  j                  d      j                  t        |            |      }	t        j                  j                         \  }
}|	j                  |	       |j!                         }|j#                  |j%                         d
          |j'                         \  }}|j)                  |dz   |       |j#                  |j%                         d
          t        j                  j+                  |j-                                0 |k(  sJ |k(  sJ y # 1 sw Y   PxY w)N)r:   (      i  i  i
  i'  z#Period with BDay freq is deprecatedrt   z1999-1-1ro   rQ   r   r   rp   r   ?)r  r  r	  r   r   rV   r   r   r>   r?   r@   rA   rC   rD   rE   r*   	get_xaxisappendget_majorticklocsr$  r%  close
get_figure)r1   day_lstry   xpl1xpl2rs1rs2nr   r   rJ   r4   xaxisvminvmaxs                  r6   test_finder_dailyzTestTSPlot.test_finder_daily  s\   63''SA 	P!*37??@3w<OOD4	P 	.Aj!4C..q1AA#c(KSQCJJ'')EArHHHOLLNEJJu..034JD$KKs
D)JJu..034JJR]]_-	. d{{d{{%	P 	Ps   'FF!c                    ddg}t        d      j                  gt        |      z  x}}g }g }|D ]:  }t        dt	        |dz        d      }t        t        j                  j                  d      j                  t        |            |      }t        j                  j                         \  }	}
|j                  |
	       |
j                         }|j                  |j!                         d
          |
j#                         \  }}|
j%                  |dz   |       |j                  |j!                         d
          t        j                  j'                  |
j)                                = ||k(  sJ ||k(  sJ y )Ng      @r   1988Q11987Q2rS   r   r   r   rp   r   r5  r   r   rV   r   r&  r   r>   r?   r@   rA   rC   rD   rE   r*   r6  r7  r8  r$  r%  r9  r:  r1   yrsr<  r=  r>  r?  r@  r   r   rJ   r4   rA  rB  rC  s                 r6   test_finder_quarterlyz TestTSPlot.test_finder_quarterly  s:   Bih'//03s8;;t 	.AxQU#FC..q1AA#c(KSQCJJ'')EArHHHOLLNEJJu..034;;=LT4KKs
D)JJu..034JJR]]_-	. d{{d{{r8   c                    g d}t        d      j                  gt        |      z  x}}g }g }|D ]:  }t        dt	        |dz        d      }t        t        j                  j                  d      j                  t        |            |      }t        j                  j                         \  }	}
|j                  |
       |
j                         }|j                  |j!                         d	          |
j#                         \  }}|
j%                  |d
z   |       |j                  |j!                         d	          t        j                  j'                  |
j)                                = ||k(  sJ ||k(  sJ y )N)gffffff?g      @rS   r   zJan 1988rG     r   r   r   rp   r   r5  rH  rI  s                 r6   test_finder_monthlyzTestTSPlot.test_finder_monthly  s6    j)112SX==t 	.AxQV3GC..q1AA#c(KSQCJJ'')EArHHHOLLNEJJu..034JD$KKs
D)JJu..034JJR]]_-	. d{{d{{r8   c                    t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                         }|j                         d   }t        dd      j                  }||k(  sJ y )	NrF  i   r   r   r   rp   r   1989Q1)r   r   r>   r?   r@   rA   rV   rC   rD   rE   r*   r6  r8  r   r   )r1   r   r   rJ   r4   rA  r   r   s           r6   test_finder_monthly_longz#TestTSPlot.test_finder_monthly_long  s    8W3?RYY**1-==c#hGM

##%2B$$&q)Hc"**Rxxr8   c                 @   g d}|D cg c]  }t        |d      j                   }}g }dD ]  }t        d|d      }t        t        j
                  j                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                         }	|j                  |	j                         d	          t        j                  j!                  |j#                                 ||k(  sJ y c c}w )
N)r   i    rS    i  i  iz  r   rQ   )r   r:      1   c      iW  i  1987r   r   rp   r   )r   r   r   r   r>   r?   r@   rA   rV   rC   rD   rE   r*   r6  r7  r8  r9  r:  )
r1   r   rj   r   nyearsr   r   rJ   r4   rA  s
             r6   test_finder_annualzTestTSPlot.test_finder_annual  s    =356afQS!))669 	.FvvC@C..q1AA#c(KSQCJJ'')EArHHHOLLNEIIe--/23JJR]]_-	. Rxx 7s   Dc                    d}t        dd|      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                         }|j                         d   }t        dd      j                  }||k(  sJ y )	Ni  1/1/1999MinrP   r   rp   r   rQ   r   r   r>   r?   r@   rA   rV   rC   rD   rE   r*   r6  r8  r   r   )	r1   nminutesr   r   rJ   r4   rA  r   r   s	            r6   test_finder_minutelyzTestTSPlot.test_finder_minutely  s    %BRYY**1-==c#hGM

##%2B$$&q)JU+33Rxxr8   c                    d}t        dd|      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                         }|j                         d   }t        dd      j                  }||k(  sJ y )	N   r]  r    rP   r   rp   r   rQ   r_  )	r1   nhoursr   r   rJ   r4   rA  r   r   s	            r6   test_finder_hourlyzTestTSPlot.test_finder_hourly*  s    #v>RYY**1-==c#hGM

##%2B$$&q)JS)11Rxxr8   c                    t        t        j                  dt        j                        t	        dd            }t        j
                  |j                  dd t        j                  j                         \  }}|j                  |       |j                         }t        |      d	k(  sJ |d
   }|j                         }t        j                  j                  |t!        |      t        j
                        }t#        |t        j                  j$                  j                        sJ |j&                  }|ddd	f   j)                         sJ y )Nr:   r   r   r   r$   r   r   rp   r(   r   mask
fill_value)r   r>   r   r   r   nanr   rC   rD   rE   r*   r-   rV   r   maMaskedArrayr   
isinstancecorerh  r   r1   r3   rJ   r4   linesliner  rh  s           r6   	test_gapszTestTSPlot.test_gaps6  s    IIb

+:lTV3W
 vv!

##%2
25zQQx uu  DJ266 J$

 6 6777yyAaCF|!!!r8   c                    t        t        j                  dt        j                        t	        dd            }|j
                  g d   }t        j                  |j
                  dd t        j                  j                         \  }}|j                  |	      }|j                         }t        |      d
k(  sJ |d   }|j                         }t        j                  j                  |t!        |      t        j                        }t#        |t        j                  j$                  j                        sJ |j&                  }|ddd
f   j)                         sJ y )Nr  r   r   r   r$   	r   r(   r   r   r   r;   rM        r   r   rp   r(   r   rg  )r   r>   r   r   r   r   rj  rC   rD   rE   r*   r-   rV   r   rk  rl  r   rm  rn  rh  r   ro  s           r6   test_gaps_irregularzTestTSPlot.test_gaps_irregularH  s	   IIb

+:lTV3W
 WW34vv!

##%2WWW^5zQQx uu  DJ266 J$

 6 6777yyAaCF|!!!r8   c                    g d}t        t        j                  j                  d      j	                  t        |            |      }t        j                  |j                  dd t        j                  j                         \  }}|j                  |       |j                         }t        |      dk(  sJ |d   }|j                         }t        j                  j                  |t!        |      t        j                        }t#        |t        j                  j$                  j                        sJ |j&                  }|dddf   j)                         sJ y )Nrt  r   r   rp   r(   r   rg  )r   r>   r?   r@   rA   rV   rj  r   rC   rD   rE   r*   r-   r   rk  rl  r   rm  rn  rh  r   )	r1   rX   r   rJ   r4   rp  rq  r  rh  s	            r6   test_gaps_non_tszTestTSPlot.test_gaps_non_ts\  s    ,RYY**1-==c#hGM1

##%2B5zQQx uu  DJ266 J$

 6 6777yyAaCF|!!!r8   c                    t        t        j                  dt        j                        t	        dd            }t        j
                  |j                  dd t        j                  j                         \  }}|j                  |       t	        |j                  d	   |j                  d
   d      }t        t        j                  j                  d      j                  t        |            |      }|j                  d       |j!                         }t        |      dk(  sJ t        |j"                  j!                               dk(  sJ |d	   }|j%                         }t        j&                  j)                  |t+        |      t        j
                        }t-        |t        j&                  j.                  j(                        sJ |j0                  }	|	dddf   j3                         sJ y )Nr:   r   r   r   r$   r   r   rp   r   r'   12hrQ   r   Tsecondary_yr(   rg  )r   r>   r   r   r   rj  r   rC   rD   rE   r*   r%   r?   r@   rA   rV   r-   right_axr   rk  rl  r   rm  rn  rh  r   )
r1   lowrJ   r4   idxhr{   rp  rq  r  rh  s
             r6   test_gap_upsamplezTestTSPlot.test_gap_upsamplem  sn   IIb

+:lTV3W
 1

##%2B#))A,		"EB299((+;;CIFM	4 5zQ2;;((*+q000Qx uu  DJ266 J$

 6 6777yyAaCF|!!!r8   c                 ^   t        t        j                  j                  d      j	                  d            }t
        j                  j                         \  }}|j                  d      }t        |d      sJ t        |d      rJ |j                         }|j                         d   }t        |j                         |j                               }t        j                  ||       |j!                         j#                         dk(  sJ |d   j!                         j%                         rJ y )	Nr   r:   Tr|  left_axr~  r   right)r   r>   r?   r@   rA   rC   rD   rE   r*   r   get_axesr-   r   r.   r  assert_series_equal	get_yaxisget_ticks_positionget_visible)r1   r   rq   rJ   r4   axesrq  r   s           r6   test_secondary_yzTestTSPlot.test_secondary_y  s    RYY**1-==bAB$$&QXX$X'r9%%%2z***||~||~a DNN$dnn&67
sB'||~002g===7$$&224444r8   c                    t        t        j                  j                  d      j	                  d             t        t        j                  j                  d      j	                  d            }t
        j                  j                         \  }}|j                  |       |j                         j                         dk(  sJ y )Nr   r:   rp   left)r   r>   r?   r@   rA   rC   rD   rE   r*   r  r  )r1   ser2rJ   ax2s       r6   test_secondary_y_yaxisz!TestTSPlot.test_secondary_y_yaxis  s    ryy$$Q'77;<bii++A.>>rBC$$&3		S	}}113v===r8   c                    t        t        j                  j                  d      j	                  d            }t        t        j                  j                  d      j	                  d            }|j                         }|j                  d      }|j                         j                         sJ t        |d      rJ t        |d      sJ t        |d      sJ t        |d      rJ y )Nr   r:   Tr|  r  r~  )	r   r>   r?   r@   rA   r*   r  r  r   )r1   r   r  r4   r  s        r6   test_secondary_bothzTestTSPlot.test_secondary_both  s    RYY**1-==bABbii++A.>>rBCYY[hh4h(||~))+++2y)))r:&&&sI&&&3
++++r8   c                    t        ddd      }t        t        j                  j	                  d      j                  d      |      }t        j                  j                         \  }}|j                  d      }t        |d      sJ t        |d	      rJ |j                         }|j                         d
   }t        |j                         |j                               j                         }|j                   j#                  d      |_        t%        j&                  ||       |j)                         j+                         dk(  sJ |d
   j)                         j-                         rJ y )Nr#  r:   ns)r!   unitr   Tr|  r  r~  r   r  )r   r   r>   r?   r@   rA   rC   rD   rE   r*   r   r  r-   r   r.   r  r%   as_unitr  r  r  r  r  )	r1   rX   r   rq   rJ   r4   r  rq  r   s	            r6   test_secondary_y_tszTestTSPlot.test_secondary_y_ts  s   Rd;RYY**1-==bA3G$$&QXX$X'r9%%%2z***||~||~a DNN$dnn&67DDF88##D)
sB'||~002g===7$$&224444r8   c                 :   t        dd      }t        t        j                  j	                  d      j                  d      |      }t        j                  j                         \  }}|j                  |       |j                         j                         dk(  sJ y )Nr#  r:   r   r   rp   r  )r   r   r>   r?   r@   rA   rC   rD   rE   r*   r  r  )r1   rX   r  rJ   r  s        r6   test_secondary_y_ts_yaxisz$TestTSPlot.test_secondary_y_ts_yaxis  su    R0bii++A.>>rBCH$$&3		S	}}113v===r8   c                     t        dd      }t        t        j                  j	                  d      j                  d      |      }|j                         }|j                         j                         sJ y )Nr#  r:   r   r   )	r   r   r>   r?   r@   rA   r*   r  r  )r1   rX   r  r4   s       r6   test_secondary_y_ts_visiblez&TestTSPlot.test_secondary_y_ts_visible  sW    R0bii++A.>>rBCHYY[||~))+++r8   c                    t        j                  d       t        t        j                  j                  d      j                  d            }t        j                  j                         \  }}|j                  dd|      }t        |d      sJ t        |d      rJ |j                         }|d	   j                         j                         d
k(  sJ y )Nscipyr   r:   Tdensityr}  kindr4   r  r~  r(   r  )rv   importorskipr   r>   r?   r@   rA   rC   rD   rE   r*   r   r  r  r  r1   r   rq   r4   r  s        r6   test_secondary_kdezTestTSPlot.test_secondary_kde  s    G$RYY**1-==bAB**%%'RXX$Y2X>r9%%%2z***||~Aw  "5577BBBr8   c                 H   t        t        j                  j                  d      j	                  d            }t
        j                  j                         \  }}|j                  dd|       |j                         }|d   j                         j                         dk(  sJ y )Nr   r:   Tbarr  r(   r  )r   r>   r?   r@   rA   rC   rD   rE   r*   r  r  r  r  s        r6   test_secondary_barzTestTSPlot.test_secondary_bar  s}    RYY**1-==bAB**%%'RT"5||~Aw  "5577BBBr8   c                    t        t        j                  j                  d      j	                  d      g d      }|j                  ddgd      }|d	   j                         j                         d
k(  sJ |d   j                         j                         dk(  sJ |d   j                         j                         d
k(  sJ y )Nr   r   rR   re   r!  cr   re   r  T)r}  rE   r   r  r(   r  r
   r>   r?   r@   rA   r*   r  r  r1   rI   r  s      r6   test_secondary_framezTestTSPlot.test_secondary_frame  s    II!!!$44V<o
 wwC:w=Aw  "5577BBBAw  "5576AAAAw  "5577BBBr8   c                    t        t        j                  j                  d      j	                  d      g d      }|j                  dddgd	      }|d
   j                         j                         dk(  sJ |d   j                         j                         dk(  sJ |d   j                         j                         dk(  sJ y )Nr   r  r  r  r  re   r  T)r  r}  rE   r   r  r(   r  r  r  s      r6   test_secondary_bar_framez#TestTSPlot.test_secondary_bar_frame  s    II!!!$44V<o
 wwESzDwIAw  "5577BBBAw  "5576AAAAw  "5577BBBr8   c                    t        t        j                  dt        j                        t	        ddd            }|j
                  g d   }t        j                  j                         \  }}|j                  |       |j                  d	|
      }|j                         }d}t        j                  t        |      5  t        |d   j                               }t        |d   j                               }	t        j                   ||j"                  j%                  d             t        j                   |	|j"                  j%                  d             |j'                         \  }
}|j"                  j%                         }d d d        
d   j(                  k  sJ |d   j(                  k\  sJ y # 1 sw Y   2xY wNrv  r   r   ro   r   r$   r   r   r:   r   rM        ru  rp   gr   r  rt   r   r(   r'   )r   r>   r   r   r   r   rC   rD   rE   r*   r-   r  r  r	  r   r.   r  r%   r   r$  r   r1   s1s2rJ   r4   r  rp  ry   idx1idx2r  r  pidxs                r6   test_mixed_freq_regular_firstz(TestTSPlot.test_mixed_freq_regular_first  sd   IIb

+\2C@
 WW34 

##%2
2ggCBg'/''SA 	(uQx1134DuQx1134D!!$(:(:3(?@!!$(:(:3(?@,,.KD%88%%'D	( tAw&&&R(((((	( 	(s   CF66F?c                    t        t        j                  dt        j                        t	        dd            }|j
                  g d   }t        j                  j                         \  }}|j                  d|       |j                  |	       t        |d
      rJ |j                         }|d   j                         }t        j                  ||j                  j!                  t"              j$                         |d   j                         }t        j                  ||j                  j!                  t"              j$                         y Nrv  r   r   r   r$   r  r  r   rp   r"   r   r(   )r   r>   r   r   r   r   rC   rD   rE   r*   r   r-   r.   r  assert_numpy_array_equalr%   r   r   rU   r1   r  r  rJ   r4   rp  x1x2s           r6   test_mixed_freq_irregular_firstz*TestTSPlot.test_mixed_freq_irregular_first  s    IIb

+:lTV3W
 WW34

##%2
cb!
22v&&&1X!
##B(?(F(FG1X!
##B(?(F(FGr8   c                    t        t        j                  dt        j                        t	        ddd            j                         }|j                  g dd d f   }t        j                  j                         \  }}|j                  |       |j                  d	|
      }|j                         }d}t        j                  t        |      5  t        |d   j!                               }t        |d   j!                               }	|j#                  |j$                  j'                  d            sJ |	j#                  |j$                  j'                  d            sJ |j)                         \  }
}|j$                  j'                         }d d d        
d   j*                  k  sJ |d   j*                  k\  sJ y # 1 sw Y   2xY wr  )r   r>   r   r   r   to_framer   rC   rD   rE   r*   r-   r  r  r	  r   r.   equalsr%   r   r$  r   r  s                r6    test_mixed_freq_regular_first_dfz+TestTSPlot.test_mixed_freq_regular_first_df  sw   IIb

+\2C@
 (* 	 WW3Q67

##%2
2ggCBg'/''SA 	(uQx1134DuQx1134D;;rxx11#6777;;rxx11#6777,,.KD%88%%'D	( tAw&&&R(((((	( 	(s   B>GGc                    t        t        j                  dt        j                        t	        dd            j                         }|j                  g dd d f   }t        j                  j                         \  }}|j                  d|       |j                  |	       t        |d
      rJ |j                         }|d   j                         }t        j                  ||j                   j#                  t$              j&                         |d   j                         }t        j                  ||j                   j#                  t$              j&                         y r  )r   r>   r   r   r   r  r   rC   rD   rE   r*   r   r-   r.   r  r  r%   r   r   rU   r  s           r6   "test_mixed_freq_irregular_first_dfz-TestTSPlot.test_mixed_freq_irregular_first_df"  s    IIb

+:lTV3W

(* 	 WW3Q67

##%2
cb!
22v&&&1X!
##B(?(F(FG1X!
##B(?(F(FGr8   c                 F   t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                  |       |j                         D ]+  }t        |j                         	      j                  dk(  r+J  y )
Nr]  m  r}   r   rM  r   r   rp   r  r   r   r>   r?   r@   rA   rV   rC   rD   rE   r*   r-   r   r.   r"   r1   r  idxlhighr  rJ   r4   rq  s           r6   test_mixed_freq_hf_firstz#TestTSPlot.test_mixed_freq_hf_first2  s    *c<*bt<bii++A.>>s4yI4PRYY**1-==c$iH$O

##%2		R	BLLN 	BDDNN$45::cAAA	Br8   c                    t        ddd      }t        j                  j                  d      j	                  d      }t        ||      }|j                  d      j                         }t        j                  j                         \  }}|j                  |	      }|j                  d
|       |j                  d   j                         d   |j                  d   j                         d   k(  sJ y )Nz2012-01-01 13:00
2012-01-02r    rQ   r   rM  r$   r|   rp   rr   r   r(   )r   r>   r?   r@   rA   r   r  interpolaterC   rD   rE   r*   rp  r.   )r1   ts_indts_datar3   ts2rJ   r4   s          r6   test_mixed_freq_alignmentz$TestTSPlot.test_mixed_freq_alignment=  s    .3G))''*::2>G6*ii**,

##%2WWW^sr"xx{$$&q)RXXa[-B-B-DQ-GGGGr8   c                    t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  d|	       |j                  d|	       |j                         D ]+  }t        |j                         
      j                  dk(  r+J  |j                         }t        |j                         dk(  sJ t        j                  j#                  |j%                                y )Nr]  r  r}   r   rM  r   r   T)legendr4   r  )r   r   r>   r?   r@   rA   rV   rC   rD   rE   r*   r-   r   r.   r"   
get_legendtextsr9  r:  )	r1   r  r  r  r  rJ   r4   rq  legs	            r6   test_mixed_freq_lf_firstz#TestTSPlot.test_mixed_freq_lf_firstJ  s   *c<*bt<bii++A.>>s4yI4PRYY**1-==c$iH$O

##%2$		"	%LLN 	BDDNN$45::cAAA	Bmmo399~"""

)r8   c                 F   t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                  |       |j                         D ]+  }t        |j                         	      j                  dk(  r+J  y )
Nr]     r|   r   rS   r    r   rp   r  r  r  s           r6   test_mixed_freq_lf_first_hourlyz*TestTSPlot.test_mixed_freq_lf_first_hourlyX  s    *c>*ac:bii++A.>>s4yI4PRYY**1-==c$iH$O

##%2B		R	LLN 	DDDNN$45::eCCC	Dr8   c                 (   t        t        j                  dt        j                        t	        dd            }|j
                  g d   }d}t        j                  t        |      5  t        d	dd
      }d d d        t        t        j                  j                  d      j                  t                    |      }t        j                  j!                         \  }}|j#                  |       |j#                  |       y # 1 sw Y   xY w)Nr  r   r   r   r$   )r   r(   r   rR   rS   r   rT   r      r;   r:   ru              r  rt   z1/3/2000ro   r   r   rp   )r   r>   r   r   r   r   r  r  r	  r   r?   r@   rA   rV   rC   rD   rE   r*   )r1   r3   r   ry   r   psrJ   r4   s           r6   test_mixed_freq_irreg_periodz'TestTSPlot.test_mixed_freq_irreg_periodc  s    IIb

+:lTV3W
 NO/''SA 	Az2C@C	ABII))!,<<SXFL

##%2

b

2	A 	As   *DDc                 &   t        ddd      }|d d j                  |dd        }t        t        t	        |            |      }t        t        t	        |            |      }t
        j                  j                  dd      \  }\  }}|j                  |	       |j                  |	       |j                  d
k(  sJ |j                  d
k(  sJ |j                  d   j                         d   |j                  d   j                         d   k(  sJ y )N
2015-01-01rR   r   r   r(   r   T)nrowssharexrp   r   r   r&   )r   rW   r   rB   rV   rC   rD   rE   r*   r"   rp  r   r1   r  r  r  r  rJ   ax1r  s           r6   test_mixed_freq_shared_axz$TestTSPlot.test_mixed_freq_shared_axq  s    ,=BQx~~d12h'E#d)$d+E#d)$d+

++!D+A:C
3
3xx3xx3yy|&&(.#))A,2I2I2KD2QQQQr8   c                    t        ddd      }|d d j                  |dd        }t        t        t	        |            |      }t        t        t	        |            |      }t
        j                  j                         \  }}|j                         }|j                  |       |j                  |       |j                  d   j                         d	   |j                  d   j                         d	   k(  sJ y 
Nr  rR   r   r   r(   r   rp   r   r&   r   rW   r   rB   rV   rC   rD   rE   twinxr*   rp  r   r  s           r6    test_mixed_freq_shared_ax_twin_xz+TestTSPlot.test_mixed_freq_shared_ax_twin_x  s    ,=BQx~~d12h'E#d)$d+E#d)$d+$$&3iik
3
3yy|&&(.#))A,2I2I2KD2QQQQr8   zTODO (GH14330, GH14322))reasonc                    t        ddd      }|d d j                  |dd        }t        t        t	        |            |      }t        t        t	        |            |      }t
        j                  j                         \  }}|j                         }|j                  |       |j                  |       |j                  d   j                         d	   |j                  d   j                         d	   k(  sJ y r  r  r  s           r6   0test_mixed_freq_shared_ax_twin_x_irregular_firstz;TestTSPlot.test_mixed_freq_shared_ax_twin_x_irregular_first  s     ,=BQx~~d12h'E#d)$d+E#d)$d+$$&3iik
3
3yy|&&(.#))A,2I2I2KD2QQQQr8   c                    t         j                  j                         \  }}t        dt        dg      }t        t        t        |            |      }|j                  |       |j                         d   j                         }|j                  j                         t        |      j                         k  sJ t        |      j                         |j                  j                         k  sJ y )Nr  z
2015-01-03rp   r   )rC   rD   rE   r   r   r   rB   rV   r*   r-   r.   r%   r|   max)r1   rJ   r4   dtir{   r5   s         r6   test_nat_handlingzTestTSPlot.test_nat_handling  s    

##%2\3=>5S?C(	"q!++-ww{{}u 1 1 3333e}  "aggkkm333r8   c                 0   t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       d	}t        j                  t        |
      5  |j                  |d       d d d        y # 1 sw Y   y xY w)Nr]  4   r~   r   rM  r   r   rp   zz'how' is not a valid keyword for plotting functions. If plotting multiple objects on shared axes, resample manually first.rt   foo)r4   how)r   r   r>   r?   r@   rA   rV   rC   rD   rE   r*   rv   rw   r   )r1   r  r  r  r  rJ   r4   ry   s           r6   *test_to_weekly_resampling_disallow_how_kwdz5TestTSPlot.test_to_weekly_resampling_disallow_how_kwd  s    *bs;*bt<bii++A.>>s4yI4PRYY**1-==c$iH$O

##%2		R	H 	 ]]:S1 	'HHH&	' 	' 	's   /DDc                 Z   t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                  |       |j                         D ]5  }t        |j                         	      j                  |j                  k(  r5J  y )
Nr]  r  r~   r   rM  r   r   rp   r  r  r  s           r6   test_to_weekly_resamplingz$TestTSPlot.test_to_weekly_resampling  s    *bs;*bt<bii++A.>>s4yI4PRYY**1-==c$iH$O

##%2		R	BLLN 	HDDNN$45::diiGGG	Hr8   c                    t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                  |       |j                         j                  j                  t        j                        }t        j                  g d	t        j                  
      }|j!                         D ]  }	t#        |	j%                               j&                  |j&                  k(  sJ |	j%                  d      }
t        |
      dk(  rt)        j*                  |
|       mt)        j*                  |
|        y )Nr]  r  r~   r   rM  r   r   rp   i  i  i  i  i  i   i  i  i  i  i  i  r   r  Forig)r   r   r>   r?   r@   rA   rV   rC   rD   rE   r*   r   asi8r   r   rc   r-   r   r.   r"   r  r  )r1   r  r  r  r  rJ   r4   
expected_h
expected_lrq  r5   s              r6   test_from_weekly_resamplingz&TestTSPlot.test_from_weekly_resampling  sS   *bs;*bt<bii++A.>>s4yI4PRYY**1-==c$iH$O

##%2B		R	^^%**11"**=
XXT**

 LLN 	?DDNN$45::diiGGGNNN.E5zR++E:>++E:>	?r8   zkind1, kind2)rq  area)r  rq  c                 "   t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |      df      |g d	
      }t        t        j                  j	                  d      j                  t        |      df      |g d	
      }t        j                  j                         \  }}|j                  |d|       |j                  |d|       t        j                  g dt        j                        }	t        j                  t        |	      t        j                        }
t        d      D ]  }|j                  |   }t        |j!                               j"                  |j"                  k(  sJ t%        j&                  |j!                  d      |	       |
||   j(                  z  }
t%        j&                  |j+                  d      |
        |j-                         j.                  j1                  t        j                        }	t        j                  t        |	      t        j                        }
t        d      D ]  }|j                  d|z      }t        |j!                               j"                  |j"                  k(  sJ t%        j&                  |j!                  d      |	       |
||   j(                  z  }
t%        j&                  |j+                  d      |
        y )Nr]  r  r~   r   rM  r   r   rR   r   r(   r   r   Tr  stackedr4   r  r   Fr  r  )r   r
   r>   r?   r@   rV   rC   rD   rE   r*   rc   r   zerosrB   rp  r   r.   r"   r  r  rU   r   r   r	  r   )r1   kind1kind2r  r  r  r  rJ   r4   
expected_x
expected_yrd   rq  s                r6   $test_from_resampling_area_line_mixedz/TestTSPlot.test_from_resampling_area_line_mixed  sY   *bs;*bt<II!!!$++SYN;

 II!!!$++SYN;
 

##%2eTb1		udr	2 XX **

" XXc*oRZZ@
q 	PA88A;Dt~~/055BBB''E(BJO#a&--'J''E(BJO	P ^^%**11"**=
XXc*oRZZ@
q 	PA88AE?DDNN$45::diiGGG''E(BJO$q'..(J''E(BJO	Pr8   c                 $   t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |      df      |g d	
      }t        t        j                  j	                  d      j                  t        |      df      |g d	
      }t        j                  j                         \  }}|j                  |d|       |j                  |d|       |j                         j                  j                  t        j                        }	t        j                  t        |	      t        j                        }
t        d      D ]  }|j                   |   }t#        |j%                               j&                  |j&                  k(  sJ t)        j*                  |j%                  d      |	       |
||   j,                  z  }
t)        j*                  |j/                  d      |
        t        j0                  g dt        j                        }	t        j                  t        |	      t        j                        }
t        d      D ]  }|j                   d|z      }t#        |j%                               j&                  |j&                  k(  sJ t)        j*                  |j%                  d      |	       |
||   j,                  z  }
t)        j*                  |j/                  d      |
        y )Nr]  r  r~   r   rM  r   r   rR   r  r   Tr  r   r  Fr  r  )r   r
   r>   r?   r@   rV   rC   rD   rE   r*   r   r	  r   r   r  rB   rp  r   r.   r"   r  r  rU   r   rc   )r1   r  r  r  r  r  r  rJ   r4   r  r  rd   rq  rp  s                 r6   0test_from_resampling_area_line_mixed_high_to_lowz;TestTSPlot.test_from_resampling_area_line_mixed_high_to_low  sY   *bs;*bt<II!!!$++SYN;

 II!!!$++SYN;

 

##%2		udr	2eTb1 ^^%**11"**=
XXc*oRZZ@
q 	PA88A;DDNN$45::diiGGG''E(BJO$q'..(J''E(BJO	P XX **

" XXc*oRZZ@
q 	QAHHQUOEEOO$56;;tyyHHH''U(CZP#a&--'J''U(CZP	Qr8   c                    t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                  |       t        |j                               dk(  sJ |j                         D ]+  }t        |j                         	      j                  d
k(  r+J  y Nz2014-07-01 09:00r{   r   rP   100msr  r   rp   r  r   r  r  s           r6   "test_mixed_freq_second_millisecondz-TestTSPlot.test_mixed_freq_second_millisecondD  s    ,3B,7BGbii++A.>>s4yI4PRYY**1-==c$iH$O

##%2		R	B2<<>"a'''LLN 	CDDNN$45::dBBB	Cr8   c                    t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                  |       t        |j                               dk(  sJ |j                         D ]+  }t        |j                         	      j                  d
k(  r+J  y r  r  r  s           r6   .test_mixed_freq_second_millisecond_low_to_highz9TestTSPlot.test_mixed_freq_second_millisecond_low_to_highR  s    ,3B,7BGbii++A.>>s4yI4PRYY**1-==c$iH$O

##%2B		R	2<<>"a'''LLN 	CDDNN$45::dBBB	Cr8   c                    t        ddd      t        ddd      t        ddd      g}t        t        j                  j	                  d      j                  t        |      df      t        |t                    }t        |j                         y )Nr   r(   r   rv  r   rR   r   )r   r
   r>   r?   r@   rA   rV   r   r   r)   r*   r]   s      r6   test_irreg_dtypeszTestTSPlot.test_irreg_dtypes`  sp    D!QdAq!14a3DEII!!!$44c#h]C#V$
 	"''"r8   c                 H   t        dd      }|g d   j                  t              }t        t        j
                  j                  d      j                  t        |      df      |      }t        j                  j                         \  }}t        |j                  |       y )Nr#  r:   r   )r   r   r   r;   r   rR   rp   )r   r   r   r
   r>   r?   r@   rA   rV   rC   rD   rE   r)   r*   )r1   rX   rI   rJ   r4   s        r6   test_irreg_dtypes_dt64z!TestTSPlot.test_irreg_dtypes_dt64i  sv    R0,&&v.ryy,,Q/??S1NPST

##%2"''b)r8   c                    t        dddddd      }t        j                  j                  d      j	                  ddd      j                         }t        j                  |D cg c](  }|t        t        |            z   j                         * c}      }t        t        j                  j                  d      j                  t        |            t        j                  j                  d      j                  t        |            d|	      }t        j                  j                         \  }}|j!                  |
       |j#                         }|j%                         }	t'        ||	d      D ]  \  }
}t)        t        |
      d      \  }}t)        |d      \  }}|j+                         }t        |      dkD  sL|dk7  rt        |||      j-                  d      }nt        |||      j-                  d      }||k(  rJ  y c c}w )Nr(   rR   r  r   r   rv  r  r   r$   rp   Tr   <   %H:%M:%S%H:%M)r   r>   r?   r@   integerscumsumrc   r   r&  r   r
   rA   rV   rC   rD   rE   r*   
get_xticksrF   r   divmodget_textstrftimer1   tdeltasrj   r3   rI   rJ   r4   tickslabels_tick_labelmr{   r    r   r   s                    r6   	test_timezTestTSPlot.test_timeq  s   Q1aQ'&&q)221b!<CCEXXvN!Ic!f55;;=NOYY**1-==c"gFYY**1-==c"gF 
 

##%2
2 ##% t< 		 ME6#e*b)DAq!R=DAq"B2w{6aA//
;BaA//8BRxx		  Os   "-Hc                    t        dddddd      }t        j                  j                  d      j	                  ddd      j                         }t        j                  |D cg c](  }|t        t        |            z   j                         * c}      }t        t        j                  j                  d      j                  t        |            t        j                  j                  d      j                  t        |            d|	      }t        j                  j                         \  }}|j!                  |
       |j#                         }|j%                         }	t'        ||	d      D ]  \  }
}t)        t        |
      d      \  }}t)        |d      \  }}|j+                         }t        |      dkD  sL|dk7  rt        |||      j-                  d      }nt        |||      j-                  d      }||k(  rJ  |j/                  dd       |j#                         }|j%                         }	t'        ||	d      D ]  \  }
}t)        t        |
      d      \  }}t)        |d      \  }}|j+                         }t        |      dkD  sL|dk7  rt        |||      j-                  d      }nt        |||      j-                  d      }||k(  rJ  y c c}w )Nr(   rR   r  r   r   rv  r  r   r$   rp   Tr   r%  r&  r'  z1:30z5:00)r   r>   r?   r@   r(  r)  rc   r   r&  r   r
   rA   rV   rC   rD   rE   r*   r*  rF   r   r+  r,  r-  r%  r.  s                    r6   test_time_change_xlimz TestTSPlot.test_time_change_xlim  si   Q1aQ'&&q)221b!<CCEXXvN!Ic!f55;;=NOYY**1-==c"gFYY**1-==c"gF 
 

##%2
2 ##% t< 		 ME6#e*b)DAq!R=DAq"B2w{6aA//
;BaA//8BRxx		  	FF# ##% t< 		 ME6#e*b)DAq!R=DAq"B2w{6aA//
;BaA//8BRxx		 ? Os   "-Kc                    t        dddddd      }t        j                  j                  d      j	                  ddd      j                         }t        j                  |D cg c](  }|t        t        |            z   j                         * c}      }t        t        j                  j                  d      j                  t        |            t        j                  j                  d      j                  t        |            d|	      }t        j                  j                         \  }}|j!                  |
      }|j#                         }|j%                         }	t'        ||	d      D ]  \  }
}t)        t        |
      d      \  }}t+        |
t        |
      z
  dz        }t)        |d      \  }}|j-                         }t        |      dkD  sf|dz  dk7  rt        ||||      j/                  d      }ni|dz  dk7  r!t        ||||      j/                  d      d d }n@|dk7  rt        ||||      j/                  d      }nt        ||||      j/                  d      }||k(  rJ  y c c}w )Nr(   rR   r  r   r   rv  )microsecondsr   r$   rp   Tr   r%  g    .Ai  z%H:%M:%S.%fr&  r'  )r   r>   r?   r@   r(  r)  rc   r   r&  r   r
   rA   rV   rC   rD   rE   r*   r*  rF   r   r+  roundr,  r-  )r1   r/  r0  rj   r3   rI   rJ   r4   r1  r2  r3  r4  r5  r{   r   r    r   r   s                     r6   test_time_museczTestTSPlot.test_time_musec  s   Q1aQ'&&q)221b!<CCEXXFSqI3q6::@@BSTYY**1-==c"gFYY**1-==c"gF 
 

##%2WWW^ ##% t< 	 ME6#e*b)DAqE
*c12B!R=DAq"B2w{I!#aAr*33MBBDjQ&aAr*33MB3BGB!VaAr*33J?BaAr*33G<BRxx!	  Ts   "-I0c                    t        ddd      }t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}|j                  |       |j                  d	|
      }|j                         D ]*  }t        |j                               j                  dk(  r*J  t        |d      sJ t        |d      rJ |j                   j                         D ]*  }t        |j                               j                  dk(  r*J  y )Nr]  r  r}   r   rM  r   r   rp   Tr}  r4   r  r~  )r   r   r>   r?   r@   rA   rV   rC   rD   rE   r*   r-   r   r.   r"   r   r  r  s           r6   test_secondary_upsamplez"TestTSPlot.test_secondary_upsample  s8   *c<*bt<bii++A.>>s4yI4PRYY**1-==c$iH$O

##%2BYY4BY/LLN 	=Dt~~/055<<<	=r9%%%2z***JJ((* 	=Dt~~/055<<<	=r8   c           	         t         j                  j                         }|j                  d      }t	        t
        j                  j                  d      j                  d      t        t        d      t              t        ddd	      
      }|j                  ddg|       |j                         }t        |j!                               dk(  sJ |j#                         d   j%                         dk(  sJ |j#                         d   j%                         dk(  sJ |j#                         d   j%                         dk(  sJ |j#                         d   j%                         dk(  sJ |j&                  j                         J t)               }|j!                         D ]!  }|j+                  |j-                                # t        |      dk(  sJ y )N   r   r:   rS   ABCDr   
2000-01-01r:   ro   r   r   r%   rn   r?  rS   r   	A (right)r(   z	B (right)r   rR   r}   )rC   rD   figureadd_subplotr
   r>   r?   r@   rA   r   listr   r   r*   r  rV   r-   	get_textsr,  r~  setaddr   )r1   rq   r4   rI   r  colorsrq  s          r6   test_secondary_legendz TestTSPlot.test_secondary_legend  s   jj!__S! II!!!$44W=$v,f5\2C@

 	S#J2.mmo3==?#q(((}}q!**,;;;}}q!**,;;;}}q!**,333}}q!**,333{{%%'///MMO 	)DJJt~~'(	) 6{ar8   c           	         t        t        j                  j                  d      j	                  d      t        t        d      t              t        ddd      	      }t        j                  j                         }|j                  d
      }|j                  ddgd|       |j                         }t        |j!                               dk(  sJ |j#                         d   j%                         dk(  sJ |j#                         d   j%                         dk(  sJ |j#                         d   j%                         dk(  sJ |j#                         d   j%                         dk(  sJ y )Nr   rC  rD  r   rE  r:   ro   r   rF  rB  rn   r   F)r}  
mark_rightr4   rS   r   r(   rR   r}   )r
   r>   r?   r@   rA   r   rJ  r   r   rC   rD   rH  rI  r*   r  rV   r-   rK  r,  r1   rI   rq   r4   r  s        r6   test_secondary_legend_rightz&TestTSPlot.test_secondary_legend_right  s'   II!!!$44W=$v,f5\2C@

 jj!__S!
S#J5R@mmo3==?#q(((}}q!**,333}}q!**,333}}q!**,333}}q!**,333r8   c           	         t        t        j                  j                  d      j	                  d      t        t        d      t              t        ddd      	      }t        j                  j                         \  }}|j                  d
dg|       |j                         }|j                         d   j                         dk(  sJ |j                         d   j                         dk(  sJ y )Nr   rC  rD  r   rE  r:   ro   r   rF  r  rn   )r  r}  r4   r   rG  r(   r
   r>   r?   r@   rA   r   rJ  r   r   rC   rD   rE   r*   r  rK  r,  rR  s        r6   test_secondary_legend_barz$TestTSPlot.test_secondary_legend_bar  s    II!!!$44W=$v,f5\2C@

 **%%'R
U"5mmo}}q!**,;;;}}q!**,333r8   c           	         t        t        j                  j                  d      j	                  d      t        t        d      t              t        ddd      	      }t        j                  j                         \  }}|j                  d
dgd|       |j                         }|j                         d   j                         dk(  sJ |j                         d   j                         dk(  sJ y )Nr   rC  rD  r   rE  r:   ro   r   rF  r  rn   F)r  r}  rQ  r4   r   r(   rU  rR  s        r6   test_secondary_legend_bar_rightz*TestTSPlot.test_secondary_legend_bar_right!  s    II!!!$44W=$v,f5\2C@

 **%%'R
U%BGmmo}}q!**,333}}q!**,333r8   c           	      4   t        t        j                  j                  d      j	                  d      t        t        d      t              t        ddd      	      }t        j                  j                         }|j                  d
      }t        t        j                  j                  d      j	                  d      t        t        d      t              t        ddd      	      }|j                  ddg|      }|j                         }t        |j!                               dk(  sJ |j"                  j                         J t%               }|j!                         D ]!  }|j'                  |j)                                # t        |      dk(  sJ y )Nr   rC  rD  r   rE  r:   ro   r   rF  rB  r   r}   r?  rS   )r
   r>   r?   r@   rA   r   rJ  r   r   rC   rD   rH  rI  r*   r  rV   r-   r~  rL  rM  r   )r1   rI   rq   r4   r  rN  rq  s          r6   test_secondary_legend_multi_colz*TestTSPlot.test_secondary_legend_multi_col-  s>   II!!!$44W=$v,f5\2C@

 jj!__S!II!!!$44W=$v,f5\2C@

 WW#sW3mmo3==?#q((({{%%'///MMO 	)DJJt~~'(	) 6{ar8   c                    t        dt        j                  d      j                  d      z  t	        t        d      t              t	        t        d      D cg c]  }d| 	 c}t                    }t        j                  j                         }|j                  d	      }|j                  d
dg|      }|j                         }t        |j                               dk(  sJ |j                   j                         J t#               }|j                         D ]!  }|j%                  |j'                                # t        |      dk(  sJ y c c}w )N皙?r3  rC  rD  r   r:   i-rF  rB  rn   ro   r?  rS   r
   r>   r   reshaper   rJ  r   rB   rC   rD   rH  rI  r*   r  rV   r-   r~  rL  rM  r   r1   rd   rI   rq   r4   r  rN  rq  s           r6   test_secondary_legend_nontsz&TestTSPlot.test_secondary_legend_nontsE     "))B-''00$v,f5595a2aS5VD

 jj!__S!WW#sW3mmo3==?#q((({{%%'///MMO 	)DJJt~~'(	) 6{a 6   Ec                    t        dt        j                  d      j                  d      z  t	        t        d      t              t	        t        d      D cg c]  }d| 	 c}t                    }t        j                  j                         }|j                  d	      }|j                  d
dg|      }|j                         }t        |j                               dk(  sJ |j                   j                         J t#               }|j                         D ]!  }|j%                  |j'                                # t        |      dk(  sJ y c c}w )Nr\  r3  rC  rD  r   r:   r]  rF  rB  r   r}   r?  rS   r^  r`  s           r6   %test_secondary_legend_nonts_multi_colz0TestTSPlot.test_secondary_legend_nonts_multi_colY  rb  rc  zApi changed in 3.6.0c                    t        ddd      }t        t        j                  j	                  d      j                  t        |      df      |      }t        j                  j                         \  }}|j                  |      }|j                         }|j                         D ]4  }t        |j                               dkD  s |j                         d	k(  r4J  y )
Nr   rM  r   r   r   rR   rp   r   r  )r   r
   r>   r?   r@   rA   rV   rC   rD   rE   r*   r6  get_ticklabelsr,  get_rotation)r1   r   rI   rJ   r4   rA  rq  s          r6   test_format_date_axisz TestTSPlot.test_format_date_axism  s    Rd;ryy,,Q/??S1NPST

##%2WWW^((* 	1D4==?#a'((*b000	1r8   c                 $   t        ddd      }t        t        t        |                  }t        j
                  j                         \  }}|j                  ||d      }t        j                  t        |d   j                               |       y )Nr  r:   r}   r  r   )rK   r   )r   rJ  rB   rV   rC   rD   rE   r*   r  r  r   r.   )r1   rj   rk   rJ   r4   rp  s         r6   test_ax_plotzTestTSPlot.test_ax_plotx  sn    \2C@s1v

##%21C(
mE!H,>,>,@A1Er8   c           
         t        ddd      t        ddd      g}t        j                  ddd      }t        j                  dd	d      }t        j                  j                         \  }}|j                  |D cg c]  }|j                          c}|d
|D cg c]  }|j                          c}|d
d      \  }}t        j                  |D cg c]  }|j                          c}t        j                        }	t        j                  |j                         d d df   |	       t        j                  |j                         d d df   |	       y c c}w c c}w c c}w )N  rM     i  r(   g      $@g      &@g      ?g      (@-rS   )	linewidthr   r   )r   r>   r   rC   rD   rE   r*   	toordinalrc   r   r  r  r   )
r1   datesvalues1values2rJ   r4   rj   line1line2exps
             r6   test_mpl_nopandaszTestTSPlot.test_mpl_nopandas  s'   dB#T$2%67))D$,))D$,

##%2 GG$)*qQ[[]*$)*qQ[[]*  
	
 hhu5!5RZZH
##E$4$4$6q!t$<cB
##E$4$4$6q!t$<cB + + 6s   9EEEc                 P   t        t        j                  dt        j                        t	        dd            }|j
                  g d   }t        j                  j                         \  }}|d d j                  |       |dd  j                  |       |j                         \  }}|t        j                  j                  |j                  j                         d	|      k  sJ |t        j                  j                  |j                  j!                         d	|      k\  sJ y )
Nrv  r   r   r   r$   r(   rS   r   rT   r  r;   r:   rM  r  r  ru  r  r  r   rp    r   r>   r   r   r   r   rC   rD   rE   r*   r$  r   DatetimeConverterconvertr%   r|   r  r1   r3   ts_irregularrJ   r4   r  r  s          r6    test_irregular_ts_shared_ax_xlimz+TestTSPlot.test_irregular_ts_shared_ax_xlim  s    IIb

+:lTV3W
 wwMN 

##%2Ra$QR$ kkmet--55l6H6H6L6L6NPRTVWWWW..66|7I7I7M7M7OQSUWXXXXr8   c                 <   g d}g d}t        d|      }t        d|      }t        j                  j                         \  }}|j	                  |       |j                         \  }}|j	                  d|       |j                         \  }	}
||	k\  sJ ||
k  sJ y )	N)r(   r   rR   rS   )r   rT   r   r  r(   r$   r   rp   Tr?  )r   rC   rD   rE   r*   r$  r1   index_1index_2r  r  rJ   r4   left_beforeright_before
left_afterright_afters              r6   test_secondary_y_non_ts_xlimz'TestTSPlot.test_secondary_y_non_ts_xlim  s    AW%AW%

##%2
2$&KKM!\
DR("$++-
Kj(((k)))r8   c                 d   t        ddd      }t        ddd      }t        d|      }t        d|      }t        j                  j	                         \  }}|j                  |	       |j                         \  }}|j                  d
|       |j                         \  }	}
||	k\  sJ ||
k  sJ y )NrE  rS   r}   r  z
2000-01-05r(   r$   r   rp   Tr?  )r   r   rC   rD   rE   r*   r$  r  s              r6    test_secondary_y_regular_ts_xlimz+TestTSPlot.test_secondary_y_regular_ts_xlim  s    <E<EAW%AW%

##%2
2$&KKM!\
DR("$++-
Kj(((k)))r8   c                 h   t        ddd      }t        d|      }t        j                  j	                         \  }}|j                  |       |j                         \  }}|j                  d      j                         j                  d	|
       |j                         \  }}||k(  sJ ||k(  sJ y )NrE  r:   r|   r   r(   r$   rp   r}   Tr?  )	r   r   rC   rD   rE   r*   r$  resamplemean)	r1   r   r3   rJ   r4   r  r  r  r  s	            r6   #test_secondary_y_mixed_freq_ts_xlimz.TestTSPlot.test_secondary_y_mixed_freq_ts_xlim  s    r>AS!

##%2
2$&KKM!\
C$$"$="$++-
K j((({***r8   c                 |   t        t        j                  dt        j                        t	        dd            }|j
                  g d   }t        j                  j                         \  }}|d d j                  |       |dd  j                  d	|
       |d d j                  |       |j                         \  }}|t        j                  j                  |j                  j                         d|      k  sJ |t        j                  j                  |j                  j!                         d|      k\  sJ y )Nrv  r   r   r   r$   rz  r   rp   Tr?  r{  r|  r  s          r6   "test_secondary_y_irregular_ts_xlimz-TestTSPlot.test_secondary_y_irregular_ts_xlim  s   IIb

+:lTV3W
 wwMN

##%2Ra$QR$26Ra$kkmet--55l6H6H6L6L6NPRTVWWWW..66|7I7I7M7M7OQSUWXXXXr8   c                     t        ddd      t        ddd      g}t        j                  j                         \  }}|j	                  |       t        dddd      t        dddd      g}|j	                  |       y )Ni  r(   r   rM  )r   rC   rD   rE   r*   r   )r1   rU   rJ   r4   s       r6   test_plot_outofbounds_datetimez)TestTSPlot.test_plot_outofbounds_datetime  sj    tQ"Dq!$45

##%2
4Ar*HT1a,DE
r8   c                 D   t        j                  d      D cg c]  }d|d
 }}t        ddd      }t        t         j                  j                  d      j                  t        |      df      |      }t        j                  j                         \  }}|j                  d|	       t        j                  j                          |j                         }|D cg c]  }|j                          }	}t        |	      t        |      k(  sJ |	|k(  sJ y c c}w c c}w )
Nr:   z00:00:00.0000000z0>2d0r  r   r   rR   r<   )r>   r   r   r
   r?   r@   rA   rV   rC   rD   rE   r*   drawrF   r,  )
r1   rd   expected_labelsr   rI   rJ   r4   r2  rj   result_labelss
             r6   "test_format_timedelta_ticks_narrowz-TestTSPlot.test_format_timedelta_ticks_narrow  s    @B		"N1-aX6NNc2D9ryy,,Q/??S1NPST

##%2
r"

##%/56!66=!S%9999/// O 7s   DDc                    g d}t        ddd|      }t        t        j                  j	                  d      j                  t        |      df      |      }t        j                  j                         \  }}|j                  d|      }t        j                  j                          |j                         }|D cg c]  }|j                          }	}t        |	      t        |      k(  sJ |	|k(  sJ y c c}w )	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  r:   1 D)r!   r"   r  r   rR   r<   )r   r
   r>   r?   r@   rA   rV   rC   rD   rE   r*   r  rF   r,  )
r1   r  r  r   rI   rJ   r4   r2  rj   r  s
             r6    test_format_timedelta_ticks_widez+TestTSPlot.test_format_timedelta_ticks_wide  s    

 c2EEryy,,Q/??S1NPST

##%2WWaBW'

##%/56!66=!S%9999/// 7s   =C7c                     t        t        d      t        dd            }t        j                  j                         \  }}t        |j                  |       y )Nr   1dayr   rp   )r   rB   r   rC   rD   rE   r)   r*   )r1   r{   rJ   r4   s       r6   test_timedelta_plotzTestTSPlot.test_timedelta_plot  s=    58_VQ?@

##%2!&&R(r8   c                    t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}t        |j                  |       y )N1 day 2 hr 30 min 10 sr:   r  r   r   rp   r   r   r>   r?   r@   rA   rV   rC   rD   rE   r)   r*   r1   r%   r{   rJ   r4   s        r6   test_timedelta_long_periodz%TestTSPlot.test_timedelta_long_period  s_     8"5Q299((+;;CJGO

##%2!&&R(r8   c                    t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  j                         \  }}t        |j                  |       y )Nr  r:   z1 nsr   r   rp   r  r  s        r6   test_timedelta_short_periodz&TestTSPlot.test_timedelta_short_period$  s_     8"6R299((+;;CJGO

##%2!&&R(r8   c                     t        ddd      }|}t        j                  ddd      }t        j                  ddd      d d d   }t        j                  j                         \  }}|j                  ||g||g	       y )
Nr   r:   r    r   r   r(   g?r'   )weights)r   r>   r   rC   rD   rE   hist)r1   r   rj   w1w2rJ   r4   s          r6   	test_histzTestTSPlot.test_hist+  sp    Rc:YYq!S!YYq!S!$B$'

##%2
AR)r8   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                  j	                         \  }}|j                  |       |j                  |       |j                  |       y )Nr`   rT  rM  rn  r   i  r$   i  i  rm  rp   )r   r   rC   rD   rE   r*   )r1   r  r  rJ   r4   s        r6   test_overlapping_datetimez$TestTSPlot.test_overlapping_datetime4  s    r2&r2&r2&
 r2&r2&r2&
 

##%2
2
2
2r8   z1GH9053 matplotlib does not use ax.xaxis.converterc                    t        t        j                  j                  d      j	                  d      t        dd            }|j                         }t        j                  t              5  |j                  |j                  |j                  d       d d d        |j                  \  }}t        j                  |j                         |j                                y # 1 sw Y   KxY w)Nr   r:   z
1970-01-02r   r$   r  )r   )r   r>   r?   r@   rA   r   r*   r  r  DeprecationWarningr%   rU   rp  r  r   )r1   r{   r4   l1l2s        r6   test_add_matplotlib_datetime64z)TestTSPlot.test_add_matplotlib_datetime64N  s    
 II!!!$44R8\26
 VVX''(:; 	2GGAGGQXXSG1	2 B
##BMMOR]]_E		2 	2s   .)C!!C*c                    t        t        j                  j                  d      j                  d      ddg      }t	        ddd	      |d
<   t
        j                  j                         \  }}|j                  d
d|       t
        j                  j                          |j                         d   }d}|j                         |k(  sJ y )Nr   )r:   r   rj   rk   r  z
2018-01-01r:   r}   r   r   )rj   rk   r  r   )r
   r>   r?   r@   r   rC   rD   rE   scatterr  rF   r,  )r1   rI   rJ   r4   rK   r)  s         r6   "test_matplotlib_scatter_datetime64z-TestTSPlot.test_matplotlib_scatter_datetime64^  s    ryy,,Q/66w?#sTbsC6


##%2


Vs
,

""$Q'~~8+++r8   c                 ~    t        g d      }t        |g dd      }|j                  dd      }t        |d       y )N)
2020-05-01
2020-05-02z
2020-05-03r`   rj   rk   rj   rk   r   xrotr   r
   r*   r   r1   rj   rI   r  s       r6   test_check_xticks_rotz TestTSPlot.test_check_xticks_roti  s:     BCQY/0www$4a(r8   c                 ~    t        g d      }t        |g dd      }|j                  dd      }t        |d       y )Nr  r  z
2020-05-04r`   r  rj   rk   r  r  r  r  s       r6   test_check_xticks_rot_irregularz*TestTSPlot.test_check_xticks_rot_irregularq  s8    BCQY/0www$4b)r8   c                     t        g d      }t        |g dd      }|j                  d      j                  dd      }t	        |d	       |j                  d      j                  dd
      }t	        |d	       y )Nr  r`   r  rj   rk   T)rk   	use_indexr  r  Fr   )r   r
   	set_indexr*   r   r  s       r6   test_check_xticks_rot_use_idxz(TestTSPlot.test_check_xticks_rot_use_idxx  sl    BCQY/0||C %%t%<4b)||C %%u%=4a(r8   c                     t        g d      }t        |g dd      }|j                  dddd      }t        |d	       |j                  dddd
      }t        |d	       y )Nr  r`   r  rj   rk   T)rj   rk   rE   r  r  r  Fr   r  r  s       r6   test_check_xticks_rot_sharexz'TestTSPlot.test_check_xticks_rot_sharex  s\    BCQY/0wwd4w@4b)wwd5wA4a(r8   rX   r   UTC)r!   r#   z1 dayr   )r(   rR   rT   rv     r   c                      |t        d      |      }t        j                  dd      \  }}|j                  |       |j	                  d      5 }t        j                  ||       d d d        y # 1 sw Y   y xY w)Nr   r$   r(   rp   wb)mode)rB   pltrE   r*   openpickledump)r1   	temp_fileframe_or_seriesrX   rI   rq   r4   paths           r6   test_pickle_figzTestTSPlot.test_pickle_fig  sh     U1XS1,,q!$R
2^^^& 	#$KKT"	# 	# 	#s   A11A:)__name__
__module____qualname__rv   markfilterwarningsr7   rL   rZ   r^   rf   rr   rz   parametrizer   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  rD  rK  rN  rQ  r[  slowra  re  rr  rw  ry  r  r  r  r  r  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  r  r!  r#  r6  r8  r=  r@  rO  rS  rV  rX  rZ  ra  re  ri  rk  rx  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r   r   rB   r  ).0rd   r   s   000r6   r   r   4   s   [[ 56
< 7
<-$"#*( [[V%OP+ Q+ [[L++6 [[WtZb-Q&RS1 T1 [[VdD\2+ 3+W [[
,	-5S/TUD	D [[V%OP4 Q4
 [[E:: [[L>>
 [[V%RS2 T2 [[E)) [[ VW[[L	) X	) [[L$$'$$
$
G
78
4"+G [[B [[		"BJJ/ r: !		"BJJ7(rB  !		"BJJ7(rB 	
	
,5-25.E0,, [[
 

"$"(""".5>	,5>,CCCC)6H),H 	BH*	D [[ VW XRR [[78
R 9
R	4'	H?, [[^.>@P-QR5P S5Pn [[^.>@P-QR3Q S3QjCC#* 8+ Z! F= 24 
4
4 0 ( ( [[451 61FC.Y"* * +Y$000)))*4 [[QRF SF	,)*)) [[|Q/|Q59GQS9qs;->??4a#?vN!H	

#
#	 @s   Ur   c                 B   t         j                         }|j                          |j                  d      }|j	                  dt         j                               }t        |dd       } | |i |}	|	J |j	                  dt         j                               }|E|j                  j                  }
t        |
t              r|
j                  }
||j                  |
k(  sJ ||t        |j                  d      |k(  sJ |j                  d      }||d<    | |i |}	|	J y )NrB  r4   r"   T)	is_period   )r  gcfclfrI  popgcagetattrr%   r"   rm  r   r   r   )fr"   seriesargskwargsrq   r4   orig_axorig_axfreqr   dfreqs              r6   r)   r)     s   
'')CGGI		Bjjswwy)G'640K
T
V
C??	D#'')	$B!!eZ(OOE77e###K/D1T999		BF4L
T
V
C??r8   )NN)1__doc__r   r   r   r   r  numpyr>   rv   pandas._libs.tslibsr   r   pandas.core.dtypes.dtypesr	   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  rC   r  %pandas.plotting._matplotlib.converterplotting_matplotlib	converterr   r   r)    r8   r6   <module>r      s    @    
 2    
 
 ; ; .f,'f-. 4 4i# i#X3r8   