
    !gȳ                     L	   d Z ddlmZmZmZ ddlZddlZddlm	Z	m
Z
 ddlZddlZddlmZ ddlmZ dZ ej&                  e      Zej+                         e ej,                  e       ej.                  e      gZerdnd	Z ej4                  d
ed       ej4                  d
ed       ej4                  d
ed       ej4                  d
ed       ej4                  d
ee       ej4                  d
ee       ej4                  d
ed       ej4                  d
ed       ej4                  d
ed      g	Z ej8                  d
ed       ej8                  d
ed       ej8                  d
ed       ej8                  d
ed       ej8                  d
ed      gZ	 e ej8                  d
ed       ej8                  d
ed       ej8                  d
ed      gz  ZeD  cg c]  } | df c} ZeD  cg c]  } | df c} Z eD  cg c]  } | jC                  e"      | jF                  f! c} Z$e$D  cg c]  \  } }| j+                         |f c}} Z%e%D  cg c]  \  } } ej,                  |       |f c}} Z&eD  cg c].  }  ejN                  |       jQ                         | jF                  f0 c} Z)e)D  cg c]  \  } }| j+                         |f c}} Z*e*D  cg c]  \  } } ej,                  | e+      |f c}} Z,eD  cg c]   }  ej,                  |       | jF                  f" c} Z- ej\                   ej&                  e            df ej^                  ded      df ej^                  dedz
  d      df ej^                  dedz  d      dfgZ0e$e%z   e&z   e)z   e*z   e,z   e-z   Z1 ej&                  dedz         df ej&                  e      ddd   df ej&                  e      dz  dfdD  cg c]  } |  c} dfe"ddd i gdfgZ2g d!dfg d"dfgZ3d# Z4d$ Z5d% Z6d& Z7d' Z8d( Z9d) Z:d* Z;d+ Z<d, Z=d- Z>d. Z?ej                  j                  d/0      d1        ZBd2 ZCy# e$ r Y w xY wc c} w c c} w c c} w c c}} w c c}} w c c} w c c}} w c c}} w c c} w c c} w )3a1  
Test index support in time series models

1. Test support for passing / constructing the underlying index in __init__
2. Test wrapping of output using the underlying index
3. Test wrapping of prediction / forecasting using the underlying index or
   extensions of it.

Author: Chad Fulton
License: BSD-3
    )PD_LT_2_2_0YEAR_ENDis_int_indexN)assert_equalassert_raises)ValueWarning)	tsa_model   z2Q-DECz2QE-DEC
