
x\c           @   s  d  d l  m  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	 m
 Z
 m Z m Z m Z d  d l j j Z d  d l m Z d  d l m Z m Z m Z m Z m Z m Z m Z m Z d  d l m Z m Z d  d l  j! j" Z# d  d l  m$ Z$ d  d l% j j& Z' d  d	 l% m( Z( m) Z) m* Z* m+ Z+ m, Z, m- Z. m/ Z/ d  d
 l0 m1 Z1 d  d l2 m3 Z3 m4 Z4 d   Z5 e j6 j7 d  d e8 f d     Y Z9 e j6 j7 d  d e8 f d     Y Z: e j6 j7 d  d e8 f d     Y Z; e j6 j7 d  d e8 f d     Y Z< e j6 j7 d  d e9 e< e: e; f d     Y Z= e j6 j7 d  d e8 f d     Y Z> d   Z? e j6 j7 d  d    Z@ d S(   i(   t   datetimeN(   t   catch_warningst   simplefilter(   t   OrderedDictt   StringIOt   lranget   ranget	   signature(   t   is_float_dtype(   t	   DataFramet   Indext
   MultiIndext   Seriest   compatt
   date_ranget   isnat   notna(   t   nanallt   nanany(   t   Panel(   t   assert_almost_equalt   assert_frame_equalt   assert_panel_equalt   assert_series_equalt   ensure_cleant   makeCustomDataframet   makeMixedDataFrame(   t   pprint_thing(   t   BDayt   MonthEndc          C   sL   t  d t  7 t d t  t j   }  t j |   |  j   }  Wd  QX|  S(   Nt   recordt   ignore(   R   t   TrueR   t   FutureWarningt   tmt	   makePanelt   add_nanst   copy(   t   _panel(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   make_test_panel   s    s   ignore:\nPanel:FutureWarningt
   PanelTestsc           B   s2   e  Z d Z d    Z d   Z d   Z d   Z RS(   c         C   s.   t  j |  j  } t | d |  j d  d  S(   Nt   ItemA(   R"   t   round_trip_picklet   panelR   (   t   selft	   unpickled(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_pickle,   s    c            s   t  j t   f d    d  S(   Nc              s     j  j   S(   N(   R+   t   rank(    (   R,   (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   <lambda>1   s    (   t   pytestt   raisest   NotImplementedError(   R,   (    (   R,   s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_rank0   s    c         C   s1   |  j  j   } t | d |  j  d j    d  S(   NR)   (   R+   t   cumsumR   (   R,   R5   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_cumsum3   s    c         C   sN   t    } t  t  d g g g   } t j t t |  t j t t |  d  S(   Ni   (   R   R1   R2   t	   TypeErrort   hash(   R,   t   c_emptyt   c(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   not_hashable7   s    	N(   t   __name__t
   __module__t   NoneR+   R.   R4   R6   R;   (    (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR(   (   s
   			t   SafeForLongAndSparsec           B   s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z e	 j
 j d  e	 j
 j d  d	     Z e	 j
 j d  d
    Z e	 j
 j d  d    Z e j d    Z d   Z d   Z d   Z d e d d  Z RS(   c         C   s   t  |  j  d  S(   N(   t   reprR+   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_reprA   s    c         C   sl   xe d D]] } d  t |  j |  _ |  j j   } d t | |  _ t |  j |  j d  k s t  q Wd  S(   Nt
   major_axist
   minor_axist   foo(   RB   RC   (   R>   t   getattrR+   t   nameR%   t   AssertionError(   R,   t   attrt   cp(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_copy_namesD   s
    c         C   s#   t  j t |  j  |  j j  d  S(   N(   R"   t   equalContentst   listR+   t   items(   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_iterK   s    c         C   s,   d   } |  j  d | d |  j d t d  S(   Nc         S   s   t  |   j   S(   N(   R   t   sum(   t   s(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   O   s    t   countt   objt
   has_skipna(   t   _check_stat_opR+   t   False(   R,   t   f(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt
   test_countN   s    	c         C   s    |  j  d t j d t j d  S(   NRO   t   skipna_alternative(   RT   t   npRO   t   nansum(   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_sumR   s    c         C   s   |  j  d t j  d  S(   Nt   mean(   RT   RY   R\   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_meanU   s    c         C   s    |  j  d t j d t j d  S(   Nt   prodRX   (   RT   RY   R^   t   nanprod(   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_prodX   s    s#   ignore:Invalid value:RuntimeWarnings   ignore:All-NaN:RuntimeWarningc         C   s   d   } |  j  d |  d  S(   Nc         S   s&   t  |   j   r t j St j |   S(   N(   R   t   anyRY   t   nant   median(   t   x(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   wrapper^   s    Rc   (   RT   (   R,   Re   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_median[   s    	c         C   s   |  j  d t j  d  S(   Nt   min(   RT   RY   Rg   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_mine   s    c         C   s   |  j  d t j  d  S(   Nt   max(   RT   RY   Ri   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_maxi   s    c            s3   d d l  m     f d   } |  j d |  d  S(   Ni(   t   skewc            s)   t  |   d k  r t j S  |  d t S(   Ni   t   bias(   t   lenRY   Rb   RU   (   Rd   (   Rk   (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   this_skewq   s    Rk   (   t   scipy.statsRk   RT   (   R,   Rn   (    (   Rk   s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_skewm   s    c         C   s   d   } |  j  d |  d  S(   Nc         S   s,   t  |   d k  r t j St j |  d d S(   Ni   t   ddofi   (   Rm   RY   Rb   t   var(   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   alty   s    Rr   (   RT   (   R,   Rs   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_varx   s    	c         C   s   d   } |  j  d |  d  S(   Nc         S   s,   t  |   d k  r t j St j |  d d S(   Ni   Rq   i   (   Rm   RY   Rb   t   std(   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyRs      s    Ru   (   RT   (   R,   Rs   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_std   s    	c         C   s   d   } |  j  d |  d  S(   Nc         S   s?   t  |   d k  r t j St j |  d d t j t  |    S(   Ni   Rq   i   (   Rm   RY   Rb   Ru   t   sqrt(   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyRs      s    t   sem(   RT   (   R,   Rs   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_sem   s    	c            sZ  | d  k r |  j } n  t | |  } | r t j   |  }   f d   } xW t | j  D]7 }	 | d |	 d t  }
 t |
 | j	 | d |	  q^ Wn   }   } xQ t | j  D]@ }	 | d |	  }
 | d k r t |
 | j	 | d |	  q q Wt
 j t | d | j d t |  j k rVt
 j t d |  | d t  Wd  QXn  d  S(	   Nc            s     t  j |    S(   N(   RY   t   asarray(   Rd   (   t   alternative(    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyRe      s    t   axist   skipnaRO   R^   t   numeric_onlyt   match(   RO   R^   (   R>   R+   RE   R"   t   _make_skipna_wrapperR   t   ndimRU   R   t   applyR1   R2   t	   ExceptionR   t   argsR3   R    (   R,   RF   R{   RR   RS   RX   RV   t   skipna_wrapperRe   t   it   result(    (   R{   s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyRT      s(    		##N(   R<   R=   RA   RJ   RN   RW   R[   R]   R`   R1   t   markt   filterwarningsRf   Rh   Rj   t   tdt   skip_if_no_scipyRp   Rt   Rv   Ry   R>   R    RT   (    (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR?   >   s"   											t   SafeForSparsec           B   s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z e	 d    Z
 d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   sp   |  j  j d  |  j  j k s$ t  |  j  j d  |  j  j k sH t  |  j  j d  |  j  j k sl t  d  S(   Ni    i   i   (   R+   t	   _get_axisRM   RG   RB   RC   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_get_axis   s    $$c         C   s_  t  t j t |  j j    } t  t j t |  j j    } t  t j t |  j j    } |  j d } | |  j _ t |  j d  r d |  j j	 k s t
  n  |  j j | k s t
  |  j d } | |  j _ |  j d j | k s t
  |  j j | k st
  |  j d } | |  j _ |  j d j | k sCt
  |  j j | k s[t
  d  S(   NR)   t   _item_cachei    (   R
   RY   t   arangeRm   R+   RM   RB   RC   t   hasattrR   RG   t   indext   columns(   R,   t	   new_itemst	   new_majort	   new_minort   item(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_set_axis   s     !!!c      	   C   s   |  j  j d  d k s t  |  j  j d  d k s< t  |  j  j d  d k sZ t  t j t d d  |  j  j d	  Wd  QXt j t d d  |  j  j |  j  d
 d	 Wd  QXd  S(   NRM   i    t   majori   t   minori   R   s   No axis named fooRD   R|   (   R+   t   _get_axis_numberRG   R1   R2   t
   ValueErrort   __ge__(   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_get_axis_number   s    c         C   s^   |  j  j d  d k s t  |  j  j d  d k s< t  |  j  j d  d k sZ t  d  S(   Ni    RM   i   RB   i   RC   (   R+   t   _get_axis_nameRG   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_get_axis_name   s    c         C   sd   |  j  j d  \ } } |  j  j d  \ } } |  j  j d  \ } } |  j  j d  \ } } d  S(   NRM   RB   RC   i    (   R+   t   _get_plane_axes(   R,   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_get_plane_axes   s    c         C   s   |  j  j } | d | d } } |  j  j | | d d } |  j  d j | |  } t | d |  |  j  j d | d d  } |  j  d j d |  } t | d |  |  j  j d | d d  } |  j  d j d |  } t | d |  d  S(   Ni   i   R|   R   R)   t   beforet   after(   R+   RB   t   truncateR   (   R,   t   datest   startt   endt   truncedt   expected(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_truncate   s    c         C   s  |  j  |  j t j  |  j  |  j t j  |  j  |  j t j  |  j  |  j t j  |  j  |  j t j  |  j  |  j t j  |  j  |  j d    |  j  |  j d    |  j  |  j d    |  j  |  j d    |  j  |  j d    |  j  |  j d    |  j  |  j d    |  j  |  j d    |  j  |  j d	    |  j  |  j d
    t	 j
 t |  j j |  j d  d  S(   Nc         S   s   | |  S(   N(    (   Rd   t   y(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   | |  S(   N(    (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   | |  S(   N(    (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   | |  S(   N(    (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   | |  S(   N(    (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  | S(   N(    (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  | S(   N(    (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  | S(   N(    (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  | S(   N(    (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  | S(   N(    (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    R)   (   t   _test_opR+   t   operatort   addt   subt   mult   truedivt   floordivt   powR1   R2   R   t   __add__(   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt
   test_arith  s$    c         C   s1   | |  d  } t  | d | |  d d   d  S(   Ni   R)   (   R   (   R+   t   opR   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR     s    c         C   s)   t  j t |  j j    |  j j  d  S(   N(   R"   RK   RL   R+   t   keysRM   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_keys!  s    c         C   sW   x |  j  j   D] \ } } q Wt t |  j  j     t |  j  j  k sS t  d  S(   N(   R+   t	   iteritemsRm   RL   RM   RG   (   R,   t   kt   v(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_iteritems$  s    c            s     f d   } d d d d d d d g } t  j sC | j d	  n  xM | D]E } y | t t |  |  WqJ t k
 r t d
 |    qJ XqJ Wt  j r y | t j d	  Wq t k
 r t d
 d	    q Xn  d  S(   Nc            s(    j  d } t   j  |  } | | d d } t | d |    j  d |     j  j   j  j d  } | | d d }   j  j d } t | j |  |    j  j |  |     j  j   j  j d  } | | d d }   j  j d } t | j |  |    j  j |  |   d  S(	   NR)   R|   RM   t   ItemBi    R   i   R   (   R+   RE   R   t   major_xsRB   t   minor_xsRC   (   R   RF   t   dft   funcR   t   xst   idx(   R,   (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   check_op-  s    R   R   R   R   R   R   t   modt   divs   Failing operation: %r(   R   t   PY3t   appendRE   R   t   AttributeErrorR   R   (   R,   R   t   opsR   (    (   R,   s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_combineFrame,  s     		c         C   s-   |  j  j |  j   } t | |  j  d  d  S(   Ni   (   R+   R   R   (   R,   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_combinePanel[  s    c         C   s   t  |  j |  j d  d  S(   Ni(   R   R+   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_neg_  s    c      	   C   s   t  t j d  j d d d  d d d d g d t d	 d
 d d t d  } | j d d  j d } d d d d d d d d g } x= | D]5 } t j	 t
   t | |  | d d Wd  QXq Wd  S(   Ni   i   i   RM   R)   R   t   ItemCRB   t   20130101t   periodsRC   t   ABCDER|   i   i    R   R   R   R   R   R   R   R   i   i<   (   R   RY   R   t   reshapeR   RL   RO   t   ilocR1   R2   R3   RE   (   R,   t   pt   dR   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_raise_when_not_implementedc  s    !c         C   s  |  j  } t j t d t  | j d   d d } Wd  QX| j d d d g  } t | |  t j t d t  | j d   d d } Wd  QX| j | j t	 d	 d
 d  k } | j d |  } t | |  t j t d t  | j d   d d } Wd  QX| j d d d g  } t | |  t j t d t  | j d   d d } Wd  QXt | | j d g    d  S(   Nt   check_stacklevelc         S   s
   |  d k S(   NR)   R   (   R)   R   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   t  s    R|   RM   R)   R   c         S   s   |  t  d d d  k S(   Ni  i   i   (   R    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   z  s   R   i  i   i   c         S   s
   |  d k S(   Nt   Dt   A(   R   R   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    i   R   R   R   c         S   s
   |  d k S(   NRD   (   RD   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    (
   R+   R"   t   assert_produces_warningR!   RU   t   selectt   reindexR   RB   R    (   R,   R   R   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_selecto  s$    	"c         C   s   x |  j  j D] } x |  j  j d  d  d  D]s } xj |  j  j D]\ } t j t d t  |  j  j | | |  } Wd  QX|  j  | | | } t	 | |  q@ Wq- Wq Wd  S(   Ni   R   (
   R+   RM   RB   RC   R"   R   R!   RU   t	   get_valueR   (   R,   R   t   mjrt   mnrR   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_get_value  s     
c         C   s  |  j  j   } t |  j   } t j |  j   } t | |  t | |  |  j  d } | j   } t |  } t j |  } t | |  t | |  | d } | j   } t |  } t j |  } t | |  t | |  | j d k s t  | j d k st  d  S(   NR)   R   (   R+   t   absRY   R   R   R   RF   RG   (   R,   R   t   result2R   R   RP   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_abs  s&    
(   R<   R=   R   R   R   R   R   R   R   t   staticmethodR   R   R   R   R   R   R   R   R   R   (    (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR      s"   										/					
t   CheckIndexingc           B   s   e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   c         C   s   t  j t |  j j d  d  S(   Nt   ItemQ(   R1   R2   R   R+   t   __getitem__(   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_getitem  s    c         C   s  |  j  d } |  j  j d  } t | |  d |  j  j k sD t  |  j  d =d |  j  j k sf t  t j t |  j  j d  t	 j
 d  } d | d <d | d <d | d <t | t d  t d  t d   } | j   } | d =t j | d | d  t j | d | d  | j   } | d =t j | d | d  t j | d | d  | j   } | d =t j | d | d  t j | d | d  d  S(   NR)   R   i   i    i   i   (   i   i   i   (   R+   t   popR   RM   RG   R1   R2   R   t   __delitem__RY   t   emptyR   R   R%   R"   (   R,   R   R   t   valuesR+   t   panelc(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_delitem_and_pop  s0    



'c         C   s  |  j  j d d g  j   } t j t   | |  j  d <Wd  QX|  j  d d j d d d g  } | |  j  d <| |  j  d <|  j  d } t | | j d	 | j d
 | j	   d |  j  d <t
 |  j  d <|  j  d j j t j k s t  |  j  d j j t j k st  d |  j  d <|  j  d j j t j k s=t  |  j  d d k |  j  d <|  j  d j j t j k syt  t j t |  j  j d |  j  j d g  t t j j d d d   } d } t j t d |  t j j d d  | d <Wd  QXd  S(   NR)   R   t   ItemEi   RM   R   t   Bt   ItemFR   R   i   t   ItemGRD   R   i    t   ItemPi   i   sC   shape of value must be \(3, 2\), shape of given object was \(4, 2\)R   (   R+   t   filtert   to_frameR1   R2   R7   R   R   R   R   R    R   t   dtypeRY   t   int64RG   t   bool_t   object_t   __setitem__t   locR   t   randomt   randnR   (   R,   t   lpR   t   df2R   t   msg(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_setitem  s.    #""""c         C   s   t  d t d d d  d t d d d  d t    } t j d d	 d
  } t j d d d  } t d | d | d |  } t j j d  j d  } t d d d  } | | | <t	 | | j
 |  d  S(   NR   i  i   R   i   i   t   freqg     0fg     0f@iH   g     Ug     U@i$   RM   RB   RC   i   i   i 
  (   iH   i$   (   R   R    R   RY   t   linspaceR   R   R   R   R   R   (   R,   t   timeidxt   lons_coarset   lats_coarset   Pt   datat   key(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_setitem_ndarray  s    	
c         C   s^  t  d d d t j d t j g  } t  d t j d t j d d g  } t i | d 6| d 6 } t | j d  d   d  d   d f  } | | j d  d   d  d   d f <t | j d  d   d  d   d f | j t	   t | j d  d   d d  d   f  } | | j d  d   d d  d   f <t | j d  d   d d  d   f | j t	   d  S(   Nt   ag      ?t   Item1t   Item2i    t   NewMinort   NewMajor(
   R	   RY   Rb   R   R   R   R   R   t   astypet   object(   R,   t   df1R  R+   t   newminort   newmajor(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_set_minor_major  s    $$(""(""c         C   s   |  j  d } |  j  j d } |  j  j |  } | d } t | | j |  d t | j d k sj t  |  j  j d t   } t	 j
 t |  j  j |  d  S(   NR)   i   t   check_namesi    (   R+   RB   R   R   R   RU   RF   RG   R   R1   R2   R   (   R,   t   refR   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_major_xs  s    
c         C   se   d |  j  d <|  j  j |  j  j d  } | d j t j k sE t  | d j t j k sa t  d  S(   NRD   t   ItemDi    R)   (   R+   R   RB   R   RY   t   float64RG   R   (   R,   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_major_xs_mixed*  s    c         C   sg   |  j  d } |  j  j d } |  j  j |  } t | d | | d t t j t |  j  j d  d  S(   NR)   i   R  t   E(   R+   RC   R   R   RU   R1   R2   R   (   R,   R  R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_minor_xs0  s
    c         C   s[   d |  j  d <|  j  j d  } | d j t j k s; t  | d j t j k sW t  d  S(   NRD   R  R   R)   (   R+   R   R   RY   R  RG   R   (   R,   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_minor_xs_mixed;  s    c         C   s   |  j  j d d d } |  j  d } t j | |  |  j  j d d d } t j | j (t j |  j  d j  j   s t	  d |  j  d <|  j  j d d d } | j
 d  k	 s t	  d  S(   NR)   R|   i    RD   t   stringsR   i   (   R+   R   R"   R   RY   Rb   R   t   isnant   allRG   t   _is_copyR>   (   R,   t   itemAR   t
   itemA_viewR   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_xsB  s    %c         C   s  |  j  } | j d d g } | j d  d  d  } d d d g } t   t d t  t | j | | | f | j d | d	 | d
 |   t | j d  d   | | f | j d	 | d
 |   t | j | d  d   | f | j d | d
 |   t | j | | d  d   f | j d | d	 |   t | j | d  d   d  d   f | j d |   t | j d  d   | d  d   f | j d	 |   t | j d  d   d  d   | f | j d
 |   Wd  QXd  S(   Ni   i    i   R   t   Ct   FR   RM   R   R   (	   R+   RM   RB   R   R   R!   R   R   R   (   R,   R   RM   R   t   cols(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_getitem_fancy_labelsR  s"    	
55c         C   s   d  S(   N(    (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_getitem_fancy_sliceq  s    c         C   se   |  j  } | j d  d   d d  d   f } | j d  d   | j d d  d   f } t | |  d  S(   Ni(   R+   R   R   RB   R   (   R,   R   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_getitem_fancy_intst  s    	")c         C   s  |  j  } d } | j d } d } t | j | | |  t | j | d  d   f | |  t | j | d  d   d  d   f | |  t | j d  d   | f | j |   t | j d  d   | d  d   f | j |   t | j d  d   d  d   d f | j d   t | j | | f | | j |  t | j | | d  d   f | | j |  t | j | d  d   | f | | |  t | j d  d   | | f | j |  j |  d  S(   NR   i   R(  (   R+   RB   R   R   R   R   R   (   R,   R   R   t   datet   col(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_getitem_fancy_xs|  s    	$-)22%.+c         C   s  d } |  j  j d } t d  d   } t } |  j | |  |  j | | f |  |  j | | | f |  |  j | | f |  |  j | | | f |  |  j | | d f |  t } |  j | | f |  |  j | | | f |  |  j | | d f |  |  j | | d f |  d  S(   NR   i   R(  (   R+   RB   t   sliceR>   R   t   _check_viewR   (   R,   R   R.  t   NSt   comp(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt    test_getitem_fancy_xs_check_view  s    c         C   sI   |  j  } t | d   | j d  t | d   | j d d g  d  S(   Nc         S   s   d S(   NR   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    R   c         S   s
   d d g S(   NR   R   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    R   (   R+   R   R   R   (   R,   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_getitem_callable  s    	c      	   C   s   t  d d d d g d d d d g d	 d
 d d g  } t t j j d d  d d
 d g d d d d g } | | j d  d   d d
 d g f <t | j d  d   d d
 d g f |  d  S(   NRM   i   i   i   RB   i   i   i!   RC   io   i   iM  R   R   (   R   R	   RY   R   R   R   R   (   R,   R  t   b(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_ix_setitem_slice_dataframe  s    $$"c         C   sk  d d l  m } | t j j d  d d } | j   t t j j d d d   } | j   } | | j d d  d   d f <t	 | j d d  d   d f j
 | j  |  | j d d  } | | j d  d   d d f <t	 | j d  d   d d f j
 | j  |  | j d d  } | | j d d d  d   f <t	 | j d d d  d   f j
 | j  |  d  S(	   Ni(   R   i
   RF   i    i   i   i   (   t   pandasR   RY   R   R   t   sort_valuesR   R%   R   R   R   R   t   swapaxes(   R,   R   R7  t   df_origR   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_ix_align  s    
//c   	      C   sB  t  j   } | j d j   } t | d |  | j   } | | j d d  d   d  d   f <t | |  | j   } | | j d <t | |  | j   } | | j d d  d   d  d   f <t | |  | j   } | | j d <t | |  | j   } | | j d <t | |  | j   } | | j d d  d   d  d   f <t | |  | j   } | | d <t | |  | j   } | | j d d d d d g d d   f <| j d d d d d g d d   f } t | | j d d d d g d d g f  x=d d	 g D]/} t t j	 d
  j
 d  d d d g d | } | j d } | j d } t  j | j d |  t  j | j d |  | j | j d <t  j | j d |  t  j | j d |  | | d <t  j | j d |  t  j | j d |  | | j d <t  j | j d |  t  j | j d |  qWd  S(   Ni    R)   i   i   i   ii   R  R   i(   i   RM   t   a1t   a2R   (   i   i   i   (   R"   R#   R   R%   R   R   R   R   RY   R   R   R   (	   R,   t   p_origR   R   t   outR   R+   R  R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_ix_frame_align  sX    """
((,
c         C   sb   |  j  j   } | j | } d | j (| j d k j   sA t  | | j | j |  |  d  S(   Ni    (   R+   R%   R   R   R#  RG   t   reindex_like(   R,   t   indexerR4  RI   RR   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR2    s
    
c         C   s   t  i i t j t g d 6d 6i t t g d 6d 6 } | d | d B} t i t j t g d 6 } t | |  | d j t  | d B} t i t t g d 6 } t | |  d  S(   NR  R)   R   (   R   RY   Rb   RU   R    R	   R   t   fillna(   R,   R   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_logical_with_nas  s    c         C   s   t  |  j d |  j  d  S(   Ni(   R   R+   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR   %  s    c         C   s%   t  |  j d k  |  j d k   d  S(   Ni    (   R   R+   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_invert(  s    c            s   t  j    t  j     j d  j d g     j d         f d   } t j d d  S | t j  | t j  | t j	  | t j
  | t j  | t j  Wd  QXd  S(   NRM   RD   i    c            s   |     } t  j | j |   j  j   t j t |     t j t |      |   j d  } t  j | j |   j j d   d  S(   Ni    (   R"   t   assert_numpy_array_equalR   R1   R2   R   R+   (   R   R   t   result3(   R   t   p1t   p2R,   t   tp(    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_comp2  s    t   invalidR   (   R"   R#   R   RM   RY   t   errstateR   t   eqt   net   ltt   gtt   get   le(   R,   RM  (    (   R   RJ  RK  R,   RL  s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_comparisons+  s    c         C   s   x |  j  j D] } x |  j  j d  d  d  D]s } xj |  j  j D]\ } t j t d t  |  j  j | | |  } Wd  QX|  j  | | | } t	 | |  q@ Wq- Wq Wt
   D t d t  d } t j t d |  |  j  j d  Wd  QXWd  QXd  S(   Ni   R   R   s'   There must be an argument for each axisR   R  (   R+   RM   RB   RC   R"   R   R!   RU   R   R   R   R   R1   R2   R7   (   R,   R   R   R   R   R   R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR   L  s     

c         C   s  x |  j  j D] } x |  j  j d  d  d  D]q } xh |  j  j D]Z } t j t d t  |  j  j | | | d  Wd  QXt j	 |  j  | | | d  q@ Wq- Wq Wt
    t d t  |  j  j d d d d  } t | t  s t  | |  j  k	 st  | j d d d  d k s#t  |  j  j d d	 d
 d  } t | d j  sWt  d } t j t d |  |  j  j d  Wd  QXWd  QXd  S(   Ni   R   g      ?R   R   RD   t   barg      ?t   foobart   bazi   s?   There must be an argument for each axis plus the value providedR   R  (   R+   RM   RB   RC   R"   R   R!   RU   t	   set_valueR   R   R   t
   isinstanceR   RG   R   R   R   R1   R2   R7   (   R,   R   R   R   t   rest   res3R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_set_value[  s$     
+
!(   R<   R=   R   R   R  R  R  R  R  R  R   R'  R+  R,  R-  R0  R5  R6  R8  R=  RB  R2  RF  R   RG  RV  R   R^  (    (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR     s4   		"	(														
		@					!	t	   TestPanelc           B   s
  e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d    Z" d!   Z# d"   Z$ d#   Z% d$   Z& d%   Z' d&   Z( d'   Z) d(   Z* d)   Z+ d*   Z, d+   Z- d,   Z. d-   Z/ d.   Z0 d/   Z1 e2 j3 j4 d0  d1    Z5 e2 j3 j4 d0  d2    Z6 d3   Z7 e2 j3 j4 d4  d5    Z8 d6   Z9 d7   Z: d8   Z; d9   Z< e2 j3 j4 d:  d;    Z= d<   Z> d=   Z? d>   Z@ d?   ZA d@   ZB e2 j3 jC dA i dB dC 6eD dD f i dE dF 6eE dG f g  dH    ZF dI   ZG e2 j3 jC dJ eH eI g  dK    ZJ dL   ZK dM   ZL dN   ZM RS(O   c         C   s=   t    |  _ d  |  j j _ d  |  j j _ d  |  j j _ d  S(   N(   R'   R+   R>   RB   RF   RC   RM   (   R,   t   method(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   setup_methody  s    c      
   C   s  t  |  j j  } | j |  j j k s- t  t  |  j j d t } | j |  j j k	 s` t  t j | |  j  t  d d d g d d d g g g  } | j j t	 j
 k s t  |  j j } t  |  } | j | k s t  t  | d t } | j | k	 s	t  d d d t	 j
 f g } x | D]z \ } } t  | d t d  d	 t d
  d t d  } t	 j d d | } | j |  t j | t  | d |  q(Wt  d d t d  d	 t d
  d t d  d d } t	 j d d d } | j d  t j | t  | d d  d  S(   NR%   RD   i   R   gQ	@R  RM   i   RB   i   RC   i   R   t   float32(   i   R   (   gQ	@R  (   i   i   i   (   i   i   i   (   R   R+   t   _dataRG   R    R"   R   R   R   RY   R   R   R   t   fill(   R,   t   wpt   valst   value_and_dtypet   valR   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_constructor  s4    '! !	c         C   s  |  j  j d  } t | j d t } t | j d t } | j j t  } t | j |  t | j |  t | j d t j	 } t | j d t j	 } | j j t j	  } t | j |  t | j |  d d d g g g } t
 j t t | d t d  S(   Ni    R   RD   RW  RY  (   R+   RE  R   Rc  t   intR   R  R   RY   t   int32R1   R2   R   t   float(   R,   t   zero_filledt   castedt   casted2t
   exp_valuesR
  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_constructor_cast  s    c         C   s^   t    } t | j  d k s$ t  t | j  d k s? t  t | j  d k sZ t  d  S(   Ni    (   R   Rm   RM   RG   RB   RC   (   R,   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_constructor_empty_panel  s    	c      	   C   sR   t  d t d  d t d  d t d  d d  } | j j t j k sN t  d  S(   NRM   i   RB   RC   R   t   O(   R   R   R   R   RY   R   RG   (   R,   R+   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_constructor_observe_dtype  s    c         C   s  d   } xW d d d g D]F } t  d t d  d t d  d	 t d
  d |  } | | |  q Wx d d d d d g D]j } t  t j t j j d d d
  d | d t d  d t d  d	 t d
  d | } | | |  qy Wx d d d d d g D]j } t  t j t j j d d d
  d d d t d  d t d  d	 t d
  d | } | | |  q Wxr d d d d d g D][ } t  t j j d d d
  d t d  d t d  d	 t d
  d | } | | |  qWx d d d d d g D] } t t j j d d
  d t d  d t d
  } t t j j d d
  d t d  d t d
  } t  j i | d 6| d 6d | } | | |  qWd  S(   Nc         S   s7   x0 |  j  D]% } |  | j j j | k s
 t  q
 Wd  S(   N(   RM   R   R   RF   RG   (   R+   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   _check_dtype  s    R  Rb  R  RM   i   RB   i
   RC   i   R   R   Rk  Rs  R   R   R  R7  (   R   R   RY   t   arrayR   R   R	   t	   from_dict(   R,   Ru  R   R+   R  R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_constructor_dtypes  s>    	**	#c         C   s?   d } t  j t d |  t t j j d d   Wd  QXd  S(   Ns&   The number of dimensions required is 3R   i
   i   (   R1   R2   R   R   RY   R   R   (   R,   R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt(   test_constructor_fails_with_not_3d_input  s    c         C   sf   |  j  j j   s t  d |  j  d <|  j  j j   s> t  |  j  j   } | j j   sb t  d  S(   Ng      ?RD   (   R+   Rc  t   is_consolidatedRG   t   _consolidate(   R,   R+   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_consolidate  s
    c            s>  |  j  d } |  j  d } i | d 6| d d 6} i | j d 6| d j d 6} i d  d 6t | d j  d 6t | j  d 6} t j |    t j |  } t j |  } t j   j |  j  j  t	   |  t j | d t
   t j   j | j d  t	 t |  t j |   t	 t |  t j |   t	 t |  t j |   i d  d 6d  d 6} t j |  }	 t	 t |  t d d d g     f d	   t j |  D }
 t |
 d
 t } t d   t j |
  D  } t	 | |  t |
 d
 t j } t d   t j |
  D  } t	 | |  d  S(   NR)   R   R   i   R   R(  t	   intersectRM   c            s4   i  |  ]* \ } } | j    j  j d   |  q S(   i    (   R   RB   RE  (   t   .0R   R   (   Re  (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pys
   <dictcomp>*  s   	R   c         S   s(   i  |  ] \ } } | j  t  |  q S(    (   R  Rj  (   R~  R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pys
   <dictcomp>-  s   	c         S   s+   i  |  ]! \ } } | j  t j  |  q S(    (   R  RY   Rk  (   R~  R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pys
   <dictcomp>2  s   	(   R+   t   _seriesR>   R	   R   Rw  R"   t   assert_index_equalRB   R   R    R   R   R   Rj  RY   Rk  (   R,   t   itemat   itembR   t   d2t   d3t   wp2t   wp3t   d4t   wp4t   dcastedR   R   (    (   Re  s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_ctor_dict  s<    
"		c         C   s,  d   |  j  j   D } t |  } t t j t |  j  j    } t j	 | j |  t | d |  j  j
 d |  j  j d |  j  j } t | |  j   |  j  d | d <t |  } t | |  j   | d d  | d <t j t t |  |  j  d j d  d   d  d  f | d <t j t t |  d  S(   Nc         S   s"   i  |  ] \ } } | j  |  q S(    (   R   (   R~  R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pys
   <dictcomp>7  s   	 RM   RB   RC   R   R   i(   R+   R   R   R
   RY   R   Rm   RB   R"   R  RM   RC   R   R1   R2   R   R   (   R,   R
  R   t	   exp_major(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_constructor_dict_mixed6  s    !*c         C   s   t  t t j j d d d    d  } t g  | D] } | t d d  f ^ q2  } t |  } t  | j  | k s} t	  t j
 |  } t  | j  | k s t	  d  S(   Ni    i  id   i2   i
   i   (   RL   t   setRY   R   t   randintR   t   mkdfR   RM   RG   Rw  (   R,   R   R   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_ctor_orderedDictL  s    !.c         C   s4  |  j  j } |  j  j d  } |  j  j d  } |  j  j d  } t | d | d | d | } |  j  j d | d | d |  } t | |  t | d | d | } |  j  j d | d |  } t | |  t | d | } |  j  j d |  } t | |  t | d | } |  j  j d |  } t | |  d  S(   NiRM   RB   RC   R   R   (   R+   Rc  RM   RB   RC   R   R   R   (   R,   R
  RM   R   R   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_constructor_resizeV  s$    c         C   s   t  j   } d | d <i | d 6| d 6} t j | d d } | d j j t j k s^ t  | d j j t j	 k s} t  d  S(   NRW  RD   t   k1t   k2t   orientR   R   (
   R"   t   makeDataFrameR   Rw  R   R   RY   R   RG   R  (   R,   R   R
  R+   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_from_dict_mixed_orientn  s    
c         C   s  d } t  j t d | < t t j j d d d  t d  t d  t d   Wd  QXd } t  j t d | < t t j j d d d  t d  t d  t d   Wd  QXd } t  j t d | < t t j j d d d  t d  t d  t d   Wd  QXd  S(   Ns@   Shape of passed values is \(3, 4, 5\), indices imply \(4, 5, 5\)R   i   i   i   s@   Shape of passed values is \(3, 4, 5\), indices imply \(5, 4, 5\)s@   Shape of passed values is \(3, 4, 5\), indices imply \(5, 5, 4\)(   R1   R2   R   R   RY   R   R   R   (   R,   R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_constructor_error_msgsy  s    %%c         C   sk   |  j  d d  j d d d g  } |  j  j |  } t j | j |  j  j  t j | j |  j  j  d  S(   NR)   iRM   R   R   (	   R+   R   t   conformR"   R  R   RB   R   RC   (   R,   R   t	   conformed(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_conform  s    #c         C   sq   t  t d t d d d g    } t  t d t d d d g    } | j d t d t  } t | |  d  S(	   NR   R  t   1s   1.0i   g      ?t   numerict   coerce(   R   t   dictt   _convertR    R   (   R,   R   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_convert_objects  s    $$c         C   s>   |  j  j } t t j d  d |  j  j } t | |  d  S(   NR  R   (   R+   t   dtypesR   RY   R   RM   R   (   R,   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_dtypes  s    !c         C   s   t  j d d g d d g g d d g d d g g g  } t | d	 d
 g d d g d d g  } t  j d d g d d g g d d g d d g g g  } t | d	 d
 g d d g d d g  } t | j t  |  t j t | j i t d 6 d  S(   Ni   i   i   i   i   i   i   i   R  R7  R:   R   t   eRV   R  t   2t   3t   4t   5t   6t   7t   8i    (	   RY   Rv  R   R   R  t   strR1   R2   R3   (   R,   R
  R+   t   str_dataR   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_astype  s    9''c         C   s  |  j  j t j  } t j d d   t j |  j  j  } Wd  QXt | j |  |  j  j d   d d } |  j  d } t | |  |  j  j d   d d } |  j  d } t | |  |  j  j d	   d d
 } |  j  d } t | |  |  j  j d   d d } t t j	 d  d |  j  j
 d |  j  j } t | |  |  j  j d   d d } t t j	 d  d |  j  j d |  j  j } t | |  |  j  j d   d d
 } t t j	 d  d |  j  j
 d |  j  j } t | |  |  j  j d  } |  j  j d   d d } t | |  |  j  j d  } |  j  j d   d d } t | |  |  j  j d  } |  j  j d   d d
 } t | |  |  j  j d   d d d d } |  j  j d  d } t | |  d  S(   NRN  R   c         S   s   |  d S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    R|   RM   i   c         S   s   |  d S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    RB   c         S   s   |  d S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    RC   c         S   s   |  j  S(   N(   R   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    R  R   R   c         S   s   |  j  S(   N(   R   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  j  S(   N(   R   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    i    c         S   s
   |  j    S(   N(   RO   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    i   c         S   s
   |  j    S(   N(   RO   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s
   |  j    S(   N(   RO   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  j    | S(   N(   RO   (   Rd   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    R   i   (   R+   R   RY   Rw   RO  R   R   R   R	   R   RB   RC   R   RM   RO   (   R,   t   appliedR   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt
   test_apply  sR    	c            s   j  j d   d d d g }  j  d j d d d  } t | |   j  j d   d d d g } t | |   j  j d   d d d g }  j  d j d d d  } t | |   j  j d	   d d d g } t | |   j  j d
   d d d g }  j  d } t | |   j  j d   d d d g } t | |   j  j d   d d d g }  j  j d  j } t | |   j  j d   d d d g }  j  j d  } t | |  d      j  j   d d d g } t    f d    j  j D  } t | |   j  j   d d d g } t    f d    j  j	 D  } t | |   j  j   d d d g } t    f d    j  j
 D  } t | |  t j d% d& d' d( g  } t t j t j d d d  j d d  d t d  d | } t t j t j d  d! d d  j d d  d t d  d | } t i | d" 6| d# 6 } | j d$   d d } | j d  } | j d  } t | |  d  S()   Nc         S   s   |  d S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    R|   RM   RB   i   RC   c         S   s   |  d S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  d S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  d S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  d S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  d S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c         S   s   |  j  d  S(   Ni    (   RO   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0      s    i   c         S   s   |  j  d  S(   Ni   (   RO   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    i    c         S   s$   |  j  |  j d  |  j d  j  S(   Ni   (   t   TR\   Ru   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    c            s>   i  |  ]4 }    j  j d  d   d  d   | f  |  q S(   N(   R+   R   (   R~  t   ax(   RV   R,   (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pys
   <dictcomp>  s   	c            s)   i  |  ] }    j  j |  |  q S(    (   R+   R   (   R~  R  (   RV   R,   (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pys
   <dictcomp>  s   	c            s5   i  |  ]+ }    j  j d  d   | f  |  q S(   N(   R+   R   (   R~  R  (   RV   R,   (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pys
   <dictcomp>  s   	t   oneR  R7  t   twoi   R   R   i   i   R   t   ABCR   i
   i   RV   t   gc         S   s
   |  j    S(   N(   RO   (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   (  s    (   R  R  (   R  R7  (   R  R  (   R  R7  (   R+   R   t	   transposeR   RO   R  R   R   RC   RM   RB   R   t   from_tuplesR	   RY   Rv  R   R   RL   R  (   R,   R   R   R   t   dfat   dfbR   (    (   RV   R,   s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_apply_slabs  sn    			!!$!c   	      C   s  t  t j j d d d   |  _ |  j j d   d d d g } |  j j d   d d d g } |  j j d   d d d g } |  j j d   d d d g } t d	 g d  } } t d
 g d  } } t | |  t | |  t | |  t | |  d  S(   Ni   c         S   s   d S(   Ni    (    (   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   3  s    R|   i   i   c         S   s   d S(   Ng        (    (   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   4  s    c         S   s   t  j d  S(   Ni    (   RY   R   (   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   6  s    c         S   s   t  j d  S(   Ng        (   RY   R  (   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   7  s    i    g        (   R   RY   R   t   randR+   R   R   R   (	   R,   t
   result_intt   result_floatt   result_int64t   result_float64t   expected_intt   expected_int64t   expected_floatt   expected_float64(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_apply_no_or_zero_ndim/  s    !!!	c         C   s  |  j  d } |  j  j d d d g  } t | d |  t |  j  j d   } |  j  j d |  } t | d | j d |   t j t |  j  j d | d | t |  j  j d   } |  j  j d	 |  } t | d | j d
 |   t j t |  j  j d | d	 | |  j  j   } t	 | |  j   | |  j  k	 sAt
  |  j  j d  d  d  } |  j  j d |  } | j d |  j  j d d  } t | j |  j  j d  | j | d   |  j  j d |  j  j d t  } t	 | |  j   | |  j  k s t
  d  S(   NR   RM   R)   i
   R   R   RB   i   R   R   RC   i   R`  t   padi   i    R%   (   R+   R   R   RL   RB   R1   R2   R   RC   R   RG   R   RU   (   R,   R  R   R   R   t   smaller_majort   smallert   larger(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_reindexB  s6    c         C   s7  t  t j j d d d   } t  | j  j d d g } t  | j  j d  d   d d g f } t  | j  j d  d   d  d   d d g f } | j d d g d d } t | |  | j d d g d d } t | |  | j d d g d d } t | |  | j d d g d d } t | |  d  S(   Ni   i    i   R|   i   (   R   RY   R   R  R   R   R   R   (   R,   R+   t	   expected0t	   expected1t	   expected2R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_reindex_axis_styleq  s    (1c      
   C   si  |  j  j d |  j  j d |  j  j d |  j  j d t  } | j |  j  j k sT t  | j |  j  j k so t  | j |  j  j k s t  |  j  j d |  j  j d |  j  j d |  j  j d t  } t | |  j   t t	 j
 j d d   } t i | d 6 } t i | d 6 } t	 j | d <d d g } t	 j d  } t	 j d  } g  } | j | j d | d	 | d t   | j | j d | d	 | d t   | j | j d | d
 | d t   | j | j d | d
 | d t   | j | j d | d	 | d
 | d t   | j | j d | d	 | d
 | d t   x' t |  D] \ }	 }
 t | |
  qHWd  S(   NRM   R   R   R%   i   i   R  R  RB   RC   (   R+   R   RM   RB   RC   RU   RG   R   R	   RY   R   R   R   Rb   R   R   R    t	   enumerate(   R,   R   R   R   R   RM   RB   RC   t   resultsR   t   r(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_reindex_multi  sD    



c         C   sb   |  j  j d |  j  j d  d |  j  j d  d |  j  j d   } |  j  j |  } t | |  d  S(   NRM   iR   R   (   R+   R   RM   RB   RC   RC  R   (   R,   R  t   smaller_like(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_reindex_like  s
    c         C   s  |  j  j d d d g d d } |  j  j d d d d g  } t | |  |  j  j d	 d d d g d d } |  j  j d
 d d d d g  } t | |  |  j  j d
 d d d d g  } |  j  j d	 d d d g d d } t | |  t j t |  j  j d d d d g d d d  S(   Ni   i    i   R|   RM   R   R)   R   i   R   R   R   R   R(  ii   (   R+   t   takeR   R   R1   R2   R   (   R,   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_take  s    !$!!$c         C   sn  d d  l  } t |  j j  } t |  j j  } t |  j j  } | j |  | j |  | j |  |  j j d |  } | j d d  } t	 | |  j  |  j j d |  } | j d d d t
  } t	 | |  j j d |  j j d  d  d    |  j j d |  } | j d d  } t	 | |  j  |  j j d |  } | j d d	  } t	 | |  j  d  S(
   NiRM   R|   i    t	   ascendingR   i   R   i   (   R   RL   R+   RM   RB   RC   t   shuffleR   t
   sort_indexR   RU   (   R,   R   t   ritemst   rmajort   rminort   random_ordert   sorted_panel(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_sort_index  s*    )c            s  |  j  j d  } t j | j  j   s0 t  |  j  j d d  } t | d |  j  d j d d   |  j  j   } d | d <| j d d  } t | d | d j d d   |  j  j	 d g   } | j d  } t
 | |  t j t |  j  j  t j t |  j  j d d d	 t j t |  j  j d
 d g  t j t |  j  j d  t t j j d d d     t j   j d d  d d  d d  f <t j t   f d    t d d
 g d d
 g g d d g d d g g g d d d g d d d g d t j } t d d
 g d t j g g d d g d t j g g g d d d g d d d g d t j } | j d d	 d t  t
 | |  t d t j g d d
 g g d t j g d d g g g d d d g d d d g d t j } | j d d d t  t
 | |  d  S(   Ni    R`  t   backfillR)   RD   R  RM   i   t   ffilli   i   i   i   c              s     j  d d d S(   Ni  t   limiti   (   RE  (    (   R   (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0     s    i
   i   i   R  R7  RC   Rd   R   R   t   inplacet   bfill(   i   i   (   R+   RE  RY   t   isfiniteR   R#  RG   R   R%   R   R   R1   R2   R   R7   R   R   R   Rb   R   R3   R  R    (   R,   t   filledR+   R   R   RJ  RK  (    (   R   s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_fillna  sD    


+	399c         C   sN   t  |  j j   |  j j d d   t  |  j j   |  j j d d   d  S(   NR`  R  R  (   R   R+   R  RE  R  (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_ffill_bfill  s    c         C   s5   |  j  j d d  d d  d d  } | j d d  d  S(   NR   R   R|   RM   t   valueg        (   R+   R   R>   RE  (   R,   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_truncate_fillna_bug   s    !c         C   sZ  |  j  j d d  } | j |  j  j k s0 t  |  j  j d d  } | j |  j  j k s` t  |  j  j d d  } | j |  j  j k s t  |  j  j   } | j d d  } t j | j	 d <| j d d  } t
 | |  |  j  j d d  } | j |  j  j k st  |  j  j d d  } t
 |  j  |  t |  j   t |  k sVt  d  S(   NRM   R   R   i    i   (   i    i    i   (   R+   R;  RM   RC   RG   RB   R%   RY   Rb   R   R   t   id(   R,   R   R+   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_swapaxes'  s     c         C   s&  |  j  j d d d  } |  j  j d d  } t | |  |  j  j d d d d d d  } |  j  j d d  } t | |  |  j  j d d d d d } |  j  j d d  } t | |  |  j  j d d d d } |  j  j d d  } t | |  t j t d d ! |  j  j d d d d d Wd  QXt j t d d $ |  j  j d d d d d d Wd  QX|  j  j d d	 d
  } t | |  |  j  j d d d  } |  j  j d d  } | j d d  } t | |  |  j  j d d
 d	  } t | |  t j t |  j  j d
 d
 d	  d  S(   NR   R   RM   R   s   not enough/duplicate argumentst   majs   repeated axis in transposei   i   i    (   R+   R  R;  R   R1   R2   R7   R   (   R,   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_transpose@  s@    			
"
c         C   s   |  j  j   } | j d d d d t } | j d d  } | j d d  } t | |  t j | j d <t	 | j d	  s t
  d  S(
   Ni   i    i   R%   RM   R   R   (   i    i   i   (   i   i    i   (   R+   R%   R  R    R;  R   RY   Rb   R   R   RG   (   R,   R+   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_transpose_copyn  s    c      
   C   s  |  j  j   } |  j  j   j d d  } t | |  |  j  j d t  } t | j   |  j   | j j d k sz t	  |  j  j d t  } | j
 t j j t |    } | j   } t | |  j   t t j j d d  d d	 d	 d
 d
 d d g d d d d d d g g d d d g } d d g | j _ d | j _ | j   j   } | j j | j j k sqt	  | j j | j j k st	  d  S(   Nt   howRa   t   filter_observationsR   R   i   i   R   R  R7  R:   i    i   R   R  R  RD   RW  RY  (   R   R   (   R+   R   t   dropnaR   RU   R   t   to_panelR   t   namesRG   R  RY   R   t   permutationRm   R	   R   R   RF   (   R,   t   filteredR   t
   unfilteredR   t   unsortedt   pant   rdf(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_framex  s&    !c         C   s   |  j  j d  } d | d <| d d k | d <| j   } | j   } | d j j t j k sg t  t	 | d | d d t
 | j   } | d j d  | d <| j   } | j   } d | d <t | |  d  S(   Ni    RD   R  R)   t   boolR  t   category(   R+   RE  R   R  R   R   RY   R   RG   R   RU   R  R%   R   (   R,   R+   R   Re  R   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_frame_mixed  s    

c         C   s  t  j d d d d g  } t d d d g d d d g d d d g d	 d
 d g g d d d d g d | } t i | d 6| d 6 } t  j d d d d d d d d  d! d" d# d$ g d d  d  d g } t i d d d d d d d d d d	 d
 d g d 6d d d d d d d d d d	 d
 d g d 6d | } | j   } t | |  t j | j	 d% j	 d <| j   } t | | d  t  j d& d' d( t j d f g  } t d d d g d d d g d d d g d	 d
 d g g d d d d g d | } t i | d 6| d 6 } t  j d) d* d+ d, d- d. d/ d0 d1 t j d d f t j d d f t j d d f g d d  d  d g } | | _
 | j   } t | |  d  S(2   Ni   R  R  i   R  R7  i   R:   i   R   R   R   R   R(  R   t   i1t   i2R  R   i    (   i   R  (   i   R  (   i   R  (   i   R  (   i   R  R   (   i   R  R   (   i   R  R(  (   i   R  R   (   i   R  R   (   i   R  R(  (   i   R  R   (   i   R  R   (   i   R  R(  (   i   R  R   (   i   R  R   (   i   R  R(  (   i    i    (   i   R  (   i   R  (   i   R  (   i   R  R   (   i   R  R   (   i   R  R(  (   i   R  R   (   i   R  R   (   i   R  R(  (   i   R  R   (   i   R  R   (   i   R  R(  (   R   R  R	   R   R>   R   R   RY   Rb   R   R   (   R,   R   R   Re  t   expected_idxR   R   t   ex_idx(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_frame_multi_major  sZ    		c   	      C   st  t  d d d g d d g g d d d d d g d d d d g g  } t  j d) d* d+ d, d- d. g  } t d d d d g d d d d g d d d d g d d d d g d d d d g d  d! d" d# g g d$ | d% | } t i | d& 6| d' 6 } t  j d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE dF g d( d  d  d  d  g } d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d d g d  d  g d! d! g d" d" g d# d# g g } | j   } t | d$ d& d' g d% | } t | |  d  S(G   Nt   levelst   C_At   C_Bt   C_1t   C_2t   codesi    i   R  R  i   i   t   threei   t   fouri   i   i   i   R  R7  t   wRd   R:   R   R   t   ziiiiiiiiR   R   R  R  R  (   i   R  (   i   R  (   i   R  (   i   R  (   i   R	  (   i   R
  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R  R  R  (   i   R	  R  R  (   i   R	  R  R  (   i   R	  R  R  (   i   R	  R  R  (   i   R
  R  R  (   i   R
  R  R  (   i   R
  R  R  (   i   R
  R  R  (   R   R  R	   R   R>   R   R   (	   R,   R*  R   R   Re  t   exp_idxt   exp_valR   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_frame_multi_major_minor  sF    '!$$$c         C   s   t  j d d d g  } t i t j d d g d 6d | } t i | d 6| d 6 } | j   } t  j d d g d	 d  d  d
 g } t i d d g d 6d d g d 6d | } t | |  d  S(   Ni   R  i   R  R   R   R  R  R  R   g      ?(   i   R  (   i   R  (   i   R  (   i   R  R   (   i   R  R   (	   R   R  R	   RY   Rb   R   R   R>   R   (   R,   R   R   Re  R   R  R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_frame_multi_drop_level  s    %,c         C   s   t  t j j d d d d j d  d d d d d d d d d d d g
 d d d d d	 d
 d d d	 d
 g
 g } | j   } t | d j d d d g f  j   s t	  d  S(   Ni    i
   t   sizei   i   R   i   i   i   i   (   i
   i   (
   R	   RY   R   R  R   R  R   R   R#  RG   (   R,   R   R+   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_panel_na_handling  s
    '!*c         C   s{   t  i d d d g d 6d d d g d 6d d d g d 6 } | j d d g  } t j t d d	  | j   Wd  QXd  S(
   Ni    i   R  R7  i   i   R:   R   s   non-uniquely indexed(   R	   t	   set_indexR1   R2   R   R  (   R,   R   t   idf(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_panel_duplicates  s    <c         C   s:  t  j j d d d  } t | d t d  } t | d t d  } | d } | j d } t | |  | d } | j d } t | |  | j d d	 g } d d g | _ | j d } t	 | |  t  j j d d d  } t | d
 t d  } t | d
 t d  } | j d  d   d f } | j d  d   d f } t | |  | j d  d   d f } | j d  d   d f } t | |  | j d  d   d d	 g f } d d g | _
 | j d  d   d f } t	 | |  t  j j d d d  } t | d t d  } t | d t d  } | j d  d   d  d   d f } | j d  d   d  d   d f } t | |  | j d  d   d  d   d f } | j d  d   d  d   d f } t | |  | j d  d   d  d   d d	 g f } d d g | _ | j d  d   d  d   d f } t	 | |  d  S(   Ni   id   RM   R   t   AACDER   i    R  R   RB   RC   (   RY   R   R   R   RL   R   R   R   RM   R   RB   RC   (   R,   R
  t   no_dup_panelR+   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_panel_dups#  sN    

""""("c         C   s   d  S(   N(    (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_filter^  s    c         C   sB   |  j  j   } t | d d |  j  d j d  d d t d  S(   NR)   i   i    R  (   R+   t   compoundR   t   productRU   (   R,   t
   compounded(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_compounda  s    
c   	      C   s  |  j  j d } |  j  j d } |  j  j d  } t |  j  j |  | j |   |  j  j d } |  j  j d } |  j  j d d d } t |  j  j |  | j |   |  j  j d } |  j  j d } |  j  j d d d } t |  j  | | |  |  j  j d  } t d   |  j  j	   D  } t
 | |  g  t d  D] } d	 | t   f ^ qI} t |  } t j | d
 d } | j d  } t | j | j  d  S(   Ni    i   R|   R   RM   ic         S   s,   i  |  ]" \ } } | j  d   d   |  q S(   i(   t   shift(   R~  R   RV   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pys
   <dictcomp>  s   	t   abcdes   item R  (   R+   RB   R  R   R   RC   R   RM   R   R   R   RL   R   R  Rw  R   R  (	   R,   R   t   idx_lagt   shiftedR   R   t   chR
  t   mixed_panel(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt
   test_shifth  s0    	)c   	   	   C   s  t  j   } | j d  } | j d  } t | |  | j d d  } t | |  | j d t    } t | |  t j t d d  | j d d  Wd  QXt   } | j d  } | j d  } t | |  | j d | j	 j
  } t | |  t | j d | j d	 t t j | j	   d
 | j } | j d  } | j d  } t | | j d   t | |  | j d  d   d d d g d  d   f } t j t | j  d  S(   Ni   iR  R   R   s   does not matcht   MRM   RB   RC   i    i   i   (   R"   t   makePeriodPanelt   tshiftR   R   R1   R2   R   R'   RB   R  R   R   RM   R
   RY   Rz   RC   R   (	   R,   t   psR!  t	   unshiftedt   shifted2t   shifted3R+   t   inferred_tst   no_freq(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_tshift  s2    	+c         C   s'  t  i d d d g d 6d d d g d 6 } | d } t  i d d d	 g d 6d d d
 g d 6 } t i | d 6| d 6| d 6 } | j   } t i | j   d 6| j   d 6| j   d 6 } t | |  | j d d  } t | |  | j d d  } t i | j d  d 6| j d  d 6| j d  d 6 } t | |  | j d d  } t i | j d d  d 6| j d d  d 6| j d d  d 6 } t | |  | j d d  } t | |  | j d d d d  } t i | j d d d d  d 6| j d d d d  d 6| j d d d d  d 6 } t | |  | j d d  } t i t  i t j t j t j g d 6t j t j t j g d 6 d 6t  i d d d g d 6d d d d d g d 6 d 6t  i d d d d d g d 6d d d d	 g d 6 d 6 } t | |  | j d d  } t | |  | j d d d d  } t i t  i t j t j t j g d 6t j t j t j g d 6 d 6t  i t j t j t j g d 6t j t j t j g d 6 d 6t  i d d d g d 6d d d d d g d 6 d 6 } t | |  d  S(   Ni   i   i   t   c1i   i   i   t   c2i   i   R  R  t   i3R|   R   R   RM   g      ?g?g      ?g      ?i    g?g       @(   R	   R   t
   pct_changeR   RY   Rb   (   R,   R  R  t   df3Re  R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_pct_change  s`    ,
,!" !"  %c   	   	   C   s=  d d g d d g d d g d d g d	 d
 g g d d g d d g d d g d d g d d g g g } g  | D]A } g  | D]. } g  | D] } t  t j |   ^ q ^ qz ^ qm } t | d d d g d t d d d d d d g } t | d d d g d t d d d d d d g } | j   } t | |  d  S(   Ng	g@i    g IgCl@gHz^@g1xgQ8V@ig     W@gHzGg      @gףp=
@g rhQRgC,"gQ7@gZdq@g(\Xi   g      SRM   R  R  RB   s   1/1/2000R   i   RC   R   R   (   Rl  RY   t   aroundR   R   t   roundR   (	   R,   R   R   t   jR   t   evaluesR   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt
   test_round  s    Kc   
   	   C   su  d d g d d g d d g d d g d	 d
 g g d d g d d g d d g d d g d d g g g } g  | D]A } g  | D]. } g  | D] } t  t j |   ^ q ^ qz ^ qm } t | d d d g d t d d d d d d g } t | d d d g d t d d d d d d g } t j |  } t | |  d }	 t j t	 d  |	  t j | d! | Wd  QXd  S("   Ng	g@i    g IgCl@gHz^@g1xgQ8V@ig     W@gHzGg      @gףp=
@g rhQRgC,"gQ7@gZdq@g(\Xi   g      SRM   R  R  RB   s   1/1/2000R   i   RC   R   R   s$   the 'out' parameter is not supportedR   RA  (
   Rl  RY   R5  R   R   R6  R   R1   R2   R   (
   R,   R   R   R7  R   R8  R   R   R   R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_numpy_round  s"    Ks&   ignore:Using a non-tuple:FutureWarningc      	   C   s   t  j d d d d g d d d g } t t j j d  d
 | d t j d	  d t j d	  } | d } | j d } t | |  | j d d g k j	   s t
  | j d d g k j	   s t
  t  j d d d g d d d g d  S(   NR  i   i   R7  R  t   firstt   secondi   i   RM   RB   RC   (   R  i   (   R  i   (   R7  i   (   R7  i   (   i   i   i   (   R  i   (   R  i   (   R7  i   (   R   R  R   RY   R   R   R   R   RM   R#  RG   (   R,   t   indRe  t   f1t   f2(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_multiindex_get  s    
!!c         C   s   t  j d d d g d d d g } t |  j j  } | | _ | d } | j d d g k j   sj t  | d } | j d d	 d
 d g k j   s t  d  S(   NR  i   i   R7  R  R;  R<  R   R   R(  R   (   R  i   (   R  i   (   R7  i   (   R7  i   (	   R   R  R   R+   Rc  RM   R#  RG   R   (   R,   R=  Re  R>  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_multiindex_blocks!  s    	
!
c         C   s   t    } t |  d  S(   N(   R   R@   (   R,   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_repr_empty-  s    	s   ignore:Using:FutureWarningc         C   s   i d d 6d d 6d d 6} |  j  j d |  } t d d d g  } t j | j |  |  j  j d t j  } t d	 d
 d d g  } t j | j |  |  j  j d | d t	  } d | d <|  j  d j
 d k j   s t  d  S(   NRD   R)   RW  R   RY  R   RM   RC   R  R7  R:   R   R%   g      @i   (   R+   t   renameR
   R"   R  RM   R  t   lowerRC   RU   R   R#  RG   (   R,   t   mappert   renamedt   expt   renamed_nocopy(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_rename2  s    
c         C   sz   t  |  j d |  j j  |  j d |  j d <t  |  j d |  j j  |  j d |  j d <t  |  j d |  j j  d  S(   NR)   R  R   (   R   R+   R)   R  R   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_get_attrC  s
    c         C   s   d
 d d d d g } t  j |  } t t j j d d  d | } | j   } t | j d  | j	 d d	 d j
    d  S(   Nt   MSFTi   i   t   AAPLi   i   i   R   t   level(   RK  i   (   RK  i   (   RL  i   (   RL  i   (   RK  i   (   R   R  R	   RY   R   R  R  R   R   R   R  (   R,   t   tuplest   midxR   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_from_frame_level1_unsortedL  s    	!c      
   C   s  y8 d d  l  } d d  l } d d  l } d d l m } Wn t k
 rX t j d  n Xx d d g D] } t d |   } |  j	 j
 |  y | |  } Wn t k
 r t j d  n XxE |  j	 j   D]4 \ } }	 | j t |  d d }
 t |	 |
  q WWd  QXqf Wd  S(	   Ni(   t	   ExcelFiles   need xlwt xlrd openpyxlt   xlst   xlsxs   __tmp__.t	   index_coli    (   t   xlwtt   xlrdt   openpyxlt   pandas.io.excelRQ  t   ImportErrorR1   t   skipR   R+   t   to_excelR   t   parseR  R   (   R,   RU  RV  RW  RQ  t   extt   patht   readerR   R   t   recdf(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_excelT  s"    c   
   	   C   s   y, d d  l  } d d  l } d d l m } Wn t k
 rL t j d  n Xt d   } |  j j	 | d d y | |  } Wn$ t k
 r } t j d |  n XxE |  j j
   D]4 \ } } | j t |  d d	 }	 t | |	  q WWd  QXd  S(
   Ni(   RQ  s,   Requires xlrd and xlsxwriter. Skipping test.s   __tmp__.xlsxt   enginet
   xlsxwriters   cannot write excel file: %sRT  i    (   RV  Rc  RX  RQ  RY  R1   RZ  R   R+   R[  R   R\  R  R   (
   R,   RV  Rc  RQ  R^  R_  R  R   R   R`  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_excel_xlsxwriteri  s    s   ignore:'.reindex:FutureWarningc         C   sK  t  t j j d d d  d t d  } t j | j d  d   d d g d f <| j d	 d
  } | j d  d   d d d g d  d   f } t | |  | j	   } | j d	 d
 d t
  t | |  | j d	 d
 d d  } t | |  t j | j d  d   d d g d  d   f <| j d	 d
 d d  } | j d  d   d d d g d  d   f } t | |  t  t j j d d d  d t d  } t j | j d g d  d   d f <| j   } | j d d d g } t | |  | j d d  } t | |  t j | j d <| j d d  } | j d d d g } t | |  d  S(   Ni   i   i   RB   R  R7  R   i    R|   i   R  R:   R  R  R  R#  RM   t   abcd(   R   RY   R   R   RL   Rb   R   R  R   R%   R    (   R,   R   R   RG  t   inp(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_dropna|  s2    *%+++*"c            s-  t  i d d g d 6d d g d 6 } t i | d 6| d 6     f d	   } t i | d 6 } | d d
 d g |  t j t   j d    j d d d } t |      j d d g d d } t i | d 6 } t | |  t  i d g d 6d g d 6d d g } t i | d 6| d 6 } | d
 d d d g |  t  i d g d 6d g d 6d d
 g } t i | d 6| d 6 } | d g d d d g |  | d g } t i | d 6| d 6 } | d g d d d g |  | d g } t i | d 6| d 6 } | d d d d g |  d  S(   Ni   i   R   i   i   R   t   Onet   Twoc            s   yY   j  |  d | } t | |  x0 | D]( }   j  |  d | } t | |  q, WWn( t k
 r t d | | f    n Xd  S(   NR|   s*   Failed with axis_number %d and aliases: %s(   t   dropR   RG   R   (   t   drop_valt   axis_numbert   aliasesR   t   actualt   alias(   R+   (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt
   check_drop  s    i    RM   t   Threet   errorsR   R   RB   R   RC   R   (   R	   R   R1   R2   t   KeyErrorRj  R   (   R,   R   Rp  R   t   droppedt   exp_df(    (   R+   s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_drop  s.    &))c         C   sh  t  d t j d g d t j d g d t j d g d t j d g g d t j d g d t j d g d t j d g d t j d g g g  } t  d d t j g t j t j d g g g d d g } | j |  t  d t j d g d t j d g d t j d g d t j d g g d d d g d t j d g d t j d g d t j d g g g  } t | |  d  S(	   Ng      ?g      @g@g       @i   RM   i   i   (   R   RY   Rb   t   updateR   (   R,   R  t   otherR   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_update  s    !6!!c      	   C   s  t  i t d t j d g d t j d g d t j d g d t j d g g  d 6t d t j d g d t j d g d t j d g d t j d g g  d 6 } i t d d t j g t j t j d g g  d 6} | j |  t  i t d t j d g d t j d g d t j d g d t j d g g  d 6t d d d g d t j d g d t j d g d t j d g g  d 6 } t | |  d  S(	   Ng      ?i   g      @R  R  g@g       @i   (   R   R	   RY   Rb   Rw  R   (   R,   R  Rx  R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_update_from_dict  s*    .c         C   sn  t  d t j d g d t j d g d t j d g d t j d g g d t j d g d t j d g d t j d g d t j d g g g  } t  d d t j g t j t j d g g g d d g } | j | d t t  d t j d	 g d t j d	 g d t j d g d t j d g g d d d g d t j d g d t j d g d t j d g g g  } t | |  d  S(
   Ng      ?g      @g@g       @i   RM   i   t	   overwritei   (   R   RY   Rb   Rw  RU   R   (   R,   R  Rx  R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_update_nooverwrite  s    !6!!c         C   st  t  d t j d g d t j d g d t j d g d t j d g g d t j d g d t j d g d t j d g d t j d g g g  } t  d d t j g t j t j d g g g d d g } | j | d d	   t  d t j d g d t j d g d t j d g d t j d g g d t j d
 g d t j d g d t j d g d t j d g g g  } t | |  d  S(   Ng      ?g      @g@g       @i   RM   i   t   filter_funcc         S   s
   |  d k S(   Ni   (    (   Rd   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   	  s    i   (   R   RY   Rb   Rw  R   (   R,   R  Rx  R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_update_filtered	  s    !6!!*s   bad_kwarg, exception, msgt	   somethingRr  s   The parameter errors must.*t   innert   joins   Only left join is supportedc         C   sN   t  d t j d g g g  } t j | d |  | j | |  Wd  QXd  S(   Ng      ?g      @R   (   R   RY   Rb   R1   R2   Rw  (   R,   t	   bad_kwargt	   exceptionR  R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_update_raise_bad_parameter(	  s    c         C   s   t  d t j d g d t j d g d t j d g d t j d g g d t j d g d t j d g d t j d g d t j d g g g  } t j t d d  | j | d d Wd  QXd  S(   Ng      ?g      @R   s   Data overlapsRr  t   raise(   R   RY   Rb   R1   R2   R   Rw  (   R,   R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_update_raise_on_overlap2	  s    !t   raise_conflictc         C   s]   t  d t j d g g g  } t  g  g g  } t j t   | j | d | Wd  QXd  S(   Ng      ?g      @R  (   R   RY   Rb   R"   R   R!   Rw  (   R,   R  R  Rx  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_update_deprecation=	  s    c         C   sf  |  j  j d d  j t |  j  d d k j   s9 t  |  j  j d d  j t |  j  d d j k j   su t  |  j  j d d  j t |  j  d d j k j   s t  |  j  j d d  j t |  j  d d k j   s t  |  j  j d d  j t |  j  d d j k j   s&t  |  j  j d d  j t |  j  d d j k j   sbt  d  S(   NR|   i    i   i   (   R+   R#  R   R   RG   R  Ra   R   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_all_anyD	  s    !$$!$c         C   s<   t  j t |  j j d t t  j t |  j j d t d  S(   Nt	   bool_only(   R1   R2   R3   R+   R#  R    Ra   (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_all_any_unhandledR	  s    c         C   s3   t  j t |  j j  t  j t |  j j d  d  S(   NR)   (   R1   R2   R3   R+   R:  (   R,   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_sort_valuesW	  s    (N   R<   R=   Ra  Ri  Rq  Rr  Rt  Rx  Ry  R|  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R$  R.  R4  R9  R:  R1   R   R   R@  RA  RB  RI  RJ  RP  Ra  Rd  Rg  Rv  Ry  Rz  R|  R~  t   parametrizeR   R3   R  R  R    RU   R  R  R  R  (    (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR_  u  s   		,				+				1		
								6	M		/		.				2				.	
			3	&				;			#	&	8								#	.				%	$		t   TestPanelFramec           B   s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sE   
    Check that conversions to and from Panel to DataFrame work.
    c         C   s1   t    } | j   |  _ | j d t  |  _ d  S(   NR  (   R'   R   R+   RU   t   unfiltered_panel(   R,   R`  R+   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyRa  b	  s    	c         C   s   |  j  j   } | j d | j d   } | j   } |  j  | } t | j | j  | d  | d |  j  d <t |  j  d j | j  | d d t d  S(   NR   ii   R)   RD   R  (	   R+   R  R   RB   R   R   R   R   RU   (   R,   Re  R  t   lp2R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_ops_differently_indexedg	  s    
c         C   s8   |  j  j d  } t j |  j  d  } t | |  d  S(   Ni   (   R+   R   R	   t   __mul__R   (   R,   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_ops_scalarv	  s    c         C   sT   |  j  j   } |  j  j | d j   d d } t | j   d | d d  d  S(   NR)   R|   i    i   (   R+   R  R   t   stackR   (   R,   Re  R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR   {	  s    "c         C   sn   |  j  j   } |  j  j |  j   } | j   } t | d d | d  |  j  j |  j  j d g   } d  S(   NR)   i   (   R+   R  R   R   R   (   R,   Re  R   t   wide_result(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR   	  s
    c         C   s9   |  j  j d  } t |  j  j  d } t | |  d  S(   Ni   (   R+   R   R	   Rc  R   (   R,   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_combine_scalar	  s    c         C   s   |  j  d d  } |  j  j | d d } t j |  j  | d d } t | |  |  j  j d } |  j  | } t j |  j  | d d } t | |  d  S(   NR)   i
   R|   i    i   i   (   R+   R   R	   R   R   (   R,   RP   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_combine_series	  s    c         C   s?   |  j  j   } |  j  d j   } t | d d | d  d  S(   Ni   R)   (   R+   R  R   (   R,   Re  R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_operators	  s    c   	         sD  d d d d d d d d g } t  j s0 i  } n i d d 6} |  j j   |  _ x t j j d	 d
  t j j d d  d g D] } x | D] } | j | |  } t t	 |      |  j |  } t |  j |  |  } t
 | | d t   f d   } | |  j |  } t |  j d |  |  } t
 | |  q Wq} Wd  S(   NR   R   R   R   R   R   R   R   iii   i2   i    t   check_panel_typec            s     | |   S(   N(    (   Rd   R   (   RV   (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR0   	  s    R  (   R   R   R+   R  RY   R   R  t   getRE   R   R   R    (	   R,   R   Rm  t   nR   Ro  RG  R   t   r_f(    (   RV   s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_arith_flex_panel	  s"    		4c         C   sl   d   } |  j  j d d  } | | j j d  s: t  | j d d  } | | j j d  sh t  d  S(   Nc         S   s   |  d |  d  k j    S(   Ni   i(   Ra   (   t   arr(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   is_sorted	  s    RM  i   i    (   R+   R  R   R  RG   (   R,   R  t   sorted_minort   sorted_major(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_sort	  s
    	c         C   s   t    } |  j j |  d  S(   N(   R   R+   t	   to_string(   R,   t   buf(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_string	  s    	c         C   sE   t  |  j t  rA d } t j t d |  |  j j Wd  QXn  d  S(   Ns   sparsifying is not supportedR   (   R[  R+   R   R1   R2   R3   t	   to_sparse(   R,   R  (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_to_sparse	  s    c         C   s  |  j  j j d } | d | d } } |  j  j | |  j   } |  j  j   d j | |  } t | d | d t |  j  j d |  j   } |  j  j   d j d |  } t | d | d t |  j  j d |  j   } |  j  j   d j d |  } t | d | d t |  j  j   } | j d  d  d  } | j d |  } | j	   }	 |	 j | j d	 | j d
  }
 | j | j d	 | j d
  } t
 | |
 j    t j t |	 j | j d
 | j d	  d  S(   Ni    i   i   R)   R  R   R   R   i   i(   R+   R   R  R   R  R   RU   RB   R   R   R   R1   R2   R   (   R,   R   R   R   R   R   Re  t	   new_indexR  R  t   lp_trunct   wp_trunc(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR   	  s(      c         C   s/  d d l  m } | |  j d  j t j  } t | j  t |  j j j	 d  k s\ t
  | |  j d  j t j  } t | j  t |  j j j	 d  k s t
  i d d 6d d	 6d
 d 6d
 d 6} | |  j d d | j j t j  } t | j  d k st
  t j | j t d d
 g   d  S(   Ni(   t   make_axis_dummiesR   i   R   i    R  R   R   R  R(  R   t	   transformi   (   t   pandas.core.reshape.reshapeR  R+   R  RY   t   uint8Rm   R   R   R  RG   R  R"   R  R
   (   R,   R  t   minor_dummiest   major_dummiest   mappingt   transformed(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_axis_dummies	  s    .."c         C   s{   d d l  m } m } |  j j j d |  j d <| |  j d  j t j  } | |  j d  } t	 j
 | j | j  d  S(   Ni(   t   get_dummiesR  i   t   LabelR   (   R  R  R  R+   R   R  R  RY   R  R"   RH  R   (   R,   R  R  R  t   dummies(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_get_dummies
  s
    c         C   s>   |  j  j d d  } |  j  j   j d  } t | |  d  S(   NRM  R   R   (   R+   R\   R  R   (   R,   t   meanst
   wide_means(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR]   

  s    c         C   s>   |  j  j d d  } |  j  j   j d  } t | |  d  S(   NRM  R   R   (   R+   RO   R  R   (   R,   t   sumst	   wide_sums(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR[   
  s    c         C   s   |  j  j } |  j  j d d  d } | j d } xC t | j d  D]. \ } } | | | | k j   k sF t  qF W|  j  j d d  d } | j d } xC t | j d  D]. \ } } | | | | k j   k s t  q Wd  S(   NRM  i    R)   i   (   R+   R   RQ   R  R  R  RO   RG   (   R,   R   t   major_countt   level_codesR   R   t   minor_count(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyRW   
  s     & c         C   s   |  j  j d d g  } |  j  j d g  } | j |  } t | j  d k sW t  t j t | j |  j  j d d g   d  S(   NR)   R   R   i   (	   R+   R   R  Rm   R   RG   R1   R2   R   (   R,   t   lp1R  t   joined(    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt	   test_join%
  s    (   R<   R=   t   __doc__Ra  R  R  R   R   R  R  R  R  R  R  R  R   R  R  R]   R[   RW   R  (    (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyR  \	  s(   											
			'					c          C   s   t  j d d d d g d d d g  }  t j t j d d d d g d  t j d d d g d  g d d d g } t j |  |  d  S(   Ni   i   i   i   R  t   timeR+   (	   t   panelmt   panel_indexR   t   from_arraysRY   t   tilet   repeatR"   R  (   R   R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_panel_index1
  s
    '!c          C   sT   t  i t i d d g d 6 d 6 }  t j |   } | t j t  k sP t  d  S(   Ni   i   R7  R   (   R   R	   RY   R#  R   R    RG   (   Re  R   (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   test_panel_np_all9
  s    &(A   R    R   t   warningsR   R   t   numpyRY   R1   t   pandas.compatR   R   R   R   R   t   pandas.util._test_decoratorst   utilt   _test_decoratorsR   t   pandas.core.dtypes.commonR   R9  R	   R
   R   R   R   R   R   R   t   pandas.core.nanopsR   R   t   pandas.core.panelt   coreR+   R  R   t   pandas.util.testingt   testingR"   R   R   R   R   R   R   R  R   t   pandas.io.formats.printingR   t   pandas.tseries.offsetsR   R   R'   R   R   R  R(   R?   R   R   R_  R  R  R  (    (    (    s6   lib/python2.7/site-packages/pandas/tests/test_panel.pyt   <module>   sJ   (:4		x 	     	