
    h
                     D    d dl Zd dlZd dlmZmZ d dlmZ  G d d      Z	y)    N)	DataFrame
MultiIndexc                       e Zd Zd Zd Zy)TestReorderLevelsc                 (   t        dgg dddggg dg dg dgg d	      }t        t        j                  d
      t        j                  d
      d|      }t	        j
                  ||      }|j                  g d      }t	        j                  ||       |j                  g d      }t	        j                  ||       |j                  g d      }t        g dddgdggg dg dg dgg d	      }t        t        j                  d
      t        j                  d
      d|      }t	        j
                  ||      }t	        j                  ||       |j                  g d      }t        dgdgdggg dg dg dgg d	      }t        t        j                  d
      t        j                  d
      d|      }t	        j
                  ||      }t	        j                  ||       |j                  g d      }t	        j                  ||       y )Nbar)onetwothreer      )r   r   r   r   r   r   )r   r      r   r   r   )r   r   r   r   r   r   )L0L1L2)levelscodesnames   )AB)index)r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   )r   r   nparangetmget_objreorder_levelsassert_equal)selfframe_or_seriesr   dfobjresulte_idxexpecteds           SD:\jyotish\venv\Lib\site-packages\pandas/tests/frame/methods/test_reorder_levels.pytest_reorder_levelsz%TestReorderLevels.test_reorder_levels   s   G4q!f=%'9;MN$

 RYYq\		!=UKjj_- ##I.
V$ ##$67
V$ ##I.+aVeW=%'9;MN$

 299Q<biilC5Q::h8
)##I.GeWug.%'9;MN$

 299Q<biilC5Q::h8
)##$67
)    c                 .   |}|j                  g d      }|j                  dd      j                  dd      }t        j                  ||       |d   j                  g d      }|d   j                  dd      j                  dd      }t        j                  ||       |j
                  j                  g dd      }|j
                  j                  ddd      j                  ddd      }t        j                  ||       t        j                  t        d      5  |j                  ddgd       d d d        t        j                  t        d	      5  |j                  j                  g d
       d d d        y # 1 sw Y   KxY w# 1 sw Y   y xY w)N)monthdayyearr   r   r   r   )axiszhierarchical axis)matchzToo many levels)r   r      )r   	swaplevelr   assert_frame_equalassert_series_equalTpytestraises	TypeError
IndexErrorr   )r   /multiindex_year_month_day_dataframe_random_dataymdr"   r$   s        r%   )test_reorder_levels_swaplevel_equivalencez;TestReorderLevels.test_reorder_levels_swaplevel_equivalence5   sO    >##$<===A&00A6
fh/S(()ABs8%%a+55a;
vx0%%&>Q%G55??1aa?0::1aa:H
fh/]]9,?@1vA. A ]]:->?II$$Y/ @? A@ @?s   E?F?FFN)__name__
__module____qualname__r&   r9    r'   r%   r   r      s    '*R0r'   r   )
numpyr   r3   pandasr   r   pandas._testing_testingr   r   r=   r'   r%   <module>rB      s      ?0 ?0r'   