1950-01-01DstartperiodsfreqWMSQS2QS5s1D10minMQY2Q)dtype   r   stopstep   g      ?abcdeag>)19501952194119541991)r   
1950-01-02
1950-01-03
1950-01-04z
1950-01-06c            
      '   i t         _        t        d d D ]*  } t        j                         5  t        j
                  d       t        j                  |       }t        |j                  t        j                        s:t        j                  |j                  j                  t        j                        sJ t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j&                  j(                  d        t        |j&                  j*                  d        d d d        - t        D ]  } t        j                         5  t        j
                  d       t,        t.        z   D ]J  \  }}t        j                  | |      }||j*                  }t        |t0              s|j2                  }t        t        |j                  t        j4                  t        j6                  f      d       t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j                  j*                  |j8                         t        |j&                  j(                  j;                  |j                        d       t        |j&                  j*                  |       M 	 d d d        t        j                         5  t        j
                  d       t,        t.        z   D ]K  \  }}t        j                  | ||      }||j*                  }t        |t0              s|j2                  }t        t        |j                  t        j4                  t        j6                  f      d       t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j                  j*                  |j8                         t        |j&                  j(                  j;                  |j                        d       t        |j&                  j*                  |       N 	 d d d        t        j                         5  t        j
                  d       t<        D ]K  \  }}t        j                  | ||      }||j*                  }t        |t0              s|j2                  }t        t        |j                  t        j4                  t        j6                  f      d       t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j                  j*                  |j8                         t        |j&                  j(                  j;                  |j                        d       t        |j&                  j*                  |       N 	 d d d        t>        t@        z   D ]&  \  }}tC        tD        t         j                  | |       (  t        dd D ]  }t        j                         5  t        j
                  d       t,        t.        z   D ]_  \  }}|jG                         } || _$        t        j                  |       }||j*                  }t        |t0              s|j2                  }t        t        |j                  t        j4                  t        j6                  f      d       t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j                  j*                  |j8                         t        |j&                  j(                  j;                  |j                        d       t        |j&                  j*                  |       b 	 d d d        |jG                         } t>        d   d   | _$        t        j                  |       }tK        |j                        sJ t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j8                  d        t        |j&                  j(                  d        t        |j&                  j*                  d        |jG                         } t>        d	   d   | _$        t        j                  |       }tM        |j                        t        j                  u sJ |j                   rJ |j"                  rJ |j$                  rJ |j8                  J |j&                  j(                  J |j&                  j*                  J t        j                         5  t        j
                  d       t<        D ]  \  }}t        |t        jN                        r]|j                  tP        k(  rJt        j                         5  t        j
                  d
       t        jR                  ||      } d d d        nt        jR                  ||      } t        j                  | |      }||j*                  }t        |t0              s|j2                  }t        t        |j                  t        j4                  t        j6                  f      d       t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j                  j*                  |j8                         t        |j&                  j(                  j;                  |j                        d       t        |j&                  j*                  |        	 d d d        t        j                         5  t        j
                  d       t<        D ]l  \  }}|jG                         } t@        d   d   | _$        t        j                  | ||      }||j*                  }t        |t0              s|j2                  }t        t        |j                  t        j4                  t        j6                  f      d       t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j                  j*                  |j8                         t        |j&                  j(                  j;                  |j                        d       t        |j&                  j*                  |       o 	 d d d        d}d}t        j                  d      5 }t        j
                  d       t<        D ]  \  }}|jG                         } || _$        t        j                  |       }||j*                  }t        |t0              s|j2                  }tM        |j                        t        j4                  u sJ |j                   rJ |j"                  sJ |j$                  rJ t        |j                  j*                  |j8                         |j&                  j(                  j;                  |j                        sJ tU        |      |k(  rt        |j&                  j*                  jW                  d      d   |jW                  d      d          t        t1        |d   jX                        ||j&                  j*                  z         tU        |      } 	 d d d        d}t        j                  d      5 }t        j
                  d       t@        D ]*  \  }}|jG                         } || _$        t        j                  |       }t        t        |j                  t        jZ                  t        j                  f      d       t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j8                  d        t        |j&                  j(                  d        t        |j&                  j*                  d        t        t1        |d   jX                        |       - 	 d d d        d}t        j                  d      5 }t        j
                  d       t\        D ]'  \  }}|jG                         } || _$        t        j                  |       }t        |j                  t        j                        stK        |j                        sJ t        |j                   d       t        |j"                  d       t        |j$                  d       t        |j8                  d        t        |j&                  j(                  d        t        |j&                  j*                  d        t        t1        |d   jX                        |       * 	 d d d         t        d   } tC        tD        t         j                  | t,        d	   d   j*                         t        d   jG                         } t,        d   d   | _$        tC        tD        t         j                  | t,        d	   d   j*                         t        d   jG                         } t@        d   d   | _$        tC        tD        t         j                  | t,        d	   d   j*                         t        d   jG                         } t^        d   d   | _$        tC        tD        t         j                  | t,        d	   d   j*                         y # 1 sw Y   GxY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   	SxY w# 1 sw Y   xY w# 1 sw Y   txY w# 1 sw Y   xY w# 1 sw Y   @xY w# 1 sw Y   xY w)N   errorTF)dates)r0   r      r   r   ignoreindexr   zMNo frequency information was provided, so inferred frequency %s will be used.recordalways-r"   An unsupported index was provided. As a result, forecasts cannot be generated. To use the model for forecasting, use one of the supported classes of index.z|A date index has been provided, but it has no associated frequency information and so will be ignored when e.g. forecasting.)0r	   __warningregistry__dtawarningscatch_warningssimplefilterTimeSeriesModel
