ó
šxŠ\c           @   s  d  d l  Z d  d l Z d  d l m Z m Z m Z d  d l m Z	 e j
 d „  ƒ Z e j j d d „  d „  f d „  d	 „  f d
 „  d „  f g ƒ d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e j j d d d d g d d d g g d d  d g d d d g d d g f d d d  g d d d! g g d d  d g d" d# d$ g d% d& g f d d d g d d' d( g g d d  d g d d d) g d* d+ g f d d, d' g d d d g d d d g g d d  d g d' d d g d( d- d. g f g ƒ d/ „  ƒ Z d0 „  Z d S(1   iÿÿÿÿN(   t	   DataFramet
   MultiIndext   Series(   t   testingc          C   s   d d „ }  |  S(   s—   
    Factory function to create simple 3 x 3 dataframe with
    both columns and row MultiIndex using supplied data or
    random data by default.
    c      	   S   sj   |  d  k r$ t j j d d ƒ }  n  t |  d d d d g d d d g g d d d d g d d d	 g g ƒS(
   Ni   t   columnsi   i   i   i   i
   t   indexi   (   t   Nonet   npt   randomt   randnR    (   t   data(    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   _simple_multiindex_dataframe   s    'N(   R   (   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   simple_multiindex_dataframe   s    s   indexer, expectedc         C   s   |  j  d S(   Ni    (   t   iloc(   t   df(    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   <lambda>   s    c         C   s2   t  |  d d d d d g d d d g g d d	 ƒS(
   Ni    R   i   i   i   i   i
   t   name(   i   i   (   R   (   t   arr(    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyR      s    c         C   s   |  j  d S(   Ni   (   R   (   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyR      s    c         C   s2   t  |  d d d d d g d d d g g d d	 ƒS(
   Ni   R   i   i   i   i
   R   i   (   i   i   (   R   (   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyR      s    c         C   s   |  j  d  d  … d f S(   Ni   (   R   (   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyR      s    c         C   s>   t  |  d  d  … d f d d d d g d d d g g d d ƒS(	   Ni   R   i   i   i
   i   R   (   i   i
   (   R   (   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyR      s   c         C   sM   t  j j d d ƒ } | | ƒ } |  | ƒ } | | ƒ } t j | | ƒ d  S(   Ni   (   R   R   R	   t   tmt   assert_series_equal(   t   indexert   expectedR   R   R   t   result(    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   test_iloc_returns_series   s
    
c         C   sE   |  ƒ  } | j  d d g } | j d d t ƒ} t j | | ƒ d  S(   Ni    i   i   t
   drop_level(   R   t   xst   FalseR   t   assert_frame_equal(   R   R   R   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   test_iloc_returns_dataframe(   s    	c         C   sN   t  j j d d ƒ } |  | ƒ } | j d } | d } | | k sJ t ‚ d  S(   Ni   i   (   i   i   (   i   i   (   R   R   R	   R   t   AssertionError(   R   R   R   R   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   test_iloc_returns_scalar/   s
    
c          C   s–   t  d d d d g d d d d g g Œ  }  t j |  ƒ } t t j j d d ƒ d | ƒ} | j d d g } | j d d	 t	 ƒ} t
 j | | ƒ d  S(
   Nt   at   bt   xt   yi   R   i   i   R   (   t   zipR   t   from_tuplesR    R   R   R	   R   R   R   R   R   (   t   tupR   R   R   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt    test_iloc_getitem_multiple_items7   s    *!c       
   C   s   t  j j d d ƒ }  t |  d d d d g d d d g g d d d d d	 g d
 d
 d d g g ƒ} | j d } |  d } | | k sŒ t ‚ d  S(   Ni   i   R   t   it   jt   At   BR   t   kt   Xt   Yi   (   i   i   (   i   i   (   R   R   R	   R    R   R   (   R   R   R   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   test_iloc_getitem_labelsA   s    	'
c         C   s1   |  } | j  d  } | d  } t j | | ƒ d  S(   Ni   (   R   R   R   (   t    multiindex_dataframe_random_dataR   R   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   test_frame_getitem_sliceL   s    
c         C   sU   |  } d | j  d *| j d  d k j ƒ  s2 t ‚ | j d d k j ƒ  sQ t ‚ d  S(   Ni    i   (   R   t   valuest   allR   (   R/   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   test_frame_setitem_sliceS   s    c          C   s£   t  j d d d g ƒ }  t  j d d d d g ƒ } t t j d	 ƒ j d ƒ d | d |  ƒ} | j d  d  … d f } | j d  d  … d f } t j	 | | ƒ d  S(   Nt   Ohiot   Greent   Redt   ColoradoR   i   i   R    i   i   i   R   R   (   R4   R5   (   R4   R6   (   R7   R5   (   R   i   (   R   i   (   R    i   (   R    i   (   i   i   (   R4   R6   (
   R   R$   R    R   t   aranget   reshapeR   t   locR   R   (   R   R   R   R   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt    test_indexing_ambiguity_bug_1678[   s    *c          C   sÎ   d d g d d g d d g d d g d	 d
 g g }  t  j d d d d d g ƒ } t |  ƒ } t |  d | ƒ} t g  t d ƒ D]2 } g  t d ƒ D] } | j | | f ^ q’ ^ q ƒ } t j | | ƒ d  S(   Nt   str00t   str01t   str10t   str11t   str20t   srt21t   str30t   str31t   str40t   str41t   CCR)   R*   t   BBR   R    R   i   i   (   RF   R)   (   RF   R*   (   RF   R*   (   RG   R   (   RG   R    (   R   R$   R    t   rangeR   R   R   (   R
   R   R   R   t   rt   cR   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   test_iloc_integer_locationsh   s    Ks!   data, indexes, values, expected_ki   i   i   i!   i   i    i   i   i   i
   i+  iš  iÈ   i,  id   ió  i*  i   i   iè  i   iú  i   i   i   c   	      C   sœ   t  d |  d d d d g ƒ } | j d d g ƒ } | j j ƒ  } x0 t | | ƒ D] \ } } | j | c | 7<qR W| | d <| j } t j | | ƒ d  S(   NR
   R   R'   R(   R+   (   R    t	   set_indexR+   t   copyR#   R   R   R   (	   R
   t   indexesR1   t
   expected_kR   t   seriesR'   t   vR   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt'   test_iloc_setitem_int_multiindex_seriesx   s    
	c         C   s=   |  } | j  d } | j | j d ƒ } t j | | ƒ d  S(   Ni   (   R   R   R   R   R   (   R/   R   R   R   (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   test_getitem_iloc“   s    (   t   numpyR   t   pytestt   pandasR    R   R   t   pandas.utilR   R   t   fixtureR   t   markt   parametrizeR   R   R   R&   R.   R0   R3   R;   RK   RR   RS   (    (    (    sI   lib/python2.7/site-packages/pandas/tests/indexing/multiindex/test_iloc.pyt   <module>   s8   					
						?3??!