isinstance_indexpd
RangeIndexnp
issubdtyper   integerr   _index_none_index_dates_index_generateddatar0   r   date_indexesperiod_indexesstrfreqstrDatetimeIndexPeriodIndex_index_freqequalssupported_date_indexessupported_increment_indexesunsupported_indexesr   
ValueErrorcopyr4   r   typeSeriesobject	DataFramelensplitmessageIndexunsupported_date_indexesnumpy_datestr_indexes)endogmodixr   
base_endogr_   last_lenws           h/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/statsmodels/tsa/base/tests/test_tsa_indexes.pytest_instantiation_validrj      s   $&I!J Ra .$$& 	.!!'*++E2Ccjj"--8BMM

  "**=   $/))51--t4.-	. 	..   E$$& 	2!!'*(>9 2D//R@<77D!$,::DszzB,<,<bnn+MN S__e4S--t4S1159SZZ__coo>SXX^^223::>ESXX]]D12	2* $$& 	2!!'*(>9 2D//RdK<77D!$,::DszzB,<,<bnn+MN S__e4S--t4S1159SZZ__coo>SXX^^223::>ESXX]]D12	2* $$& 	2!!'*2 2D//RdK<77D!$,<<DszzB,<,<bnn+MN S__e4S--t4S1159SZZ__coo>SXX^^223::>ESXX]]D12	2, 46II 	HBI55uB	EEP !Ah C9
$$& 	2!!'*(>9 2D") //6<77D!$,::DszzB,<,<bnn+MN S__e4S--t4S1159SZZ__coo>SXX^^223::>ESXX]]D1%2	22 !1!4Q7''.CJJ'''S__e,S%%u-S))51S__d+SXX^^T*SXX]]D) !1!4Q7''.CJJ2==000??""####''''&&&xx~~%%%xx}}$$$ $$& 	2!!'*2 2Db")),V1C!002 C --h7 "Zr BC C LL2>E//DA<77D!$,<<DszzB,<,<bnn+MN S__e4S--t4S1159SZZ__coo>SXX^^223::>ESXX]]D1/2	2< $$& 	2!!'*2 2D")1!4Q7//RdK<77D!$,<<DszzB,<,<bnn+MN S__e4S--t4S1159SZZ__coo>SXX^^223::>ESXX]]D1%2	246 	 $$D1 	"Q!!(+2 "D") //6<77D!$,<<DCJJ'2+;+;;;;??**''''////SZZ__coo>xx~~,,SZZ888 q6X%SXX]]005a8$**S/!:LMS2/388==1HIq69"	"F5 	
 $$D1 	9Q!!(+/ 9D") //6szzBHHbmm+DEt S__e4S--u5S1148S__d3SXX^^T2SXX]]D1S1.89	9,. 	
 $$D1 	9Q!!(+4 9D") //6!#**bmm<JJA   S__e4S--u5S1148S__d3SXX^^T2SXX]]D1S1.89	9 	9eC9L FE!!!_Q$$	 FKKMEq/!$EK!!!_Q$$	 FKKME%a(+EK!!!_Q$$	 FKKME'*1-EK!!!_Q$$	w		. 	. 	2 	2*	2 	2*	2 	2<	2 	2rC C	2 	2<	2 	2<	" 	"N	9 	94	9 	9s   DAM!E1AM/E2AM,>E+AM9FANA$AN =-AN	*E'AN .FAN-G AN:>E
AOB)EAOMAM	MAM)	M,AM6	M9AN	NAN	NANNAN N AN*	N-AN7	N:AO	OAO	OAO	c            
         t         d   j                         } t        d   d   | _        t	        j
                  d      5 }t	        j                  d       t        j                  |       }d d d        d}d }j                  ||      \  }}}}t        |d       t        |t        dz
         t        |d       t        |j                  |j                  j                        d       d}d}|j                  ||      \  }}}}t        |d	       t        |d
       t        |d       t        |j                  |j                  j                  d	d        d       d}t        }d}	t	        j
                  d      5 }t	        j                  d       |j                  ||      \  }}}}t        t        |d   j                         |	       d d d        t        |d       t        |d
       t        |d       t        |j                  t#        j$                  t'        j(                  dd                  d       |j+                  d      \  }
}}t        |
d       t#        j,                  dd	d      }t        |j                  |      d       t        |d       |j/                  d      \  }
}}t        |
d       t#        j,                  dd	d      }t        |j                  |      d       t        |d       |j/                  d      \  }
}}t        |
d       |j                  j                  d d	 }t        |j                  |      d       t        |d       y # 1 sw Y   xY w# 1 sw Y   xY w)Nr.   r   Tr6   r2   r   r"      r1   mNo supported index is available. Prediction results will be given with an integer index beginning at `start`.r8   r!   r   Fc)r<   rX   rV   r4   r=   r>   r?   r	   r@   _get_prediction_indexr   nobsrS   rK   
row_labelsrN   r_   rC   r`   rE   arange_get_index_locrD   _get_index_label_loc)rc   rh   rd   	start_keyend_keyr   endout_of_sampleprediction_indexr_   locr4   index_was_expandeddesired_indexs                 ri   %test_prediction_increment_unsupportedr~     s   FKKME%b)!,EK		 	 	- /h'''./ IG252K2K73/E3/ dQh"!(()<)<=tD
 IG252K2K73/E3/ a"!(()<)<QR)@A4H IG	2 
 
	 	 	- 
1h' %%i9	
 	S1&0
1 a"!(("))Aq/)BCTJ &)%7%7%:"C"aMM:Mm,d3#U+ &)%=%=a%@"C"aMM:Mm,d3#U+ &)%=%=c%B"C"aHH''+Mm,d3#U+c/ /V
1 
1s   +M8AM$M!$M.c                     t         d   } t        j                  |       }d}d }|j                  ||      \  }}}}t	        |d       t	        |t
        dz
         t	        |d       t	        |d u d       d}d}|j                  ||      \  }}}}t	        |d       t	        |d       t	        |d       t	        |d u d       d}t
        }|j                  ||      \  }}}}t	        |d       t	        |d       t	        |d       t	        |d u d       |j                  d      \  }}	}
t	        |d       t        j                  ddd	      }t	        |	j                  |      d       t	        |
d
       |j                  d      \  }}	}
t	        |d       t        j                  ddd	      }t	        |	j                  |      d       t	        |
d
       y )Nr   r   Trl   r"   rm   r1   r.   r   F)r<   r	   r@   rp   r   rq   rt   rC   rD   rS   ru   )rc   rd   rv   rw   r   rx   ry   rz   r{   r4   r|   r}   s               ri   #test_prediction_increment_nonpandasr   d  s   FE

#
#E
*C IG252K2K73/E3/ dQh"!T)40 IG252K2K73/E3/ a"!T)40 IG252K2K73/E3/ a"!T)40 &)%7%7%:"C"aMM:Mm,d3#U+ &)%=%=a%@"C"aMM:Mm,d3#U+    c            
      
   t         d   j                         } t        j                  |       }d}d }|j	                  ||      \  }}}}t        |d       t        |t        dz
         t        |d       t        |j                  |j                        d       d}d}|j	                  ||      \  }}}}t        |d       t        |d       t        |d       t        |j                  |j                  dd        d       d}t        }|j	                  ||      \  }}}}t        |d       t        |d       t        |d       t        |j                  t        j                  t        j                  dd	                  d       y )
Nr.   r   r   Trl   r"   rm   r1   r!   )r<   rX   r	   r@   rp   r   rq   rS   rB   rC   r`   rE   rs   )rc   rd   rv   rw   r   rx   ry   rz   s           ri   (test_prediction_increment_pandas_noindexr     si   FKKME

#
#E
*C IG252K2K73/E3/ dQh"!((4d;
 IG252K2K73/E3/ a"!((AB8$?
 IG252K2K73/E3/ a"!(("))Aq/)BCTJr   c                     t         d   j                         } t        d   d   | _        t	        j
                  |       }d}d }|j                  ||      \  }}}}t        |d       t        |t        dz
         t        |d       t        |      t        | j                        u sJ t        |j                  |j                        d       d}d}|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        |      t        | j                        u sJ t        |j                  |j                  d d       d       d}d}|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        |      t        | j                        u sJ t        |j                  |j                  dd        d       d}t        }|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        j                  d	d
d      }t        |j                  |      d       d	}d}|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        |      t        | j                        u sJ t        |j                  |j                  dd       d       d}d}|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        j                  ddd      }t        |j                  |      d       |j                  d      \  }	}
}t        |	d       t        j                  ddd      }t        |
j                  |      d       t        |d       |j                  d      \  }	}
}t        |	d       t        j                  ddd      }t        |
j                  |      d       t        |d       |j                  d      \  }	}
}t        |	d       |j                   j"                  d d }t        |
j                  |      d       t        |d       y )Nr.   r   r   Trm   r1   rl   r"   r*   r
   r   r   r,   r   z
1950-01-08   Fr+   )r<   rX   rL   r4   r	   r@   rp   r   rq   rY   rS   rB   rC   
date_rangert   ru   rK   rr   rc   rd   rv   rw   r   rx   ry   rz   r}   r{   r4   r|   s               ri   ,test_prediction_increment_pandas_dates_dailyr     s5   FKKMEq/!$EK

#
#E
*C IG252K2K73/E3/ dQh" !T%++%6666!((4d; IG252K2K73/E3/ a" !T%++%6666!((BQ8$? IG252K2K73/E3/ a" !T%++%6666!((AB8$? IG252K2K73/E3/ a"MMacJM!((7>
 IG252K2K73/E3/ a" !T%++%6666!((Aa94@ IG252K2K73/E3/ a"MMacJM!((7> &)%7%7%:"C"aMMacJMm,d3#U+ &)%=%=a%@"C"aMMacJMm,d3#U+ &)%=%=l%K"C"aHH''+Mm,d3#U+r   c                     t         d   j                         } t        d   d   | _        t	        j
                  |       }d}d }|j                  ||      \  }}}}t        |d       t        |t        dz
         t        |d       t        |      t        | j                        u sJ t        |j                  |j                        d       d}d}|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        |      t        | j                        u sJ t        |j                  |j                  d d       d       d}d}|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        |      t        | j                        u sJ t        |j                  |j                  dd        d       d}t        }|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        j                  d	d
d      }t        |j                  |      d       d	}d}|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        |      t        | j                        u sJ t        |j                  |j                  dd       d       d}d}|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        j                  ddd      }t        |j                  |      d       |j                  d      \  }	}
}t        |	d       t        j                  ddd      }t        |
j                  |      d       t        |d       |j                  d      \  }	}
}t        |	d       t        j                  ddd      }t        |
j                  |      d       t        |d       |j                  d      \  }	}
}t        |	t!        ddd              |j"                  j$                  d d }t        |
j                  |      d       t        |d       y )Nr.   r   r   Trm   r1   rl   r"   z1950-02r
   r   r   z1950-04z1950-01z1950-08r   Fz1950-03)r<   rX   rL   r4   r	   r@   rp   r   rq   rY   rS   rB   rC   r   rt   ru   slicerK   rr   r   s               ri   .test_prediction_increment_pandas_dates_monthlyr   E  s>   FKKMEq/!$EK

#
#E
*C IG252K2K73/E3/ dQh" !T%++%6666!((4d; IG252K2K73/E3/ a" !T%++%6666!((BQ8$? IG252K2K73/E3/ a" !T%++%6666!((AB8$? IG252K2K73/E3/ a"MM	14HM!((7>
 IG252K2K73/E3/ a" !T%++%6666!((Aa94@ IG252K2K73/E3/ a"MM	14HM!((7> &)%7%7%:"C"aMM	14HMm,d3#U+ &)%=%=a%@"C"aMM	14HMm,d3#U+ &)%=%=i%H"C"eAq$'(HH''+Mm,d3#U+r   c                     t         d   j                         } t        j                  dt	        |       d      | _        t        j                  |       }d}d }|j                  ||      \  }}}}t        |d       t        |t        dz
         t        |d       t        |      t        | j
                        u sJ t        |j                  |j                        d       d}d	}|j                  ||      \  }}}}t        |d
       t        |d       t        |d       t        |      t        | j
                        u sJ t        |j                  |j                  d
d        d       d}t        }|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        j                  ddd      dd  }t        |j                  |      d       t        j                  d      }t        j                  |j                  dz         }|j                  ||      \  }}}}t        |d       t        |d       t        |d
       t        j                  ddd      }t        |j                  |      d       y )Nr.   z
1970-01-01nsr   r   r   Trl   r"   rm   r1   r!      r   )r<   rX   rC   r   r]   r4   r	   r@   rp   r   rq   rY   rS   rB   	Timestampvalue)	rc   rd   rv   rw   r   rx   ry   rz   r}   s	            ri   1test_prediction_increment_pandas_dates_nanosecondr     sT   FKKME--CJTEK 
#
#E
*C IG252K2K73/E3/ dQh" !T%++%6666!((4d; IG252K2K73/E3/ a" !T%++%6666!((AB8$? IG252K2K73/E3/ a"MMadKABOM!((7> \*Ill9??Q./G252K2K73/E3/ a"MMadKM!((7>r   c                     i t         _        t        j                  t        j
                  j                  d            } t        t        | j                  t        j                        d       t        j                  d      5 }t        j                  d       t        j                  |       }t        t        |      d       d d d        y # 1 sw Y   y xY w)Nr
   sizeTr6   r8   r   )r	   r;   rC   rZ   rE   randomnormalr   rA   r4   rD   r=   r>   r?   r@   r]   )rc   rh   rd   s      ri   test_range_indexr     s    $&I!IIbii&&A&./EEKK7>		 	 	-  h'''.SVQ     s   A CCc                  D   t         d   d   } t        j                  t        d   |       }t	        j
                  |      }d}d }|j                  ||      \  }}}}t        |d       t        |t        dz
         t        |d       t        j                  ddd      }	t        |j                  |	      d       d}d	}|j                  ||      \  }}}}t        |d
       t        |d       t        |d       t        j                  ddd      }	t        |j                  |	      d       d}t        }|j                  ||      \  }}}}t        |d       t        |d       t        |d       t        j                  ddd      }	t        |j                  |	      d       y )Nr.   r   r3   r   r    r   Trl   r"   rm   r1   )rU   rC   rZ   r<   r	   r@   rp   r   rq   rD   rS   )
r4   rc   rd   rv   rw   r   rx   ry   rz   r}   s
             ri   test_prediction_rangeindexr     s   '*1-EIIc!fE*E

#
#E
*C IG252K2K73/E3/ dQh"MM;M!((7> IG252K2K73/E3/ a"MM;M!((7> IG252K2K73/E3/ a"MM;M!((7>r   c                  4   t         d   d   } t        j                  t        d   |       }t	        j
                  |      }d}d }|j                  ||      \  }}}}t        |d       t        |t        dz
         t        |d       t        j                  dt        dz  d      }	t        |j                  |	      d       d}d	}|j                  ||      \  }}}}t        |d       t        |d
       t        |d       t        j                  dt        dz  d      }	t        |j                  |	      d       d}t        }|j                  ||      \  }}}}t        |d       t        |d
       t        |d       t        j                  dt        dz   dz  d      }	t        |j                  |	      d       |j                  d      \  }
} }t        |
d       t        j                  ddd      }	t        | j                  |	      d       t        |d       y )Nrm   r   r3   r   r!   r   Trl   r"   r1      r.   F)rU   rC   rZ   r<   r	   r@   rp   r   rq   rD   rS   rt   )r4   rc   rd   rv   rw   r   rx   ry   rz   r}   r{   r|   s               ri   #test_prediction_rangeindex_withstepr   2  s   '*1-EIIc!fE*E

#
#E
*C IG252K2K73/E3/ dQh"MMqqAM!((7> IG252K2K73/E3/ a"MMD1H1EM!((7> IG252K2K73/E3/ a"MMTAXNKM!((7> &)%7%7%:"C"aMMA>Mm,d3#U+r   c            	      ~   i t         _        t        j                  t        j
                  j                  d      g d      } d}t        j                  d      5 }t        j                  d       t        j                  |       }|D cg c]  }t        |j                         }}||v sJ 	 d d d        d	}d
}j                  ||      \  }}	}
}t        |j                  t        j                   ddg            d       |j                  ||ddg      \  }}	}
}t        |j                  t        j                   ddg            d       |j#                  d      \  }}}t        |d       t        |j                  t        j$                  dd            d       t        |d       t        |d       t'        j(                  t*              5  |j#                  d       d d d        |j-                  d      \  }}}t        |d       t        |j                  t        j                   g d            d       t        |d       t'        j(                  t*              5  |j-                  d       d d d        d}d}d}t        j                  d      5 }t        j                  d       |j                  ||      \  }}	}
}t        |j                  t        j                   ddg            d       t        t        |d   j                        |       d d d        |j                  ||ddg      \  }}	}
}t        |j                  t        j                   ddg            d       t/        t0        |j                  ||g d       y c c}w # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   8xY w# 1 sw Y   xY w)Nr
   r   )r$   bro   der3   r:   Tr6   r8   rl   r"   r   r   fgr.   r   rm   Fro   )r$   r   ro   aar1   rn   )r   r   h)r	   r;   rC   rZ   rE   r   r   r=   r>   r?   r@   rN   r_   rp   r   rS   r`   rt   rD   pytestraisesKeyErrorru   r   rW   )rc   r_   rh   rd   warnmessagesrv   rw   r   rx   ry   rz   r{   r4   r|   s                  ri   test_custom_indexr   i  so   $&I!II
		a (AE	& 
 
	 	 	- #h'''.234$C%44("""# IG252K2K73/E3/
 !((3*)=>E 362K2K73* 3L 3/E3/ !((3*)=>E &)%7%7%:"C"abmmAq12D9#U+#U+ 
x	   3  &)%=%=c%B"C"abhh78$?#U+ 
x	  '  &' IG	2 
 
	 	 	- 
1h' %%i9	
%,,RXXq!f-=>ES1&0
1 362K2K73* 3L 3/E3/ !((3*)=>E !!C 5# #<   ' '
1 
1sC   /N
N&NNN&A?N3NNN#&N03N<c                  j   t        j                  ddd      } | j                         | j                         z   }t        j                  t	        j
                  t        |            |      }d}t        j                  t        |      5  t        j                  |       d d d        y # 1 sw Y   y xY w)Ni  i  r   )r   rx   r   r3   zeA date index has been provided, but it is not monotonic and so will be ignored when e.g. forecasting.match)rC   period_rangetolistrZ   rE   zerosr]   r   warnsr   r	   r@   )tmpr4   rc   r_   s       ri   test_nonmonotonic_periodindexr     s    
//$S
9CJJL3::<'EIIbhhs5z*%8E	 
 
l'	2 )!!%() ) )s   
B))B2zqPandas PeriodIndex.is_full does not yet work for all frequencies (e.g. frequencies with a multiplier, like "2Q").)reasonc                  *   t        j                  ddgd      } t        j                  t        j                  t        |             |       }d}t        j                  t        |      5  t        j                  |       d d d        y # 1 sw Y   y xY w)Nz2000-01z2000-03r   r5   r3   zbA Period index has been provided, but it is not full and so will be ignored when e.g. forecasting.r   )rC   rQ   rZ   rE   r   r]   r   r   r   r	   r@   )r4   rc   r_   s      ri   test_nonfull_periodindexr     ss     NNIy1<EIIbhhs5z*%8E	 
 
l'	2 )!!%() ) )s   *B		Bc                      t        j                  ddd      } t        j                  t        j                  d      |       }t        j                  |      }|j                  d      \  }}}t        ||   t        j                  d             y )N2000Q1r   r   )r   r   r3   2003Q2)
rC   r   rZ   rE   r   r	   r@   rt   r   r   )re   rc   rd   r{   r4   _s         ri   test_get_index_loc_quarterlyr     sk     
x	6BIIbhhqk,E

#
#E
*C&&x0MCsR\\(34r   )D__doc__statsmodels.compat.pandasr   r   r   r=   numpyrE   numpy.testingr   r   pandasrC   r   statsmodels.tools.sm_exceptionsr   statsmodels.tsa.baser	   rq   rs   base_dtar   rZ   r\   r<   
TWO_QE_DECr   base_date_indexesr   base_period_indexesAttributeErrorrL   rM   maprN   r   rb   list_datestr_indexesseries_datestr_indexesto_datetimeto_pydatetimenumpy_datetime_indexeslist_datetime_indexesr[   series_datetime_indexesseries_timestamp_indexesr`   rD   rU   rT   rV   ra   rj   r~   r   r   r   r   r   r   r   r   r   r   markxfailr   r   )xys   00ri   <module>r      s  
 J I   5   8 *299T?OOBIIhBLL	 %X)
 BMMd=BMMd=BMMd>BMMd>BMMdBBMMdDBMMd?BMMd>BMMdC $ BOO,3?BOO,3?BOO,3?BOO,3?BOO,3? 	lDtDlDtDlDyI  $55aD	5%891d)97HI!!%%*aff-I 4IJDAqQJ 8LM19299Q<+M  :K45^R^^A$$&/  6LLTQ!((*aL 0E(,1YRYYq#  =NNqYRYYq\1662N  RXXibiio%R]]A.5R]]$(3T:R]]2D9	    	
    RYYq$(T"RYYt_TrTD!RYYt_sD!Aa4 	1c5"t$
  .t4N HVU,p;,|/Kdn,bn,b=?@	 -?`4,nWt)   

)

)5G%  		 69IJM M O> sO   AQ$ !Q03Q5$Q:1Q?R<3R7R R%R7	R!
$Q-,Q-