
x\c           @   s  d  d l  Z  d  d l m Z d  d l Z d  d l Z d  d l Z d  d l Z d  d l m Z d  d l	 Z	 d  d l
 Z
 d  d l Z d  d l m Z m Z m Z d  d l j Z d  d l m Z m Z m Z m Z m Z m Z m Z m Z m Z d  d l m Z d  d l  m! Z! d  d l" m# Z# m$ Z$ m% Z% d  d	 l& m' Z' m( Z( d  d
 l) m* Z* m+ Z+ d  d l, m- Z- m. Z. m/ Z/ m0 Z0 m1 Z1 m2 Z2 m3 Z3 m4 Z4 m5 Z5 m6 Z6 m7 Z7 m8 Z8 m9 Z9 m: Z: m; Z; m< Z< m= Z= m> Z> d  d l? m@ Z@ mA ZA mB ZB d  d lC mD ZD d  d lE mF ZF mG ZG d  d lH ZI d  d lJ mK ZK mL ZL mM ZM d  d lN jO jP ZQ d  d lR mS ZS mT ZT d  d lU jO jV ZW d  d lX mY ZY mZ ZZ m[ Z[ m\ Z\ m] Z] d  d l^ m_ Z_ d  d l` ma Za mb Zb d  d lc jO jd Zd d  d le mf Zf d  d lg mh Zh d  d li mj Zj mk Zk d  d ll mm Zm d  d ln mo Zo ep   Zq ep d d d d d d d d  d! d"  Zr es   Zt d#   Zu d eS eT f d$     YZv d%   Zw d& Zx d' Zy d( Zz d) Z{ d* Z| d+ Z} d, Z~ d- Z d. Z d/ Z d0 Z d1 Z d2 Z d3 Z d4 eq d5 <eq d5 j d6 d7 d8 d9 d: d; d< d= d> d?  Z e d@ 7Z eq d5 j d6 dA d8 dB d: d? d< dC d> d?  Z eq d5 j d6 dD d8 dE d: dF d< dG d> dF  Z dH Z dI Z dJ Z dK dK dL  Z dK dK dM  Z dN   Z dO   Z dP   Z x* ed j   D] \ Z Z ev j e e  qWd S(Q   iN(   t	   timedelta(   t   dedent(   t	   Timestampt   iNaTt
   properties(	   t   cPicklet   isidentifiert   lranget   lzipt   mapt   set_function_namet   string_typest   to_strt   zip(   t   function(   t   AbstractMethodError(   t   Appendert   Substitutiont   rewrite_axis_style_signature(   t   validate_bool_kwargt   validate_fillna_kwargs(   t   maybe_promotet   maybe_upcast_putmask(   t   ensure_int64t   ensure_objectt   is_boolt   is_bool_dtypet   is_datetime64_any_dtypet   is_datetime64tz_dtypet   is_dict_liket   is_extension_array_dtypet
   is_integert   is_list_liket	   is_numbert   is_numeric_dtypet   is_object_dtypet   is_period_arrayliket   is_re_compilablet	   is_scalart   is_timedelta64_dtypet   pandas_dtype(   t   ABCDataFramet   ABCPanelt	   ABCSeries(   t   is_hashable(   t   isnat   notna(   t   configt   missingt   nanops(   t   PandasObjectt   SelectionMixin(   t   Indext   InvalidIndexErrort
   MultiIndext
   RangeIndext   ensure_index(   t   DatetimeIndex(   t   Periodt   PeriodIndex(   t   BlockManager(   t   _align_method_FRAME(   t   DataFrameFormattert   format_percentiles(   t   pprint_thing(   t	   to_offsett   axess   keywords for axest   klasst   NDFramet   axes_single_args   int or labels for objectt   args_transposes)   axes to permute (int or label for object)t   optional_bysM   
        by : str or list of str
            Name or list of names to sort byc   
      C   s   |  j  d k r6 t d j | | t |   j    n  |  j } | rK |  n	 |  j   } t j |  } t j	 | j
 |  } | | j
 d | d | }	 |	 j | k r | r d St j |	 d |  j d |  j j |   } | r |  j | j  d S| S(   s   
    Replaces values in a Series using the fill method specified when no
    replacement value is given in the replace method
    i   s+   cannot replace {0} with method {1} on a {2}t   limitt   maskNt   indext   dtype(   t   ndimt	   TypeErrort   formatt   typet   __name__RK   t   copyR0   t   get_fill_funct   mask_missingt   valuest   pdt   SeriesRJ   t   __finalize__t   _update_inplacet   _data(
   t   selft
   to_replacet   methodt   inplaceRH   t
   orig_dtypet   resultt   fill_fRI   RT   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _single_replaceE   s     		c           B   s  e  Z d  Z d d d d d d d d d	 d
 d d d g Z e e  Z e   Z e d d d d g  Z g  Z	 e
 Z e
 Z e
 e e
 e d  Z e
 e
 e d  Z e d    Z e j d    Z d   Z e d    Z e d    Z e d    Z e e
 e
 e
 e
 e e e
 e
 d   Z e
 d  Z e d    Z e
 d  Z e e
 d  Z e d    Z e d     Z  e d!    Z! d"   Z" e d#    Z# d$   Z$ d%   Z% e d&    Z& e d'    Z' e d(    Z( e d)    Z) e d*    Z* e d+    Z+ e d,    Z, e d-    Z- d.   Z. d/ e
 d0  Z/ d1   Z0 d2   Z1 e d3  Z2 d/ d4  Z3 d5   Z4 e
 d6  Z5 d7 d8 d/ d9  Z6 d:   Z7 e8 d; d< e f d= e f g  e9 d>   Z: d/ e d?  Z; d@   Z< dA   Z= dB   Z> dC   Z? dD   Z@ dE   ZA eA ZB dF   ZC dG   ZD d/ dH  ZE d/ dI  ZF d/ dJ  ZG d/ dK  ZH d/ dL  ZI d/ dM  ZJ d/ dN  ZK dO   ZL dP   ZM dQ   ZN dR   ZO dS   ZP dT   ZQ e dU    ZR dV ZS e
 dW  ZT e
 dX  ZU dY   ZV dZ   ZW d[   ZX d\   ZY d]   ZZ d^   Z[ d_ e\ d` <e] e\ d` e^ da db   dc dd e
 e
 e e e
 d/ d/ e
 e e
 de e e
 df   Z_ e
 e
 e
 dg e dh e
 e di e dj 
 Z` dk   Za e
 dl dm  Zb e
 dn e e
 e
 e
 e
 do  Zc di ed je dp  Zf e e
 dq  Zg dr   Zh e
 e
 e
 e e ds e
 e
 e
 e e e
 e
 e
 e
 dt e
 e
 e
 du  Zi e
 dv dd e
 e
 e e e
 dw e
 di e
 dx e
 e
 e
 e
 e e
 dt dy  Zj e dz    Zk e
 d{  Zl d|   Zm d}   Zn d~   Zo d   Zp d   Zq d   Zr d   Zs e d    Zt d   Zu e d    Zv e e d  Zw e
 d  Zx d/ e
 d  Zy d   Zz e
 e d  Z{ d   Z| d d e d  Z} d   Z~ d/ e d  Z d/ e
 e d  Z d/ e
 e d  Z e Z d/ d  Z e
 e e
 e
 d  Z e
 d/ e
 e
 e
 e d d  Z e
 d d  Z e d  Z d   Z d   Z e
 d/ e e d d d  Z d/ e
 e e d d e d  Z d   Z d   Z d   Z d   Z d e\ d <e] e\ d e  d/ e
 e
 e e
 e
 d   Z e
 e e d  Z e
 e
 e
 e
 d  Z d d  Z d d  Z e
 e
 e e
 e
 e
 d  Z d e\ d <e] e\ d e  d    Z e d  e\ d <d e\ d <e
 d  Z d   Z d   Z d   Z d   Z d   Z e d  Z e d    Z e d    Z e d    Z d   Z d   Z d   Z e
 d  Z e d    Z e d    Z e d    Z d   Z d   Z d   Z e d    Z e d    Z e d  Z e d    Z e d  Z e d d  Z e d  Z e d  Z e
 d  Z e e e e e d  Z e e e e d  Z d   Z e
 e
 e
 e e
 e
 d  Z e
 e e
 e
 d  Z e
 e e
 e
 d  Z d e\ d <e] e\ d e  e
 e
 e e
 e d d   Z d e\ d <e] e\ d e  d d/ e
 e d e
 e
 d   Z e
 d  Z d e\ d <e] e\ d e  d    Z e] e\ d e  d    Z d e\ d <e] e\ d e  d    Z e] e\ d e  d    Z e d  Z d   Z e
 e
 e
 e d  Z e
 e d  Z e
 e d  Z e
 d/ e
 e e e e e d  Z e
 e
 e e
 d  Z e e
 d  Z e e e
 d  Z e
 d/ e
 e
 e
 d e
 e
 e
 d/ e
 e
 d  Z d   Z d   Z d/ d e
 d e e d  Z d e\ d <e] e\ d e  d e
 e
 e e
 e
 e
 d/ e
 d 	  Z d e
 e
 e e
 e
 e
 d/ d  Z d e
 e
 e e
 e
 e
 d/ d  Z e j e e
 e
 d e d  Z d e\ d <e] e\ d e^ e dddddd dd e j e e
 e
 d e e
 d  Z e] e\ d e^ e dddddddd  e j e e
 e
 d e e
 d	  Z d
e\ d<e] e\ de  de
 d/ e
 d  Z dd/ d Z de
 d/ d Z e
 e
 e
 e d Z d/ e
 e d Z d/ e
 e d d d Z d  Z e
 e
 e
 d Z d  Z de\ d<e] e\ de  dd e
 e
 d  Z d/ d/ e d Z e d   Z e d   Z e d   Z e] e\ d e^ ddd e   d   Z de\ d <d!  Z e] e\ d i d"d#6d$da 6 d%   Z e] e\ d i d d#6d$da 6 d&   Z RS('  s   
    N-dimensional analogue of DataFrame. Store multi-dimensional in a
    size-mutable, labeled data structure

    Parameters
    ----------
    data : BlockManager
    axes : list
    copy : boolean, default False
    RY   t   _cachert   _item_cachet   _cachet   _is_copyt   _subtypt   _namet   _indext   _default_kindt   _default_fill_valuet	   _metadatat   __array_struct__t   __array_interface__t	   as_blockst   blockst   convert_objectst   is_copyc         C   s   | s} | d  k	 r$ | j |  } n | r9 | j   } n  | d  k	 r} x2 t |  D]! \ } } | j | d | } qR Wq} n  t j |  d d   t j |  d |  t j |  d i   d  S(   Nt   axisRe   RY   Rc   (   t   Nonet   astypeRQ   t	   enumeratet   reindex_axist   objectt   __setattr__(   RZ   t   dataRB   RQ   RK   t   fastpatht   it   ax(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __init__   s    c         C   s   xM | j    D]? \ } } | d k	 r | j | d |  j |  d t } q q W| re | j   } n  | d k	 r t | j  d k s | j d j j	 | k r | j
 d |  } q n  | S(   s"    passed a manager and a axes dict Rr   RQ   i   i    RK   N(   t   itemsRs   Rv   t   _get_block_manager_axist   FalseRQ   t   lenRo   RT   RK   Rt   (   RZ   t   mgrRB   RK   RQ   t   at   axe(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt	   _init_mgr   s    .c         C   s   t  j d t d d |  j S(   s"   
        Return the copy.
        sJ   Attribute 'is_copy' is deprecated and will be removed in a future version.t
   stackleveli   (   t   warningst   warnt   FutureWarningRe   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRq      s    	c         C   s#   t  j d t d d | |  _ d  S(   NsJ   Attribute 'is_copy' is deprecated and will be removed in a future version.R   i   (   R   R   R   Re   (   RZ   t   msg(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRq      s    	c         C   sL   | d k	 rH t |  } | j d k rH t d j |  j j    qH n  | S(   s    validate the passed dtype t   Vs:   compound dtypes are not implemented in the {0} constructorN(   Rs   R(   t   kindt   NotImplementedErrorRN   t	   __class__RP   (   RZ   RK   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _validate_dtype   s    	c         C   s   t  |    d S(   sY   Used when a manipulation result has the same dimensions as the
        original.
        N(   R   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _constructor   s    c         C   s   t  |    d S(   s   Used when a manipulation result has one lower dimension(s) as the
        original, such as DataFrame single columns slicing.
        N(   R   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _constructor_sliced   s    c         C   s
   t   d S(   s   Used when a manipulation result has one higher dimension as the
        original, such as Series.to_frame() and DataFrame.to_panel()
        N(   R   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _constructor_expanddim   s    c
            s  |   _  d   t |  D   _ t |    _ | p= t     _ d     j j   D   _ t t |     _	 | p} d   _ |   _ t   d   j j    d   _ | d k	 r |   _ | |   _ n  | d k	 r |   _ | |   _ n  | r   f d   }
 | rW  j d } x^   j	 j   D] \ } } |
 | | |  q3Wqx-   j	 j   D] \ } } |
 | |  qgWn  t | t  st  d S(   s5  Provide axes setup for the major PandasObjects.

        Parameters
        ----------
        axes : the names of the axes in order (lowest to highest)
        info_axis_num : the axis of the selector dimension (int)
        stat_axis_num : the number of axis for the default stats (int)
        aliases : other names for a single axis (dict)
        slicers : how axes slice to others (dict)
        axes_are_reversed : boolean whether to treat passed axes as
            reversed (DataFrame)
        build_axes : setup the axis properties (default True)
        c         S   s   i  |  ] \ } } | |  q S(    (    (   t   .0R{   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>   s   	 c         S   s   i  |  ] \ } } | |  q S(    (    (   R   t   kt   v(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>   s   	 t   _typc            s<   t    |  t j |  j |  |       j j |   d  S(   N(   t   setattrR   t   AxisPropertyt   gett   _internal_names_sett   add(   R   R{   (   t   clst   docs(    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   set_axis  s    (i   N(   t   _AXIS_ORDERSRu   t   _AXIS_NUMBERSR   t	   _AXIS_LENt   dictt   _AXIS_ALIASESR~   t   _AXIS_IALIASESt   _AXIS_NAMESRs   t   _AXIS_SLICEMAPt   _AXIS_REVERSEDR   RP   t   lowert   _ixt   _info_axis_numbert   _info_axis_namet   _stat_axis_numbert   _stat_axis_namet
   isinstancet   AssertionError(   R   RB   t	   info_axist	   stat_axist   aliasest   slicerst   axes_are_reversedt
   build_axest   nsR   R   t   mR{   R   (    (   R   R   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _setup_axes   s2    					c            s0     f d   | p   j  D } | j |  | S(   s%   Return an axes dictionary for myself.c            s"   i  |  ] }   j  |  |  q S(    (   t	   _get_axis(   R   R   (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>  s   	 (   R   t   update(   RZ   RB   t   kwargst   d(    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _construct_axes_dict  s    c         K   s-   d   t  |  j |  D } | j |  | S(   s.   Return an axes dictionary for the passed axes.c         S   s   i  |  ] \ } } | |  q S(    (    (   R   R   R|   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>  s   	 (   R   R   R   (   RZ   RB   R   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _construct_axes_dict_from  s    c            s0     f d   | p   j  D } | j |  | S(   s%   Return an axes dictionary for myself.c            s)   i  |  ] }   j  |    j |  q S(    (   R   R   (   R   R   (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>$  s   	(   R   R   (   RZ   RB   R   R   (    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _construct_axes_dict_for_slice"  s    c            s  t  |  } x |  j D] } |  j j |  } | d k	 r |   k rq |   k r t d | | f   q q n  |   k r   j |    | <q q n  |   k r y | j d    | <Wq t k
 r | r t d   q q Xq q W   f d   |  j D } |   f S(   su  Construct and returns axes if supplied in args/kwargs.

        If require_all, raise if all axis arguments are not supplied
        return a tuple of (axes, kwargs).

        sentinel specifies the default parameter when an axis is not
        supplied; useful to distinguish when a user explicitly passes None
        in scenarios where None has special meaning.
        s,   arguments are mutually exclusive for [%s,%s]i    s)   not enough/duplicate arguments specified!c            s%   i  |  ] }   j  |   |  q S(    (   t   pop(   R   R   (   R   t   sentinel(    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>N  s   	 N(   t   listR   R   R   Rs   RM   R   t
   IndexError(   RZ   t   argsR   t   require_allR   R   t   aliasRB   (    (   R   R   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _construct_axes_from_arguments)  s(    	c         K   sq   t  | t  r |  | |  S|  j r; | d  d  d  } n  |  j |  | d t } | j |  |  | |  Sd  S(   NiRQ   (   R   R<   R   R   R   R   (   R   Ry   RB   R   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   _from_axesQ  s    	c         C   s|   |  j  j | |  } t |  r7 | |  j k rZ | Sn# y |  j | SWn t k
 rY n Xt d j | t |      d  S(   Ns%   No axis named {0} for object type {1}(	   R   R   R   R   R   t   KeyErrort
   ValueErrorRN   RO   (   R   Rr   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _get_axis_number]  s    	c         C   s   |  j  j | |  } t | t  r: | |  j k r] | Sn# y |  j | SWn t k
 r\ n Xt d j | t	 |      d  S(   Ns%   No axis named {0} for object type {1}(
   R   R   R   R   R   R   R   R   RN   RO   (   R   Rr   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _get_axis_namek  s    	c         C   s   |  j  |  } t |  |  S(   N(   R   t   getattr(   RZ   Rr   t   name(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR   y  s    c         C   s1   |  j  |  } |  j r- |  j d } | | S| S(   s'   Map the axis to the block_manager axis.i   (   R   R   R   (   R   Rr   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR   }  s
    	c         C   s   t  |  |  } t   } | d } x t | j  D]q \ } } | d  k	 rW | } } n d j d | d |  } | } | j |  }	 |	 j   }
 | |
 _ |
 | | <q2 Wt	 | t
  r | } n | j   } | | | <| S(   Ni    s   {prefix}level_{i}t   prefixR{   (   R   R   Ru   t   namesRs   RN   t   get_level_valuest	   to_seriesRJ   R   R6   (   RZ   Rr   t
   axis_indexR   R   R{   R   t   keyt   levelt   level_valuest   st   dindex(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _get_axis_resolvers  s"    	
		
c         C   s4   i  } x' |  j  D] } | j |  j |   q W| S(   N(   R   R   R   (   RZ   R   t	   axis_name(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _get_index_resolvers  s    c         C   s   t  |  |  j  S(   N(   R   R   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   _info_axis  s    c         C   s   t  |  |  j  S(   N(   R   R   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   _stat_axis  s    c            s   t    f d     j D  S(   s3   
        Return a tuple of axis dimensions
        c         3   s$   |  ] } t    j |   Vq d  S(   N(   R   R   (   R   R   (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>  s    (   t   tupleR   (   RZ   (    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   shape  s    c         C   s#   g  |  j  D] } |  j |  ^ q
 S(   s?   
        Return index label(s) of the internal NDFrame
        (   R   R   (   RZ   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRB     s    c         C   s
   |  j  j S(   s  
        Return an int representing the number of axes / array dimensions.

        Return 1 if Series. Otherwise return 2 if DataFrame.

        See Also
        --------
        ndarray.ndim : Number of array dimensions.

        Examples
        --------
        >>> s = pd.Series({'a': 1, 'b': 2, 'c': 3})
        >>> s.ndim
        1

        >>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
        >>> df.ndim
        2
        (   RY   RL   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRL     s    c         C   s   t  j |  j  S(   s  
        Return an int representing the number of elements in this object.

        Return the number of rows if Series. Otherwise return the number of
        rows times number of columns if DataFrame.

        See Also
        --------
        ndarray.size : Number of elements in the array.

        Examples
        --------
        >>> s = pd.Series({'a': 1, 'b': 2, 'c': 3})
        >>> s.size
        3

        >>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
        >>> df.size
        4
        (   t   npt   prodR   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   size  s    c         C   s   |  S(   s%    internal compat with SelectionMixin (    (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _selected_obj  s    c         C   s   |  S(   s%    internal compat with SelectionMixin (    (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _obj_with_exclusions  s    c         C   s   g  } x t  | |  j  D]q \ } } | | k r} t |  | j j k r[ | j d  } n  | j | j t |  |   q | j |  q W| S(   Nt   O(   R   RB   RO   RK   Rt   t   appendt   insertR   (   RZ   R   t   new_axesR   R|   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _expand_axes  s    "i    c         C   s   t  |  r2 t j d t d d | | } } n  | d k r] t j d t d d t } n  | r t |  |  j |  |  n) |  j   } | j	 | d | d t | Sd S(   s!	  
        Assign desired index to given axis.

        Indexes for column or row labels can be changed by assigning
        a list-like or Index.

        .. versionchanged:: 0.21.0

           The signature is now `labels` and `axis`, consistent with
           the rest of pandas API. Previously, the `axis` and `labels`
           arguments were respectively the first and second positional
           arguments.

        Parameters
        ----------
        labels : list-like, Index
            The values for the new index.

        axis : {0 or 'index', 1 or 'columns'}, default 0
            The axis to update. The value 0 identifies the rows, and 1
            identifies the columns.

        inplace : boolean, default None
            Whether to return a new %(klass)s instance.

            .. warning::

               ``inplace=None`` currently falls back to to True, but in a
               future version, will default to False. Use inplace=True
               explicitly rather than relying on the default.

        Returns
        -------
        renamed : %(klass)s or None
            An object of same type as caller if inplace=False, None otherwise.

        See Also
        --------
        DataFrame.rename_axis : Alter the name of the index or columns.

        Examples
        --------
        **Series**

        >>> s = pd.Series([1, 2, 3])
        >>> s
        0    1
        1    2
        2    3
        dtype: int64

        >>> s.set_axis(['a', 'b', 'c'], axis=0, inplace=False)
        a    1
        b    2
        c    3
        dtype: int64

        The original object is not modified.

        >>> s
        0    1
        1    2
        2    3
        dtype: int64

        **DataFrame**

        >>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})

        Change the row labels.

        >>> df.set_axis(['a', 'b', 'c'], axis='index', inplace=False)
           A  B
        a  1  4
        b  2  5
        c  3  6

        Change the column labels.

        >>> df.set_axis(['I', 'II'], axis='columns', inplace=False)
           I  II
        0  1   4
        1  2   5
        2  3   6

        Now, update the labels inplace.

        >>> df.set_axis(['i', 'ii'], axis='columns', inplace=True)
        >>> df
           i  ii
        0  1   4
        1  2   5
        2  3   6
        s   set_axis now takes "labels" as first argument, and "axis" as named parameter. The old form, with "axis" as first parameter and "labels" as second, is still supported but will be deprecated in a future version of pandas.R   i   s   set_axis currently defaults to operating inplace.
This will change in a future version of pandas, use inplace=True to avoid this warning.Rr   R]   N(
   R&   R   R   R   Rs   t   TrueR   R   RQ   R   (   RZ   t   labelsRr   R]   t   obj(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR     s    _	c         C   s!   |  j  j | |  |  j   d  S(   N(   RY   R   t   _clear_item_cache(   RZ   Rr   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt	   _set_axis}  s    c            s6   j  | | d t \   } t    f d    j D  } t    f d    j D  } t    t t     k r t d  j   n   j  g  | D] }  j	 |  ^ q  }  j
 j |  } | j d d  s t |  r| d r| j   } n  t j  |   j | |  j   S(   s  
        Permute the dimensions of the %(klass)s

        Parameters
        ----------
        args : %(args_transpose)s
        copy : boolean, default False
            Make a copy of the underlying data. Mixed-dtype data will
            always result in a copy

        Returns
        -------
        y : same as input

        Examples
        --------
        >>> p.transpose(2, 0, 1)
        >>> p.transpose(2, 0, 1, copy=True)
        R   c         3   s"   |  ] }  j    |  Vq d  S(   N(   R   (   R   R   (   RB   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>  s   c         3   s"   |  ] }  j    |  Vq d  S(   N(   R   (   R   R   (   RB   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>  s   s   Must specify %s unique axesRQ   iN(   R   R   R   R   R   t   setR   R   R   R   RT   t	   transposeR   Rs   RQ   t   nvt   validate_transpose_for_genericR   RW   (   RZ   R   R   t
   axes_namest   axes_numberst   xR   t
   new_values(    (   RB   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR     s    "(c            s    j  |  }  j  |  } | | k r> | r:  j   S Si | | 6| | 6     f d   t  j  D }  j j | |  } | r | j   } n   j | |  j   S(   s   
        Interchange axes and swap values axes appropriately.

        Returns
        -------
        y : same as input
        c         3   s*   |  ]  }  j    j | |   Vq d  S(   N(   R   R   (   R   R   (   t   mappingRZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>  s   (   R   RQ   t   rangeR   RT   t   swapaxesR   RW   (   RZ   t   axis1t   axis2RQ   R{   t   jR   R   (    (   R   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR     s    
c         C   s=   |  j  |  } | j |  } |  j | d | d t } | S(   s  
        Return DataFrame with requested index / column level(s) removed.

        .. versionadded:: 0.24.0

        Parameters
        ----------
        level : int, str, or list-like
            If a string is given, must be the name of a level
            If list-like, elements must be names or positional indexes
            of levels.

        axis : {0 or 'index', 1 or 'columns'}, default 0

        Returns
        -------
        DataFrame.droplevel()

        Examples
        --------
        >>> df = pd.DataFrame([
        ...     [1, 2, 3, 4],
        ...     [5, 6, 7, 8],
        ...     [9, 10, 11, 12]
        ... ]).set_index([0, 1]).rename_axis(['a', 'b'])

        >>> df.columns = pd.MultiIndex.from_tuples([
        ...    ('c', 'e'), ('d', 'f')
        ... ], names=['level_1', 'level_2'])

        >>> df
        level_1   c   d
        level_2   e   f
        a b
        1 2      3   4
        5 6      7   8
        9 10    11  12

        >>> df.droplevel('a')
        level_1   c   d
        level_2   e   f
        b
        2        3   4
        6        7   8
        10      11  12

        >>> df.droplevel('level2', axis=1)
        level_1   c   d
        a b
        1 2      3   4
        5 6      7   8
        9 10    11  12
        Rr   R]   (   R   t	   droplevelR   R   (   RZ   R   Rr   R   t
   new_labelsR_   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR     s    6c         C   s7   |  | } |  | =y | j    Wn t k
 r2 n X| S(   s?  
        Return item and drop from frame. Raise KeyError if not found.

        Parameters
        ----------
        item : str
            Column label to be popped

        Returns
        -------
        popped : Series

        Examples
        --------
        >>> df = pd.DataFrame([('falcon', 'bird',    389.0),
        ...                    ('parrot', 'bird',     24.0),
        ...                    ('lion',   'mammal',   80.5),
        ...                    ('monkey', 'mammal', np.nan)],
        ...                   columns=('name', 'class', 'max_speed'))
        >>> df
             name   class  max_speed
        0  falcon    bird      389.0
        1  parrot    bird       24.0
        2    lion  mammal       80.5
        3  monkey  mammal        NaN

        >>> df.pop('class')
        0      bird
        1      bird
        2    mammal
        3    mammal
        Name: class, dtype: object

        >>> df
             name  max_speed
        0  falcon      389.0
        1  parrot       24.0
        2    lion       80.5
        3  monkey        NaN
        (   t   _reset_cachert   AttributeError(   RZ   t   itemR_   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR      s    )
c            sn     d k r |  j n |  j    f   y. |  j t   f d   t |  j  D  SWn t k
 ri |  SXd S(   s
  
        Squeeze 1 dimensional axis objects into scalars.

        Series or DataFrames with a single element are squeezed to a scalar.
        DataFrames with a single column or a single row are squeezed to a
        Series. Otherwise the object is unchanged.

        This method is most useful when you don't know if your
        object is a Series or DataFrame, but you do know it has just a single
        column. In that case you can safely call `squeeze` to ensure you have a
        Series.

        Parameters
        ----------
        axis : {0 or 'index', 1 or 'columns', None}, default None
            A specific axis to squeeze. By default, all length-1 axes are
            squeezed.

            .. versionadded:: 0.20.0

        Returns
        -------
        DataFrame, Series, or scalar
            The projection after squeezing `axis` or all the axes.

        See Also
        --------
        Series.iloc : Integer-location based indexing for selecting scalars.
        DataFrame.iloc : Integer-location based indexing for selecting Series.
        Series.to_frame : Inverse of DataFrame.squeeze for a
            single-column DataFrame.

        Examples
        --------
        >>> primes = pd.Series([2, 3, 5, 7])

        Slicing might produce a Series with a single value:

        >>> even_primes = primes[primes % 2 == 0]
        >>> even_primes
        0    2
        dtype: int64

        >>> even_primes.squeeze()
        2

        Squeezing objects with more than one value in every axis does nothing:

        >>> odd_primes = primes[primes % 2 == 1]
        >>> odd_primes
        1    3
        2    5
        3    7
        dtype: int64

        >>> odd_primes.squeeze()
        1    3
        2    5
        3    7
        dtype: int64

        Squeezing is even more effective when used with DataFrames.

        >>> df = pd.DataFrame([[1, 2], [3, 4]], columns=['a', 'b'])
        >>> df
           a  b
        0  1  2
        1  3  4

        Slicing a single column will produce a DataFrame with the columns
        having only one value:

        >>> df_a = df[['a']]
        >>> df_a
           a
        0  1
        1  3

        So the columns can be squeezed down, resulting in a Series:

        >>> df_a.squeeze('columns')
        0    1
        1    3
        Name: a, dtype: int64

        Slicing a single row from a single column will produce a single
        scalar DataFrame:

        >>> df_0a = df.loc[df.index < 1, ['a']]
        >>> df_0a
           a
        0  1

        Squeezing the rows produces a single scalar Series:

        >>> df_0a.squeeze('rows')
        a    1
        Name: 0, dtype: int64

        Squeezing all axes wil project directly into a scalar:

        >>> df_0a.squeeze()
        1
        c         3   sE   |  ]; \ } } |   k r3 t  |  d  k r3 d n	 t d  Vq d S(   i   i    N(   R   t   sliceRs   (   R   R{   R   (   Rr   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>  s   N(   Rs   R   R   t   ilocR   Ru   RB   t	   Exception(   RZ   Rr   (    (   Rr   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   squeeze2  s    iiic         C   sN   |  j  |  } |  j   } | j j | } | j j | | j | |   | S(   s  
        Swap levels i and j in a MultiIndex on a particular axis

        Parameters
        ----------
        i, j : int, string (can be mixed)
            Level of index to be swapped. Can pass level name as string.

        Returns
        -------
        swapped : same type as caller (new object)

        .. versionchanged:: 0.18.1

           The indexes ``i`` and ``j`` are now optional, and default to
           the two innermost levels of the index.

        (   R   RQ   RY   RB   R   t	   swaplevel(   RZ   R{   R   Rr   R_   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s
    c      	   O   s  |  j  | |  \ } } | j d t  } | j d t  } | j d d	  } | j d d	  } | d	 k	 r| |  j |  n  | r t d j t | j	    d    n  t
 j | j     d k r t d   n  |  j   | r |  n |  j d |  } x t |  j  D] } | j |  j |  }	 |	 d	 k r:qn  t
 j |	  }
 |  j |  } | d	 k	 r}|  j | j |  } n  | j j |
 d | d | d | | _ | j   qW| r|  j | j  n | j |   Sd	 S(
   s  
        Alter axes input function or functions. Function / dict values must be
        unique (1-to-1). Labels not contained in a dict / Series will be left
        as-is. Extra labels listed don't throw an error. Alternatively, change
        ``Series.name`` with a scalar value (Series only).

        Parameters
        ----------
        %(axes)s : scalar, list-like, dict-like or function, optional
            Scalar or list-like will alter the ``Series.name`` attribute,
            and raise on DataFrame or Panel.
            dict-like or functions are transformations to apply to
            that axis' values
        copy : boolean, default True
            Also copy underlying data
        inplace : boolean, default False
            Whether to return a new %(klass)s. If True then value of copy is
            ignored.
        level : int or level name, default None
            In case of a MultiIndex, only rename labels in the specified
            level.

        Returns
        -------
        renamed : %(klass)s (new object)

        See Also
        --------
        pandas.NDFrame.rename_axis

        Examples
        --------

        >>> s = pd.Series([1, 2, 3])
        >>> s
        0    1
        1    2
        2    3
        dtype: int64
        >>> s.rename("my_name") # scalar, changes Series.name
        0    1
        1    2
        2    3
        Name: my_name, dtype: int64
        >>> s.rename(lambda x: x ** 2)  # function, changes labels
        0    1
        1    2
        4    3
        dtype: int64
        >>> s.rename({1: 3, 2: 5})  # mapping, changes labels
        0    1
        3    2
        5    3
        dtype: int64

        Since ``DataFrame`` doesn't have a ``.name`` attribute,
        only mapping-type arguments are allowed.

        >>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]})
        >>> df.rename(2)
        Traceback (most recent call last):
        ...
        TypeError: 'int' object is not callable

        ``DataFrame.rename`` supports two calling conventions

        * ``(index=index_mapper, columns=columns_mapper, ...)``
        * ``(mapper, axis={'index', 'columns'}, ...)``

        We *highly* recommend using keyword arguments to clarify your
        intent.

        >>> df.rename(index=str, columns={"A": "a", "B": "c"})
           a  c
        0  1  4
        1  2  5
        2  3  6

        >>> df.rename(index=str, columns={"A": "a", "C": "c"})
           a  B
        0  1  4
        1  2  5
        2  3  6

        Using axis-style parameters

        >>> df.rename(str.lower, axis='columns')
           a  b
        0  1  4
        1  2  5
        2  3  6

        >>> df.rename({1: 2, 2: 4}, axis='index')
           A  B
        0  1  4
        2  2  5
        4  3  6

        See the :ref:`user guide <basics.rename>` for more.
        RQ   R]   R   Rr   s1   rename() got an unexpected keyword argument "{0}"i    s   must pass an index to renamet   deepN(   R   R   R   R   Rs   R   RM   RN   R   t   keyst   comt   count_not_noneRT   t   _consolidate_inplaceRQ   R   R   R   R   t   _get_rename_functionR   RB   t   _get_level_numberRY   t   rename_axisR   RX   RW   (   RZ   R   R   RB   RQ   R]   R   Rr   R_   R   t   ft   baxis(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   rename  s8    e	
t   mapperRQ   R]   c         K   sS  |  j  d | d t \ } } | j d t  } | j d t  } | j d d  } | d k	 rr |  j |  } n  | r t d j t	 | j
    d    n  t | d  } | t k	 rXt |  p t |  o t |  } | r |  j | d | d | Sd } t j | t d d	 |  j |  } i | d 6| d 6}	 | |	 | <|  j |	   Sn | rd|  n |  j d
 |  }
 x t |  j  D] } | j |  j |  } | t k rqn  t |  pt |  ot |  } | r| } n@ t j |  } |  j |  j } g  | D] } | |  ^ q} |
 j | d | d t qW| sO|
 Sd S(   s  
        Set the name of the axis for the index or columns.

        Parameters
        ----------
        mapper : scalar, list-like, optional
            Value to set the axis name attribute.
        index, columns : scalar, list-like, dict-like or function, optional
            A scalar, list-like, dict-like or functions transformations to
            apply to that axis' values.

            Use either ``mapper`` and ``axis`` to
            specify the axis to target with ``mapper``, or ``index``
            and/or ``columns``.

            .. versionchanged:: 0.24.0

        axis : {0 or 'index', 1 or 'columns'}, default 0
            The axis to rename.
        copy : bool, default True
            Also copy underlying data.
        inplace : bool, default False
            Modifies the object directly, instead of creating a new Series
            or DataFrame.

        Returns
        -------
        Series, DataFrame, or None
            The same type as the caller or None if `inplace` is True.

        See Also
        --------
        Series.rename : Alter Series index labels or name.
        DataFrame.rename : Alter DataFrame index labels or name.
        Index.rename : Set new names on index.

        Notes
        -----
        Prior to version 0.21.0, ``rename_axis`` could also be used to change
        the axis *labels* by passing a mapping or scalar. This behavior is
        deprecated and will be removed in a future version. Use ``rename``
        instead.

        ``DataFrame.rename_axis`` supports two calling conventions

        * ``(index=index_mapper, columns=columns_mapper, ...)``
        * ``(mapper, axis={'index', 'columns'}, ...)``

        The first calling convention will only modify the names of
        the index and/or the names of the Index object that is the columns.
        In this case, the parameter ``copy`` is ignored.

        The second calling convention will modify the names of the
        the corresponding index if mapper is a list or a scalar.
        However, if mapper is dict-like or a function, it will use the
        deprecated behavior of modifying the axis *labels*.

        We *highly* recommend using keyword arguments to clarify your
        intent.

        Examples
        --------
        **Series**

        >>> s = pd.Series(["dog", "cat", "monkey"])
        >>> s
        0       dog
        1       cat
        2    monkey
        dtype: object
        >>> s.rename_axis("animal")
        animal
        0    dog
        1    cat
        2    monkey
        dtype: object

        **DataFrame**

        >>> df = pd.DataFrame({"num_legs": [4, 4, 2],
        ...                    "num_arms": [0, 0, 2]},
        ...                   ["dog", "cat", "monkey"])
        >>> df
                num_legs  num_arms
        dog            4         0
        cat            4         0
        monkey         2         2
        >>> df = df.rename_axis("animal")
        >>> df
                num_legs  num_arms
        animal
        dog            4         0
        cat            4         0
        monkey         2         2
        >>> df = df.rename_axis("limbs", axis="columns")
        >>> df
        limbs   num_legs  num_arms
        animal
        dog            4         0
        cat            4         0
        monkey         2         2

        **MultiIndex**

        >>> df.index = pd.MultiIndex.from_product([['mammal'],
        ...                                        ['dog', 'cat', 'monkey']],
        ...                                       names=['type', 'name'])
        >>> df
        limbs          num_legs  num_arms
        type   name
        mammal dog            4         0
               cat            4         0
               monkey         2         2

        >>> df.rename_axis(index={'type': 'class'})
        limbs          num_legs  num_arms
        class  name
        mammal dog            4         0
               cat            4         0
               monkey         2         2

        >>> df.rename_axis(columns=str.upper)
        LIMBS          num_legs  num_arms
        type   name
        mammal dog            4         0
               cat            4         0
               monkey         2         2
        R   RQ   R]   Rr   i    s6   rename_axis() got an unexpected keyword argument "{0}"sH   Using 'rename_axis' to alter labels is deprecated. Use '.rename' insteadR   i   R  N(    (   R   R   R   R   R   Rs   R   RM   RN   R   R  R   R&   R    R   t   _set_axis_nameR   R   R   R   R  RQ   R   R   R   R   R	  R  R   R   (   RZ   R  R   RB   RQ   R]   Rr   t
   non_mapperR   R   R_   R   t   newnamesR  t   curnamesR   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  K  sL    	
	c         C   su   |  j  |  } |  j |  j |  } t | d  } | rB |  n	 |  j   } | j | d | d t | sq | Sd S(   sV  
        Set the name(s) of the axis.

        Parameters
        ----------
        name : str or list of str
            Name(s) to set.
        axis : {0 or 'index', 1 or 'columns'}, default 0
            The axis to set the label. The value 0 or 'index' specifies index,
            and the value 1 or 'columns' specifies columns.
        inplace : bool, default False
            If `True`, do operation inplace and return None.

            .. versionadded:: 0.21.0

        Returns
        -------
        Series, DataFrame, or None
            The same type as the caller or `None` if `inplace` is `True`.

        See Also
        --------
        DataFrame.rename : Alter the axis labels of :class:`DataFrame`.
        Series.rename : Alter the index labels or set the index name
            of :class:`Series`.
        Index.rename : Set the name of :class:`Index` or :class:`MultiIndex`.

        Examples
        --------
        >>> df = pd.DataFrame({"num_legs": [4, 4, 2]},
        ...                   ["dog", "cat", "monkey"])
        >>> df
                num_legs
        dog            4
        cat            4
        monkey         2
        >>> df._set_axis_name("animal")
                num_legs
        animal
        dog            4
        cat            4
        monkey         2
        >>> df.index = pd.MultiIndex.from_product(
        ...                [["mammal"], ['dog', 'cat', 'monkey']])
        >>> df._set_axis_name(["type", "name"])
                       legs
        type   name
        mammal dog        4
               cat        4
               monkey     2
        R]   Rr   N(   R   R   t	   set_namesR   RQ   R   R   (   RZ   R   Rr   R]   t   idxt   renamed(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    4c            s    t     f d    j D  S(   Nc         3   s0   |  ]& }  j  |  j   j  |   Vq d  S(   N(   R   t   equals(   R   R   (   t   otherRZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>C  s   (   t   allR   (   RZ   R  (    (   R  RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _indexed_sameB  s    c         C   s)   t  | |  j  s t S|  j j | j  S(   s  
        Test whether two objects contain the same elements.

        This function allows two Series or DataFrames to be compared against
        each other to see if they have the same shape and elements. NaNs in
        the same location are considered equal. The column headers do not
        need to have the same type, but the elements within the columns must
        be the same dtype.

        Parameters
        ----------
        other : Series or DataFrame
            The other Series or DataFrame to be compared with the first.

        Returns
        -------
        bool
            True if all elements are the same in both objects, False
            otherwise.

        See Also
        --------
        Series.eq : Compare two Series objects of the same length
            and return a Series where each element is True if the element
            in each Series is equal, False otherwise.
        DataFrame.eq : Compare two DataFrame objects of the same shape and
            return a DataFrame where each element is True if the respective
            element in each DataFrame is equal, False otherwise.
        assert_series_equal : Return True if left and right Series are equal,
            False otherwise.
        assert_frame_equal : Return True if left and right DataFrames are
            equal, False otherwise.
        numpy.array_equal : Return True if two arrays have the same shape
            and elements, False otherwise.

        Notes
        -----
        This function requires that the elements have the same dtype as their
        respective elements in the other Series or DataFrame. However, the
        column labels do not need to have the same type, as long as they are
        still considered equal.

        Examples
        --------
        >>> df = pd.DataFrame({1: [10], 2: [20]})
        >>> df
            1   2
        0  10  20

        DataFrames df and exactly_equal have the same types and values for
        their elements and column labels, which will return True.

        >>> exactly_equal = pd.DataFrame({1: [10], 2: [20]})
        >>> exactly_equal
            1   2
        0  10  20
        >>> df.equals(exactly_equal)
        True

        DataFrames df and different_column_type have the same element
        types and values, but have different types for the column labels,
        which will still return True.

        >>> different_column_type = pd.DataFrame({1.0: [10], 2.0: [20]})
        >>> different_column_type
           1.0  2.0
        0   10   20
        >>> df.equals(different_column_type)
        True

        DataFrames df and different_data_type have different types for the
        same values for their elements, and will return False even though
        their column labels are the same values and types.

        >>> different_data_type = pd.DataFrame({1: [10.0], 2: [20.0]})
        >>> different_data_type
              1     2
        0  10.0  20.0
        >>> df.equals(different_data_type)
        False
        (   R   R   R   RY   R  (   RZ   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  F  s    Rc         C   s   t  j |   } t |  r- t j |  } nN t |  sQ t |  sQ t |  rc t j |  } n t	 d j
 | j    |  j |  S(   Ns,   Unary negative expects numeric dtype, not {}(   R	  t   values_from_objectR   t   operatort   invR"   R'   R#   t   negRM   RN   RK   t   __array_wrap__(   RZ   RT   t   arr(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __neg__  s    	c         C   s   t  j |   } t |  s' t |  r0 | } nN t |  sT t |  sT t |  rf t j |  } n t	 d j
 | j    |  j |  S(   Ns(   Unary plus expects numeric dtype, not {}(   R	  R  R   R$   R"   R'   R#   R  t   posRM   RN   RK   R"  (   RZ   RT   R#  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __pos__  s    		c         C   sZ   y) t  j t j |    } |  j |  SWn* t k
 rU t j |  j  sO |  S  n Xd  S(   N(	   R  R   R	  R  R"  R  R   R   R   (   RZ   R#  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   __invert__  s    c         C   s   t  d j |  j j    d  S(   Ns[   The truth value of a {0} is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().(   R   RN   R   RP   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __nonzero__  s    	c         C   sf   |  j    } t | t t j f  r. t |  St |  rX t d j |  j j	    n  |  j
   d S(   s   
        Return the bool of a single element PandasObject.

        This must be a boolean scalar value, either True or False.  Raise a
        ValueError if the PandasObject does not have exactly 1 element, or that
        element is not boolean
        s3   bool cannot act on a non-boolean single element {0}N(   R  R   t   boolR   t   bool_R&   R   RN   R   RP   R(  (   RZ   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR)    s    
	c         C   s
   |  j    S(   N(   t   abs(   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __abs__  s    c         C   s   |  j  |  S(   N(   t   round(   RZ   t   decimals(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt	   __round__  s    c         C   s   |  j  |  } |  j d k r? t d j d t |      n  | d k	 o t |  o | |  j | j k o |  j	 | d | S(   sw  
        Test whether a key is a level reference for a given axis.

        To be considered a level reference, `key` must be a string that:
          - (axis=0): Matches the name of an index level and does NOT match
            a column label.
          - (axis=1): Matches the name of a column level and does NOT match
            an index label.

        Parameters
        ----------
        key : str
            Potential level name for the given axis
        axis : int, default 0
            Axis that levels are associated with (0 for index, 1 for columns)

        Returns
        -------
        is_level : bool
        i   s1   _is_level_reference is not implemented for {type}RO   Rr   N(
   R   RL   R   RN   RO   Rs   R,   RB   R   t   _is_label_reference(   RZ   R   Rr   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _is_level_reference  s    	c            s    j  |  } g  t  j  D] } | | k r | ^ q }  j d k rm t d j d t      n    d k	 o t    o t	    f d   | D  S(   s8  
        Test whether a key is a label reference for a given axis.

        To be considered a label reference, `key` must be a string that:
          - (axis=0): Matches a column label
          - (axis=1): Matches an index label

        Parameters
        ----------
        key: str
            Potential label name
        axis: int, default 0
            Axis perpendicular to the axis that labels are associated with
            (0 means search for column labels, 1 means search for index labels)

        Returns
        -------
        is_label: bool
        i   s1   _is_label_reference is not implemented for {type}RO   c         3   s"   |  ] }    j  | k Vq d  S(   N(   RB   (   R   R|   (   R   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>(  s    N(
   R   R   R   RL   R   RN   RO   Rs   R,   t   any(   RZ   R   Rr   R|   t
   other_axes(    (   R   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR0  
  s    .	c         C   sX   |  j  d k r0 t d j d t |      n  |  j | d | pW |  j | d | S(   sD  
        Test whether a key is a label or level reference for a given axis.

        To be considered either a label or a level reference, `key` must be a
        string that:
          - (axis=0): Matches a column label or an index level
          - (axis=1): Matches an index label or a column level

        Parameters
        ----------
        key: str
            Potential label or level name
        axis: int, default 0
            Axis that levels are associated with (0 for index, 1 for columns)

        Returns
        -------
        is_label_or_level: bool
        i   s:   _is_label_or_level_reference is not implemented for {type}RO   Rr   (   RL   R   RN   RO   R1  R0  (   RZ   R   Rr   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _is_label_or_level_reference*  s    	c   
         s3   j  |  } g  t  j  D] } | | k r | ^ q }  j d k rm t d j d t      n    d k	 r/t    r/   j	 | j
 k r/t    f d   | D  r/| d k r d n d \ } } | d k r d n d \ } } d
 j d   d | d | d | d |  }	 t |	   n  d S(   s  
        Check whether `key` is ambiguous.

        By ambiguous, we mean that it matches both a level of the input
        `axis` and a label of the other axis.

        Parameters
        ----------
        key: str or object
            label or level name
        axis: int, default 0
            Axis that levels are associated with (0 for index, 1 for columns)

        Raises
        ------
        ValueError: `key` is ambiguous
        i   s=   _check_label_or_level_ambiguity is not implemented for {type}RO   c         3   s"   |  ] }    j  | k Vq d  S(   N(   RB   (   R   R|   (   R   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>e  s    i    t   anRJ   R   t   columnsn   '{key}' is both {level_article} {level_type} level and {label_article} {label_type} label, which is ambiguous.R   t   level_articlet
   level_typet   label_articlet
   label_typeN(   R5  RJ   (   R   R6  (   R   R6  (   R5  RJ   (   R   R   R   RL   R   RN   RO   Rs   R,   RB   R   R2  R   (
   RZ   R   Rr   R|   R3  R7  R8  R9  R:  R   (    (   R   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _check_label_or_level_ambiguityG  s*    .			c         C   st  |  j  |  } g  t |  j  D] } | | k r | ^ q } |  j d k rm t d j d t |      n  |  j | d | r |  j | d | |  j	 | d | d j
 } n= |  j | d | r |  j | j |  j
 } n t |   | j d k rp| r+t |  j | d  t  r+d } n d } | d k rCd	 n d
 } t d j d | d | d |    n  | S(   s  
        Return a 1-D array of values associated with `key`, a label or level
        from the given `axis`.

        Retrieval logic:
          - (axis=0): Return column values if `key` matches a column label.
            Otherwise return index level values if `key` matches an index
            level.
          - (axis=1): Return row values if `key` matches an index label.
            Otherwise return column level values if 'key' matches a column
            level

        Parameters
        ----------
        key: str
            Label or level name.
        axis: int, default 0
            Axis that levels are associated with (0 for index, 1 for columns)

        Returns
        -------
        values: np.ndarray

        Raises
        ------
        KeyError
            if `key` matches neither a label nor a level
        ValueError
            if `key` matches multiple labels
        FutureWarning
            if `key` is ambiguous. This will become an ambiguity error in a
            future version
        i   s8   _get_label_or_level_values is not implemented for {type}RO   Rr   i    i   sX   
For a multi-index, the label must be a tuple with elements corresponding to each level.t    R6  RJ   sA   The {label_axis_name} label '{key}' is not unique.{multi_message}R   t   label_axis_namet   multi_message(   R   R   R   RL   R   RN   RO   R0  R;  t   xst   _valuesR1  RB   R   R   R   R   R6   R   (   RZ   R   Rr   R|   R3  RT   R>  R=  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _get_label_or_level_valuesy  s.    #.			c         C   s  |  j  |  } |  j d k r? t d j d t |      n  t j |  } g  | D]! } |  j | d | sU | ^ qU } | r t d j d | d |    n  g  | D]! } |  j	 | d | r | ^ q } g  | D]! } |  j	 | d | s | ^ q } |  j
   } | d k r^| r9| j | d t d	 t n  | r| j | d d
 d	 t qnj | rt | j t  r| j j |  | _ qt | j j  | _ n  | r| j | d d d	 t n  | S(   s  
        Drop labels and/or levels for the given `axis`.

        For each key in `keys`:
          - (axis=0): If key matches a column label then drop the column.
            Otherwise if key matches an index level then drop the level.
          - (axis=1): If key matches an index label then drop the row.
            Otherwise if key matches a column level then drop the level.

        Parameters
        ----------
        keys: str or list of str
            labels or levels to drop
        axis: int, default 0
            Axis that levels are associated with (0 for index, 1 for columns)

        Returns
        -------
        dropped: DataFrame

        Raises
        ------
        ValueError
            if any `keys` match neither a label nor a level
        i   s4   _drop_labels_or_levels is not implemented for {type}RO   Rr   sQ   The following keys are not valid labels or levels for axis {axis}: {invalid_keys}t   invalid_keysi    t   dropR]   i   (   R   RL   R   RN   RO   R	  t   maybe_make_listR4  R   R1  RQ   t   reset_indexR   RC  R   t   columnsR6   R   R7   R   (   RZ   R  Rr   R   RB  t   levels_to_dropt   labels_to_dropt   dropped(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _drop_labels_or_levels  s:    	!!!c         C   s   t  d j |  j j    d  S(   Ns5   {0!r} objects are mutable, thus they cannot be hashed(   RM   RN   R   RP   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __hash__  s    	c         C   s   t  |  j  S(   s   Iterate over infor axis(   t   iterR   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __iter__  s    c         C   s   |  j  S(   s   Get the 'info axis' (see Indexing for more)

        This is index for Series, columns for DataFrame and major_axis for
        Panel.
        (   R   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    c         c   s'   x  |  j  D] } | |  | f Vq
 Wd S(   s   Iterate over (label, values) on info axis

        This is index for Series, columns for DataFrame, major_axis for Panel,
        and so on.
        N(   R   (   RZ   t   h(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt	   iteritems'  s    c         C   s   t  |  j  S(   s   Returns length of info axis(   R   R   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __len__0  s    c         C   s   | |  j  k S(   s#   True if the key is in the info axis(   R   (   RZ   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __contains__4  s    c            s   t    f d     j D  S(   sP  
        Indicator whether DataFrame is empty.

        True if DataFrame is entirely empty (no items), meaning any of the
        axes are of length 0.

        Returns
        -------
        bool
            If DataFrame is empty, return True, if not return False.

        See Also
        --------
        pandas.Series.dropna
        pandas.DataFrame.dropna

        Notes
        -----
        If DataFrame contains only NaNs, it is still not considered empty. See
        the example below.

        Examples
        --------
        An example of an actual empty DataFrame. Notice the index is empty:

        >>> df_empty = pd.DataFrame({'A' : []})
        >>> df_empty
        Empty DataFrame
        Columns: [A]
        Index: []
        >>> df_empty.empty
        True

        If we only have NaNs in our DataFrame, it is not considered empty! We
        will need to drop the NaNs to make the DataFrame empty:

        >>> df = pd.DataFrame({'A' : [np.nan]})
        >>> df
            A
        0 NaN
        >>> df.empty
        False
        >>> df.dropna().empty
        True
        c         3   s*   |  ]  } t    j |   d  k Vq d S(   i    N(   R   R   (   R   R   (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>g  s    (   R2  R   (   RZ   (    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   empty8  s    /i  c         C   s   t  j |   S(   N(   R	  R  (   RZ   RK   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt	   __array__p  s    c         C   s1   |  j  |  j d t } |  j | |  j |   S(   NRQ   (   R   R   R   R   RW   (   RZ   R_   t   contextR   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR"  s  s    c         C   s   |  S(   sP   
        Return dense representation of NDFrame (as opposed to sparse).
        (    (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   to_dense  s    c            s>     f d     j  D } t d   j d   j d   j  |  S(   Nc            s%   i  |  ] } t    | d   |  q S(   N(   R   Rs   (   R   R   (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>  s   	 RY   R   Rk   (   Rk   R   RY   R   (   RZ   t   meta(    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __getstate__  s    c         C   s  t  | t  r | |  _ nkt  | t  r | j d  } | d  k	 r t |  j |  j  } x@ t	 |  D]2 } | | k rh | | } t
 j |  | |  qh qh WxL | j   D]. \ } } | | k r t
 j |  | |  q q Wq|  j |  n t  | d t  r5t |  d k r%|  j |  q|  j |  nQ t |  d k rW|  j |  n/ t |  d k ry|  j |  n |  j |  i  |  _ d  S(   NR   i    i   i   i   (   R   R<   RY   R   R   Rs   R   t   _internal_namesRk   R   Rw   Rx   R~   t   _unpickle_series_compatR   t   _unpickle_sparse_frame_compatt   _unpickle_frame_compatt   _unpickle_panel_compatt   _unpickle_matrix_compatRc   (   RZ   t   statet   typRV  R   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __setstate__  s0    
c         C   s0   d d j  t t |    } d |  j j | f S(   Ns   [%s]t   ,s   %s(%s)(   t   joinR	   R@   R   RP   (   RZ   t   prepr(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __unicode__  s    c         C   s!   t  j d  r |  j   Sd Sd S(   s   
        Returns a LaTeX representation for a particular object.
        Mainly for use with nbconvert (jupyter notebook conversion to pdf).
        s   display.latex.reprN(   R/   t
   get_optiont   to_latexRs   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _repr_latex_  s    
c         C   sS   t  j d  rO |  j t  j d   } t j | j d d  d t j } | Sd S(   sh   
        Not a real Jupyter special repr method, but we use the same
        naming convention.
        s   display.html.table_schemas   display.max_rowst   orientt   tablet   object_pairs_hookN(   R/   Re  t   headt   jsont   loadst   to_jsont   collectionst   OrderedDict(   RZ   Ry   t   payload(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _repr_data_resource_  s
    s~  
    Write %(klass)s to an Excel sheet.

    To write a single %(klass)s to an Excel .xlsx file it is only necessary to
    specify a target file name. To write to multiple sheets it is necessary to
    create an `ExcelWriter` object with a target file name, and specify a sheet
    in the file to write to.

    Multiple sheets may be written to by specifying unique `sheet_name`.
    With all data written to the file it is necessary to save the changes.
    Note that creating an `ExcelWriter` object with a file name that already
    exists will result in the contents of the existing file being erased.

    Parameters
    ----------
    excel_writer : str or ExcelWriter object
        File path or existing ExcelWriter.
    sheet_name : str, default 'Sheet1'
        Name of sheet which will contain DataFrame.
    na_rep : str, default ''
        Missing data representation.
    float_format : str, optional
        Format string for floating point numbers. For example
        ``float_format="%%.2f"`` will format 0.1234 to 0.12.
    columns : sequence or list of str, optional
        Columns to write.
    header : bool or list of str, default True
        Write out the column names. If a list of string is given it is
        assumed to be aliases for the column names.
    index : bool, default True
        Write row names (index).
    index_label : str or sequence, optional
        Column label for index column(s) if desired. If not specified, and
        `header` and `index` are True, then the index names are used. A
        sequence should be given if the DataFrame uses MultiIndex.
    startrow : int, default 0
        Upper left cell row to dump data frame.
    startcol : int, default 0
        Upper left cell column to dump data frame.
    engine : str, optional
        Write engine to use, 'openpyxl' or 'xlsxwriter'. You can also set this
        via the options ``io.excel.xlsx.writer``, ``io.excel.xls.writer``, and
        ``io.excel.xlsm.writer``.
    merge_cells : bool, default True
        Write MultiIndex and Hierarchical Rows as merged cells.
    encoding : str, optional
        Encoding of the resulting excel file. Only necessary for xlwt,
        other writers support unicode natively.
    inf_rep : str, default 'inf'
        Representation for infinity (there is no native representation for
        infinity in Excel).
    verbose : bool, default True
        Display more information in the error logs.
    freeze_panes : tuple of int (length 2), optional
        Specifies the one-based bottommost row and rightmost column that
        is to be frozen.

        .. versionadded:: 0.20.0.

    See Also
    --------
    to_csv : Write DataFrame to a comma-separated values (csv) file.
    ExcelWriter : Class for writing DataFrame objects into excel sheets.
    read_excel : Read an Excel file into a pandas DataFrame.
    read_csv : Read a comma-separated values (csv) file into DataFrame.

    Notes
    -----
    For compatibility with :meth:`~DataFrame.to_csv`,
    to_excel serializes lists and dicts to strings before writing.

    Once a workbook has been saved it is not possible write further data
    without rewriting the whole workbook.

    Examples
    --------

    Create, write to and save a workbook:

    >>> df1 = pd.DataFrame([['a', 'b'], ['c', 'd']],
    ...                    index=['row 1', 'row 2'],
    ...                    columns=['col 1', 'col 2'])
    >>> df1.to_excel("output.xlsx")  # doctest: +SKIP

    To specify the sheet name:

    >>> df1.to_excel("output.xlsx",
    ...              sheet_name='Sheet_name_1')  # doctest: +SKIP

    If you wish to write to more than one sheet in the workbook, it is
    necessary to specify an ExcelWriter object:

    >>> df2 = df1.copy()
    >>> with pd.ExcelWriter('output.xlsx') as writer:  # doctest: +SKIP
    ...     df1.to_excel(writer, sheet_name='Sheet_name_1')
    ...     df2.to_excel(writer, sheet_name='Sheet_name_2')

    To set the library that is used to write the Excel file,
    you can pass the `engine` keyword (the default engine is
    automatically chosen depending on the file extension):

    >>> df1.to_excel('output1.xlsx', engine='xlsxwriter')  # doctest: +SKIP
    t   to_excelRC   Rw   t   Sheet1R<  t   infc         C   s   t  |  t  r |  n	 |  j   } d d l m } | | d | d | d | d | d | d | d	 | d
 | } | j | d | d |	 d |
 d | d | d  S(   Ni(   t   ExcelFormattert   na_rept   colst   headert   float_formatRJ   t   index_labelt   merge_cellst   inf_rept
   sheet_namet   startrowt   startcolt   freeze_panest   engine(   R   R)   t   to_framet   pandas.io.formats.excelRv  t   write(   RZ   t   excel_writerR~  Rw  Rz  RF  Ry  RJ   R{  R  R  R  R|  t   encodingR}  t   verboseR  t   dfRv  t	   formatter(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRs  >  s    !	i
   t   mst   inferc         C   s   d d l  m } | d k r1 | d k r1 d } n | d k rF d } n  | j d | d |  d | d	 | d
 | d | d | d | d | d |	 d |
  S(   s  
        Convert the object to a JSON string.

        Note NaN's and None will be converted to null and datetime objects
        will be converted to UNIX timestamps.

        Parameters
        ----------
        path_or_buf : string or file handle, optional
            File path or object. If not specified, the result is returned as
            a string.
        orient : string
            Indication of expected JSON string format.

            * Series

              - default is 'index'
              - allowed values are: {'split','records','index','table'}

            * DataFrame

              - default is 'columns'
              - allowed values are:
                {'split','records','index','columns','values','table'}

            * The format of the JSON string

              - 'split' : dict like {'index' -> [index],
                'columns' -> [columns], 'data' -> [values]}
              - 'records' : list like
                [{column -> value}, ... , {column -> value}]
              - 'index' : dict like {index -> {column -> value}}
              - 'columns' : dict like {column -> {index -> value}}
              - 'values' : just the values array
              - 'table' : dict like {'schema': {schema}, 'data': {data}}
                describing the data, and the data component is
                like ``orient='records'``.

                .. versionchanged:: 0.20.0

        date_format : {None, 'epoch', 'iso'}
            Type of date conversion. 'epoch' = epoch milliseconds,
            'iso' = ISO8601. The default depends on the `orient`. For
            ``orient='table'``, the default is 'iso'. For all other orients,
            the default is 'epoch'.
        double_precision : int, default 10
            The number of decimal places to use when encoding
            floating point values.
        force_ascii : bool, default True
            Force encoded string to be ASCII.
        date_unit : string, default 'ms' (milliseconds)
            The time unit to encode to, governs timestamp and ISO8601
            precision.  One of 's', 'ms', 'us', 'ns' for second, millisecond,
            microsecond, and nanosecond respectively.
        default_handler : callable, default None
            Handler to call if object cannot otherwise be converted to a
            suitable format for JSON. Should receive a single argument which is
            the object to convert and return a serialisable object.
        lines : bool, default False
            If 'orient' is 'records' write out line delimited json format. Will
            throw ValueError if incorrect 'orient' since others are not list
            like.

            .. versionadded:: 0.19.0

        compression : {'infer', 'gzip', 'bz2', 'zip', 'xz', None}

            A string representing the compression to use in the output file,
            only used when the first argument is a filename. By default, the
            compression is inferred from the filename.

            .. versionadded:: 0.21.0
            .. versionchanged:: 0.24.0
               'infer' option added and set to default
        index : bool, default True
            Whether to include the index values in the JSON string. Not
            including the index (``index=False``) is only supported when
            orient is 'split' or 'table'.

            .. versionadded:: 0.23.0

        See Also
        --------
        read_json

        Examples
        --------

        >>> df = pd.DataFrame([['a', 'b'], ['c', 'd']],
        ...                   index=['row 1', 'row 2'],
        ...                   columns=['col 1', 'col 2'])
        >>> df.to_json(orient='split')
        '{"columns":["col 1","col 2"],
          "index":["row 1","row 2"],
          "data":[["a","b"],["c","d"]]}'

        Encoding/decoding a Dataframe using ``'records'`` formatted JSON.
        Note that index labels are not preserved with this encoding.

        >>> df.to_json(orient='records')
        '[{"col 1":"a","col 2":"b"},{"col 1":"c","col 2":"d"}]'

        Encoding/decoding a Dataframe using ``'index'`` formatted JSON:

        >>> df.to_json(orient='index')
        '{"row 1":{"col 1":"a","col 2":"b"},"row 2":{"col 1":"c","col 2":"d"}}'

        Encoding/decoding a Dataframe using ``'columns'`` formatted JSON:

        >>> df.to_json(orient='columns')
        '{"col 1":{"row 1":"a","row 2":"c"},"col 2":{"row 1":"b","row 2":"d"}}'

        Encoding/decoding a Dataframe using ``'values'`` formatted JSON:

        >>> df.to_json(orient='values')
        '[["a","b"],["c","d"]]'

        Encoding with Table Schema

        >>> df.to_json(orient='table')
        '{"schema": {"fields": [{"name": "index", "type": "string"},
                                {"name": "col 1", "type": "string"},
                                {"name": "col 2", "type": "string"}],
                     "primaryKey": "index",
                     "pandas_version": "0.20.0"},
          "data": [{"index": "row 1", "col 1": "a", "col 2": "b"},
                   {"index": "row 2", "col 1": "c", "col 2": "d"}]}'
        i(   Rl  Ri  t   isot   epocht   path_or_bufR   Rh  t   date_formatt   double_precisiont   force_asciit	   date_unitt   default_handlert   linest   compressionRJ   N(   t	   pandas.ioRl  Rs   Rn  (   RZ   R  Rh  R  R  R  R  R  R  R  RJ   Rl  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRn  Q  s    		c         K   s&   d d l  m } | j | | |  |  S(   s  
        Write the contained data to an HDF5 file using HDFStore.

        Hierarchical Data Format (HDF) is self-describing, allowing an
        application to interpret the structure and contents of a file with
        no outside information. One HDF file can hold a mix of related objects
        which can be accessed as a group or as individual objects.

        In order to add another DataFrame or Series to an existing HDF file
        please use append mode and a different a key.

        For more information see the :ref:`user guide <io.hdf5>`.

        Parameters
        ----------
        path_or_buf : str or pandas.HDFStore
            File path or HDFStore object.
        key : str
            Identifier for the group in the store.
        mode : {'a', 'w', 'r+'}, default 'a'
            Mode to open file:

            - 'w': write, a new file is created (an existing file with
              the same name would be deleted).
            - 'a': append, an existing file is opened for reading and
              writing, and if the file does not exist it is created.
            - 'r+': similar to 'a', but the file must already exist.
        format : {'fixed', 'table'}, default 'fixed'
            Possible values:

            - 'fixed': Fixed format. Fast writing/reading. Not-appendable,
              nor searchable.
            - 'table': Table format. Write as a PyTables Table structure
              which may perform worse but allow more flexible operations
              like searching / selecting subsets of the data.
        append : bool, default False
            For Table formats, append the input data to the existing.
        data_columns :  list of columns or True, optional
            List of columns to create as indexed data columns for on-disk
            queries, or True to use all columns. By default only the axes
            of the object are indexed. See :ref:`io.hdf5-query-data-columns`.
            Applicable only to format='table'.
        complevel : {0-9}, optional
            Specifies a compression level for data.
            A value of 0 disables compression.
        complib : {'zlib', 'lzo', 'bzip2', 'blosc'}, default 'zlib'
            Specifies the compression library to be used.
            As of v0.20.2 these additional compressors for Blosc are supported
            (default if no compressor specified: 'blosc:blosclz'):
            {'blosc:blosclz', 'blosc:lz4', 'blosc:lz4hc', 'blosc:snappy',
            'blosc:zlib', 'blosc:zstd'}.
            Specifying a compression library which is not available issues
            a ValueError.
        fletcher32 : bool, default False
            If applying compression use the fletcher32 checksum.
        dropna : bool, default False
            If true, ALL nan rows will not be written to store.
        errors : str, default 'strict'
            Specifies how encoding and decoding errors are to be handled.
            See the errors argument for :func:`open` for a full list
            of options.

        See Also
        --------
        DataFrame.read_hdf : Read from HDF file.
        DataFrame.to_parquet : Write a DataFrame to the binary parquet format.
        DataFrame.to_sql : Write to a sql table.
        DataFrame.to_feather : Write out feather-format for DataFrames.
        DataFrame.to_csv : Write out to a csv file.

        Examples
        --------
        >>> df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6]},
        ...                   index=['a', 'b', 'c'])
        >>> df.to_hdf('data.h5', key='df', mode='w')

        We can add another object to the same file:

        >>> s = pd.Series([1, 2, 3, 4])
        >>> s.to_hdf('data.h5', key='s')

        Reading from HDF file:

        >>> pd.read_hdf('data.h5', 'df')
        A  B
        a  1  4
        b  2  5
        c  3  6
        >>> pd.read_hdf('data.h5', 's')
        0    1
        1    2
        2    3
        3    4
        dtype: int64

        Deleting file with data:

        >>> import os
        >>> os.remove('data.h5')
        i(   t   pytables(   R  R  t   to_hdf(   RZ   R  R   R   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    es   utf-8c         K   s)   d d l  m } | j | |  d | | S(   s	  
        Serialize object to input file path using msgpack format.

        THIS IS AN EXPERIMENTAL LIBRARY and the storage format
        may not be stable until a future release.

        Parameters
        ----------
        path : string File path, buffer-like, or None
            if None, return generated string
        append : bool whether to append to an existing msgpack
            (default is False)
        compress : type of compressor (zlib or blosc), default to None (no
            compression)
        i(   t   packersR  (   R  R  t
   to_msgpack(   RZ   R  R  R   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  K	  s    t   failc
         C   sQ   d d l  m }
 |
 j |  | | d | d | d | d | d | d | d	 |	 d
 S(   sd  
        Write records stored in a DataFrame to a SQL database.

        Databases supported by SQLAlchemy [1]_ are supported. Tables can be
        newly created, appended to, or overwritten.

        Parameters
        ----------
        name : string
            Name of SQL table.
        con : sqlalchemy.engine.Engine or sqlite3.Connection
            Using SQLAlchemy makes it possible to use any DB supported by that
            library. Legacy support is provided for sqlite3.Connection objects.
        schema : string, optional
            Specify the schema (if database flavor supports this). If None, use
            default schema.
        if_exists : {'fail', 'replace', 'append'}, default 'fail'
            How to behave if the table already exists.

            * fail: Raise a ValueError.
            * replace: Drop the table before inserting new values.
            * append: Insert new values to the existing table.

        index : bool, default True
            Write DataFrame index as a column. Uses `index_label` as the column
            name in the table.
        index_label : string or sequence, default None
            Column label for index column(s). If None is given (default) and
            `index` is True, then the index names are used.
            A sequence should be given if the DataFrame uses MultiIndex.
        chunksize : int, optional
            Rows will be written in batches of this size at a time. By default,
            all rows will be written at once.
        dtype : dict, optional
            Specifying the datatype for columns. The keys should be the column
            names and the values should be the SQLAlchemy types or strings for
            the sqlite3 legacy mode.
        method : {None, 'multi', callable}, default None
            Controls the SQL insertion clause used:

            * None : Uses standard SQL ``INSERT`` clause (one per row).
            * 'multi': Pass multiple values in a single ``INSERT`` clause.
            * callable with signature ``(pd_table, conn, keys, data_iter)``.

            Details and a sample callable implementation can be found in the
            section :ref:`insert method <io.sql.method>`.

            .. versionadded:: 0.24.0

        Raises
        ------
        ValueError
            When the table already exists and `if_exists` is 'fail' (the
            default).

        See Also
        --------
        read_sql : Read a DataFrame from a table.

        Notes
        -----
        Timezone aware datetime columns will be written as
        ``Timestamp with timezone`` type with SQLAlchemy if supported by the
        database. Otherwise, the datetimes will be stored as timezone unaware
        timestamps local to the original timezone.

        .. versionadded:: 0.24.0

        References
        ----------
        .. [1] http://docs.sqlalchemy.org
        .. [2] https://www.python.org/dev/peps/pep-0249/

        Examples
        --------

        Create an in-memory SQLite database.

        >>> from sqlalchemy import create_engine
        >>> engine = create_engine('sqlite://', echo=False)

        Create a table from scratch with 3 rows.

        >>> df = pd.DataFrame({'name' : ['User 1', 'User 2', 'User 3']})
        >>> df
             name
        0  User 1
        1  User 2
        2  User 3

        >>> df.to_sql('users', con=engine)
        >>> engine.execute("SELECT * FROM users").fetchall()
        [(0, 'User 1'), (1, 'User 2'), (2, 'User 3')]

        >>> df1 = pd.DataFrame({'name' : ['User 4', 'User 5']})
        >>> df1.to_sql('users', con=engine, if_exists='append')
        >>> engine.execute("SELECT * FROM users").fetchall()
        [(0, 'User 1'), (1, 'User 2'), (2, 'User 3'),
         (0, 'User 4'), (1, 'User 5')]

        Overwrite the table with just ``df1``.

        >>> df1.to_sql('users', con=engine, if_exists='replace',
        ...            index_label='id')
        >>> engine.execute("SELECT * FROM users").fetchall()
        [(0, 'User 4'), (1, 'User 5')]

        Specify the dtype (especially useful for integers with missing values).
        Notice that while pandas is forced to store the data as floating point,
        the database supports nullable integers. When fetching the data with
        Python, we get back integer scalars.

        >>> df = pd.DataFrame({"A": [1, None, 2]})
        >>> df
             A
        0  1.0
        1  NaN
        2  2.0

        >>> from sqlalchemy.types import Integer
        >>> df.to_sql('integers', con=engine, index=False,
        ...           dtype={"A": Integer()})

        >>> engine.execute("SELECT * FROM integers").fetchall()
        [(1,), (None,), (2,)]
        i(   t   sqlt   schemat	   if_existsRJ   R{  t	   chunksizeRK   R\   N(   R  R  t   to_sql(   RZ   R   t   conR  R  RJ   R{  R  RK   R\   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  `	  s    c         C   s)   d d l  m } | |  | d | d | S(   s  
        Pickle (serialize) object to file.

        Parameters
        ----------
        path : str
            File path where the pickled object will be stored.
        compression : {'infer', 'gzip', 'bz2', 'zip', 'xz', None},         default 'infer'
            A string representing the compression to use in the output file. By
            default, infers from the file extension in specified path.

            .. versionadded:: 0.20.0
        protocol : int
            Int which indicates which protocol should be used by the pickler,
            default HIGHEST_PROTOCOL (see [1]_ paragraph 12.1.2). The possible
            values for this parameter depend on the version of Python. For
            Python 2.x, possible values are 0, 1, 2. For Python>=3.0, 3 is a
            valid value. For Python >= 3.4, 4 is a valid value. A negative
            value for the protocol parameter is equivalent to setting its value
            to HIGHEST_PROTOCOL.

            .. [1] https://docs.python.org/3/library/pickle.html
            .. versionadded:: 0.21.0

        See Also
        --------
        read_pickle : Load pickled pandas object (or any object) from file.
        DataFrame.to_hdf : Write DataFrame to an HDF5 file.
        DataFrame.to_sql : Write DataFrame to a SQL database.
        DataFrame.to_parquet : Write a DataFrame to the binary parquet format.

        Examples
        --------
        >>> original_df = pd.DataFrame({"foo": range(5), "bar": range(5, 10)})
        >>> original_df
           foo  bar
        0    0    5
        1    1    6
        2    2    7
        3    3    8
        4    4    9
        >>> original_df.to_pickle("./dummy.pkl")

        >>> unpickled_df = pd.read_pickle("./dummy.pkl")
        >>> unpickled_df
           foo  bar
        0    0    5
        1    1    6
        2    2    7
        3    3    8
        4    4    9

        >>> import os
        >>> os.remove("./dummy.pkl")
        i(   t	   to_pickleR  t   protocol(   t   pandas.io.pickleR  (   RZ   t   pathR  R  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  	  s    :c         K   s0   d d l  m } | j |  d | d | | d S(   sW  
        Copy object to the system clipboard.

        Write a text representation of object to the system clipboard.
        This can be pasted into Excel, for example.

        Parameters
        ----------
        excel : bool, default True
            - True, use the provided separator, writing in a csv format for
              allowing easy pasting into excel.
            - False, write a string representation of the object to the
              clipboard.

        sep : str, default ``'\t'``
            Field delimiter.
        **kwargs
            These parameters will be passed to DataFrame.to_csv.

        See Also
        --------
        DataFrame.to_csv : Write a DataFrame to a comma-separated values
            (csv) file.
        read_clipboard : Read text from clipboard and pass to read_table.

        Notes
        -----
        Requirements for your platform.

          - Linux : `xclip`, or `xsel` (with `gtk` or `PyQt4` modules)
          - Windows : none
          - OS X : none

        Examples
        --------
        Copy the contents of a DataFrame to the clipboard.

        >>> df = pd.DataFrame([[1, 2, 3], [4, 5, 6]], columns=['A', 'B', 'C'])
        >>> df.to_clipboard(sep=',')
        ... # Wrote the following to the system clipboard:
        ... # ,A,B,C
        ... # 0,1,2,3
        ... # 1,4,5,6

        We can omit the the index by passing the keyword `index` and setting
        it to false.

        >>> df.to_clipboard(sep=',', index=False)
        ... # Wrote the following to the system clipboard:
        ... # A,B,C
        ... # 1,2,3
        ... # 4,5,6
        i(   t
   clipboardst   excelt   sepN(   R  R  t   to_clipboard(   RZ   R  R  R   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  #
  s    6c         C   s   y d d l  } Wn t k
 r/ t d   n X|  j d k rO | j j |   S|  j d k rn | j j |   Sg  |  j D] } | |  j |  f ^ qx } | j |  d | S(   s!  
        Return an xarray object from the pandas object.

        Returns
        -------
        xarray.DataArray or xarray.Dataset
            Data in the pandas structure converted to Dataset if the object is
            a DataFrame, or a DataArray if the object is a Series.

        See Also
        --------
        DataFrame.to_hdf : Write DataFrame to an HDF5 file.
        DataFrame.to_parquet : Write a DataFrame to the binary parquet format.

        Notes
        -----
        See the `xarray docs <http://xarray.pydata.org/en/stable/>`__

        Examples
        --------
        >>> df = pd.DataFrame([('falcon', 'bird',  389.0, 2),
        ...                    ('parrot', 'bird', 24.0, 2),
        ...                    ('lion',   'mammal', 80.5, 4),
        ...                    ('monkey', 'mammal', np.nan, 4)],
        ...                    columns=['name', 'class', 'max_speed',
        ...                             'num_legs'])
        >>> df
             name   class  max_speed  num_legs
        0  falcon    bird      389.0         2
        1  parrot    bird       24.0         2
        2    lion  mammal       80.5         4
        3  monkey  mammal        NaN         4

        >>> df.to_xarray()
        <xarray.Dataset>
        Dimensions:    (index: 4)
        Coordinates:
          * index      (index) int64 0 1 2 3
        Data variables:
            name       (index) object 'falcon' 'parrot' 'lion' 'monkey'
            class      (index) object 'bird' 'bird' 'mammal' 'mammal'
            max_speed  (index) float64 389.0 24.0 80.5 nan
            num_legs   (index) int64 2 2 4 4

        >>> df['max_speed'].to_xarray()
        <xarray.DataArray 'max_speed' (index: 4)>
        array([389. ,  24. ,  80.5,   nan])
        Coordinates:
          * index    (index) int64 0 1 2 3

        >>> dates = pd.to_datetime(['2018-01-01', '2018-01-01',
        ...                         '2018-01-02', '2018-01-02'])
        >>> df_multiindex = pd.DataFrame({'date': dates,
        ...                    'animal': ['falcon', 'parrot', 'falcon',
        ...                               'parrot'],
        ...                    'speed': [350, 18, 361, 15]}).set_index(['date',
        ...                                                    'animal'])
        >>> df_multiindex
                           speed
        date       animal
        2018-01-01 falcon    350
                   parrot     18
        2018-01-02 falcon    361
                   parrot     15

        >>> df_multiindex.to_xarray()
        <xarray.Dataset>
        Dimensions:  (animal: 2, date: 2)
        Coordinates:
          * date     (date) datetime64[ns] 2018-01-01 2018-01-02
          * animal   (animal) object 'falcon' 'parrot'
        Data variables:
            speed    (date, animal) int64 350 18 361 15
        iNsq   the xarray library is not installed
you can install via conda
conda install xarray
or via pip
pip install xarray
i   i   t   coords(	   t   xarrayt   ImportErrorRL   t	   DataArrayt   from_seriest   Datasett   from_dataframeR   R   (   RZ   R  R   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt	   to_xarray\
  s    L+t   NaNt   .c         C   sY  |  j  d k r |  j   }  n  | d k r< t j d  } n  | d k rZ t j d  } n  | d k rx t j d  } n  | d k r t j d  } n  | d k r t j d  } n  t |  d | d | d	 | d
 | d | d | d | d | d | d |	 d |
 d | d | } | j d | d | d | d | d | d |  | d k rU| j j   Sd S(   s  
        Render an object to a LaTeX tabular environment table.

        Render an object to a tabular environment table. You can splice
        this into a LaTeX document. Requires \usepackage{booktabs}.

        .. versionchanged:: 0.20.2
           Added to Series

        Parameters
        ----------
        buf : file descriptor or None
            Buffer to write to. If None, the output is returned as a string.
        columns : list of label, optional
            The subset of columns to write. Writes all columns by default.
        col_space : int, optional
            The minimum width of each column.
        header : bool or list of str, default True
            Write out the column names. If a list of strings is given,
            it is assumed to be aliases for the column names.
        index : bool, default True
            Write row names (index).
        na_rep : str, default 'NaN'
            Missing data representation.
        formatters : list of functions or dict of {str: function}, optional
            Formatter functions to apply to columns' elements by position or
            name. The result of each function must be a unicode string.
            List must be of length equal to the number of columns.
        float_format : str, optional
            Format string for floating point numbers.
        sparsify : bool, optional
            Set to False for a DataFrame with a hierarchical index to print
            every multiindex key at each row. By default, the value will be
            read from the config module.
        index_names : bool, default True
            Prints the names of the indexes.
        bold_rows : bool, default False
            Make the row labels bold in the output.
        column_format : str, optional
            The columns format as specified in `LaTeX table format
            <https://en.wikibooks.org/wiki/LaTeX/Tables>`__ e.g. 'rcl' for 3
            columns. By default, 'l' will be used for all columns except
            columns of numbers, which default to 'r'.
        longtable : bool, optional
            By default, the value will be read from the pandas config
            module. Use a longtable environment instead of tabular. Requires
            adding a \usepackage{longtable} to your LaTeX preamble.
        escape : bool, optional
            By default, the value will be read from the pandas config
            module. When set to False prevents from escaping latex special
            characters in column names.
        encoding : str, optional
            A string representing the encoding to use in the output file,
            defaults to 'ascii' on Python 2 and 'utf-8' on Python 3.
        decimal : str, default '.'
            Character recognized as decimal separator, e.g. ',' in Europe.
            .. versionadded:: 0.18.0
        multicolumn : bool, default True
            Use \multicolumn to enhance MultiIndex columns.
            The default will be read from the config module.
            .. versionadded:: 0.20.0
        multicolumn_format : str, default 'l'
            The alignment for multicolumns, similar to `column_format`
            The default will be read from the config module.
            .. versionadded:: 0.20.0
        multirow : bool, default False
            Use \multirow to enhance MultiIndex rows. Requires adding a
            \usepackage{multirow} to your LaTeX preamble. Will print
            centered labels (instead of top-aligned) across the contained
            rows, separating groups via clines. The default will be read
            from the pandas config module.
            .. versionadded:: 0.20.0

        Returns
        -------
        str or None
            If buf is None, returns the resulting LateX format as a
            string. Otherwise returns None.

        See Also
        --------
        DataFrame.to_string : Render a DataFrame to a console-friendly
            tabular output.
        DataFrame.to_html : Render a DataFrame as an HTML table.

        Examples
        --------
        >>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'],
        ...                    'mask': ['red', 'purple'],
        ...                    'weapon': ['sai', 'bo staff']})
        >>> df.to_latex(index=False) # doctest: +NORMALIZE_WHITESPACE
        '\\begin{tabular}{lll}\n\\toprule\n      name &    mask &    weapon
        \\\\\n\\midrule\n   Raphael &     red &       sai \\\\\n Donatello &
         purple &  bo staff \\\\\n\\bottomrule\n\\end{tabular}\n'
        i   s   display.latex.longtables   display.latex.escapes   display.latex.multicolumns    display.latex.multicolumn_formats   display.latex.multirowt   bufRF  t	   col_spaceRw  Ry  RJ   t
   formattersRz  t	   bold_rowst   sparsifyt   index_namest   escapet   decimalt   column_formatt	   longtableR  t   multicolumnt   multicolumn_formatt   multirowN(	   RL   R  Rs   R/   Re  R>   Rf  R  t   getvalue(   RZ   R  RF  R  Ry  RJ   Rw  R  Rz  R  R  R  R  R  R  R  R  R  R  R  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRf  
  s8    fRa  t   wt   "c      )   C   s  t  |  t  r |  n	 |  j   } | d k	 rF t j d t d d n t } d d l m	 } | | | d | d | d |
 d	 | d
 | d | d | d | d | d | d | d |	 d | d | d | d | d | d | d | } | j
   | d k r | j j   Sd S(   s	  
        Write object to a comma-separated values (csv) file.

        .. versionchanged:: 0.24.0
            The order of arguments for Series was changed.

        Parameters
        ----------
        path_or_buf : str or file handle, default None
            File path or object, if None is provided the result is returned as
            a string.  If a file object is passed it should be opened with
            `newline=''`, disabling universal newlines.

            .. versionchanged:: 0.24.0

               Was previously named "path" for Series.

        sep : str, default ','
            String of length 1. Field delimiter for the output file.
        na_rep : str, default ''
            Missing data representation.
        float_format : str, default None
            Format string for floating point numbers.
        columns : sequence, optional
            Columns to write.
        header : bool or list of str, default True
            Write out the column names. If a list of strings is given it is
            assumed to be aliases for the column names.

            .. versionchanged:: 0.24.0

               Previously defaulted to False for Series.

        index : bool, default True
            Write row names (index).
        index_label : str or sequence, or False, default None
            Column label for index column(s) if desired. If None is given, and
            `header` and `index` are True, then the index names are used. A
            sequence should be given if the object uses MultiIndex. If
            False do not print fields for index names. Use index_label=False
            for easier importing in R.
        mode : str
            Python write mode, default 'w'.
        encoding : str, optional
            A string representing the encoding to use in the output file,
            defaults to 'ascii' on Python 2 and 'utf-8' on Python 3.
        compression : str, default 'infer'
            Compression mode among the following possible values: {'infer',
            'gzip', 'bz2', 'zip', 'xz', None}. If 'infer' and `path_or_buf`
            is path-like, then detect compression from the following
            extensions: '.gz', '.bz2', '.zip' or '.xz'. (otherwise no
            compression).

            .. versionchanged:: 0.24.0

               'infer' option added and set to default.

        quoting : optional constant from csv module
            Defaults to csv.QUOTE_MINIMAL. If you have set a `float_format`
            then floats are converted to strings and thus csv.QUOTE_NONNUMERIC
            will treat them as non-numeric.
        quotechar : str, default '\"'
            String of length 1. Character used to quote fields.
        line_terminator : string, optional
            The newline character or character sequence to use in the output
            file. Defaults to `os.linesep`, which depends on the OS in which
            this method is called ('\n' for linux, '\r\n' for Windows, i.e.).

            .. versionchanged:: 0.24.0
        chunksize : int or None
            Rows to write at a time.
        tupleize_cols : bool, default False
            Write MultiIndex columns as a list of tuples (if True) or in
            the new, expanded format, where each MultiIndex column is a row
            in the CSV (if False).

            .. deprecated:: 0.21.0
               This argument will be removed and will always write each row
               of the multi-index as a separate row in the CSV file.
        date_format : str, default None
            Format string for datetime objects.
        doublequote : bool, default True
            Control quoting of `quotechar` inside a field.
        escapechar : str, default None
            String of length 1. Character used to escape `sep` and `quotechar`
            when appropriate.
        decimal : str, default '.'
            Character recognized as decimal separator. E.g. use ',' for
            European data.

        Returns
        -------
        None or str
            If path_or_buf is None, returns the resulting csv format as a
            string. Otherwise returns None.

        See Also
        --------
        read_csv : Load a CSV file into a DataFrame.
        to_excel : Load an Excel file into a DataFrame.

        Examples
        --------
        >>> df = pd.DataFrame({'name': ['Raphael', 'Donatello'],
        ...                    'mask': ['red', 'purple'],
        ...                    'weapon': ['sai', 'bo staff']})
        >>> df.to_csv(index=False)
        'name,mask,weapon\nRaphael,red,sai\nDonatello,purple,bo staff\n'
        sS   The 'tupleize_cols' parameter is deprecated and will be removed in a future versionR   i   i(   t   CSVFormattert   line_terminatorR  R  R  t   quotingRw  Rz  Rx  Ry  RJ   R{  t   modeR  t	   quotechart   tupleize_colsR  t   doublequotet
   escapecharR  N(   R   R)   R  Rs   R   R   R   R   t   pandas.io.formats.csvsR  t   saveR  R  (   RZ   R  R  Rw  Rz  RF  Ry  RJ   R{  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   to_csvB  s*    t!	
c         C   sP   t  |  | d  d k rL t j | |  } t |  | t | d | j  n  d S(   s*   Create an indexer like _name in the class.t   docN(   R   Rs   t	   functoolst   partialR   t   propertyt   __doc__(   R   R   t   indexert   _indexer(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _create_indexer  s    c         C   s.   y |  | SWn t  t t f k
 r) | SXd S(   s  
        Get item from object for given key (DataFrame column, Panel slice,
        etc.). Returns default value if not found.

        Parameters
        ----------
        key : object

        Returns
        -------
        value : same type as items contained in object
        N(   R   R   R   (   RZ   R   t   default(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR     s    c         C   s   |  j  |  S(   N(   t   _get_item_cache(   RZ   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __getitem__  s    c         C   su   |  j  } | j |  } | d k rq |  j j |  } |  j | |  } | | | <| j | |   |  j | _ n  | S(   s8   Return the cached item, item represents a label indexer.N(   Rc   R   Rs   RY   t   _box_item_valuest   _set_as_cachedRe   (   RZ   R  t   cachet   resRT   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    	
c         C   s   | t  j |  f |  _ d S(   sZ   Set the _cacher attribute on the calling object with a weakref to
        cacher.
        N(   t   weakreft   refRb   (   RZ   R  t   cacher(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    c         C   s   t  |  d  r |  ` n  d S(   s   Reset the cacher.Rb   N(   t   hasattrRb   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR     s    c         C   sD   |  j  } | j r( |  j | |  } n |  j | d |  j } | S(   s=   Return the cached item, item represents a positional indexer.Rr   (   R   t	   is_uniqueR  t   _takeR   (   RZ   R  R|   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _iget_item_cache	  s
    		c         C   s   t  |    d  S(   N(   R   (   RZ   R   RT   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    c         C   s   |  j  j | |  d S(   sF   The object has called back to us saying maybe it has changed.
        N(   RY   R   (   RZ   R  t   value(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _maybe_cache_changed  s    c         C   s   t  |  d d  d k	 S(   s3   Return boolean indicating if self is cached or not.Rb   N(   R   Rs   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   _is_cached  s    c         C   s2   t  |  d d  } | d k	 r. | d   } n  | S(   s   return my cacher or NoneRb   i   N(   R   Rs   (   RZ   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _get_cacher  s    c         C   s
   |  j  j S(   s;   Return boolean indicating if self is view of another array (   RY   t   is_view(   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _is_view&  s    c         C   s   t  |  d d  } | d k	 ro | d   } | d k r@ |  ` qo y | j | d |   Wqo t k
 rk qo Xn  | r |  j d d d d  n  | r |  j   n  d S(	   s&  
        See if we need to update our parent cacher if clear, then clear our
        cache.

        Parameters
        ----------
        clear : boolean, default False
            clear the item cache
        verify_is_copy : boolean, default True
            provide is_copy checks

        Rb   i   i    R   i   t   tt   referantN(   R   Rs   Rb   R  R  t   _check_setitem_copyR   (   RZ   t   cleart   verify_is_copyR  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _maybe_update_cacher+  s    	c         C   s3   | d  k	 r" |  j j | d   n |  j j   d  S(   N(   Rs   Rc   R   R  (   RZ   R{   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR   M  s    c         C   sk   |  j  |  } |  j |  j j | d |  } | j |   } | d k pQ | j } | j |  d | | S(   s   
        Construct a slice of this container.

        kind parameter is maintained for compatibility with Series slicing.
        Rr   i    RQ   (   R   R   RY   t	   get_sliceRW   R  t   _set_is_copy(   RZ   t   slobjRr   R   R_   Rq   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _sliceS  s    !c         C   s!   |  j  j | |  |  j   d  S(   N(   RY   R   R   (   RZ   R   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt	   _set_itemc  s    c         C   s@   | s d  |  _ n* | d  k	 r3 t j |  |  _ n	 d  |  _ d  S(   N(   Rs   Re   R  R  (   RZ   R  RQ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  g  s
    c         C   s|   |  j  rV |  j rV |  j   } | d k	 rR | j rR |  j d d d d d t  n  t S|  j rx |  j d d d d  n  t S(   sV  
        Check if we are a view, have a cacher, and are of mixed type.
        If so, then force a setitem_copy check.

        Should be called just near setting a value

        Will return a boolean if it we are a view and are cached, but a
        single-dtype meaning that the cacher should be updated following
        setting.
        R   i   R  R  t   forceN(	   R  R  R  Rs   t   _is_mixed_typeR  R   Re   R   (   RZ   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt%   _check_is_chained_assignment_possiblep  s    
	i   t   settingc         C   s8  | s |  j  r4t j d  } | d k r. d Sy3 t j d  t j |  j     s` d |  _  d SWn t k
 rt n Xy) |  j    j |  j k r d |  _  d SWn t k
 r n Xt	 |  j  t
  r |  j  } n | d k r d } n d } | d k r	t j |   q4| d k r4t j | t j d	 | q4n  d S(
   s|  

        Parameters
        ----------
        stacklevel : integer, default 4
           the level to show of the stack when the error is output
        t : string, the type of setting error
        force : boolean, default False
           if True, then force showing an error

        validate if we are doing a settitem on a chained copy.

        If you call this function, be sure to set the stacklevel such that the
        user will see the error *at the level of setting*

        It is technically possible to figure out that we are setting on
        a copy even WITH a multi-dtyped pandas object. In other words, some
        blocks may be views while other are not. Currently _is_view will ALWAYS
        return False for multi-blocks to avoid having to handle this case.

        df = DataFrame(np.arange(0,9), columns=['count'])
        df['group'] = 'b'

        # This technically need not raise SettingWithCopy if both are view
        # (which is not # generally guaranteed but is usually True.  However,
        # this is in general not a good practice and we recommend using .loc.
        df.iloc[0:5]['group'] = 'a'

        s   mode.chained_assignmentNi   R  s   
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copys   
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copyt   raiseR   R   (   Re   R/   Re  Rs   t   gct   collectt   get_referentsR  R   R   R   R	  t   SettingWithCopyErrorR   R   t   SettingWithCopyWarning(   RZ   R   R  R  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s6    					c         C   s  t  } t  } t |  d  rZ t |  j t  rZ y | |  j j k } WqZ t k
 rV qZ Xn  | r t | t  s{ | f } n  xI |  j D]; } t | t  r | t |   | k r |  | =t	 } q q Wn  | s |  j
 j |  n  y |  j | =Wn t k
 rn Xd S(   s   
        Delete item
        RF  N(   R   R  R   RF  R6   t   _engineRM   R   R   R   RY   t   deleteRc   R   (   RZ   R   t   deletedt   maybe_shortcutt   col(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __delitem__  s(    !%c         C   s   |  j    |  j j | d |  j |  d t } |  j |  j |   } | r | j |  j |  j |   s | j	 |   q n  | S(   sT  
        Return the elements in the given *positional* indices along an axis.

        This means that we are not indexing according to actual values in
        the index attribute of the object. We are indexing according to the
        actual position of the element in the object.

        This is the internal version of ``.take()`` and will contain a wider
        selection of parameters useful for internal use but not as suitable
        for public usage.

        Parameters
        ----------
        indices : array-like
            An array of ints indicating which positions to take.
        axis : int, default 0
            The axis on which to select elements. "0" means that we are
            selecting rows, "1" means that we are selecting columns, etc.
        is_copy : bool, default True
            Whether to return a copy of the original object or not.

        Returns
        -------
        taken : same type as caller
            An array-like containing the elements taken from the object.

        See Also
        --------
        numpy.ndarray.take
        numpy.take
        Rr   t   verify(
   R  RY   t   takeR   R   R   RW   R   R  R  (   RZ   t   indicesRr   Rq   t   new_dataR_   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s     
	!c         K   sW   | d k	 r+ d } t j | t d d n  t j t   |  |  j | d | d | S(   s{  
        Return the elements in the given *positional* indices along an axis.

        This means that we are not indexing according to actual values in
        the index attribute of the object. We are indexing according to the
        actual position of the element in the object.

        Parameters
        ----------
        indices : array-like
            An array of ints indicating which positions to take.
        axis : {0 or 'index', 1 or 'columns', None}, default 0
            The axis on which to select elements. ``0`` means that we are
            selecting rows, ``1`` means that we are selecting columns.
        convert : bool, default True
            Whether to convert negative indices into positive ones.
            For example, ``-1`` would map to the ``len(axis) - 1``.
            The conversions are similar to the behavior of indexing a
            regular Python list.

            .. deprecated:: 0.21.0
               In the future, negative indices will always be converted.

        is_copy : bool, default True
            Whether to return a copy of the original object or not.
        **kwargs
            For compatibility with :meth:`numpy.take`. Has no effect on the
            output.

        Returns
        -------
        taken : same type as caller
            An array-like containing the elements taken from the object.

        See Also
        --------
        DataFrame.loc : Select a subset of a DataFrame by labels.
        DataFrame.iloc : Select a subset of a DataFrame by positions.
        numpy.take : Take elements from an array along an axis.

        Examples
        --------
        >>> df = pd.DataFrame([('falcon', 'bird',    389.0),
        ...                    ('parrot', 'bird',     24.0),
        ...                    ('lion',   'mammal',   80.5),
        ...                    ('monkey', 'mammal', np.nan)],
        ...                    columns=['name', 'class', 'max_speed'],
        ...                    index=[0, 2, 3, 1])
        >>> df
             name   class  max_speed
        0  falcon    bird      389.0
        2  parrot    bird       24.0
        3    lion  mammal       80.5
        1  monkey  mammal        NaN

        Take elements at positions 0 and 3 along the axis 0 (default).

        Note how the actual indices selected (0 and 1) do not correspond to
        our selected indices 0 and 3. That's because we are selecting the 0th
        and 3rd rows, not rows whose indices equal 0 and 3.

        >>> df.take([0, 3])
             name   class  max_speed
        0  falcon    bird      389.0
        1  monkey  mammal        NaN

        Take elements at indices 1 and 2 along the axis 1 (column selection).

        >>> df.take([1, 2], axis=1)
            class  max_speed
        0    bird      389.0
        2    bird       24.0
        3  mammal       80.5
        1  mammal        NaN

        We may take elements using negative integers for positive indices,
        starting from the end of the object, just like with Python lists.

        >>> df.take([-1, -2])
             name   class  max_speed
        1  monkey  mammal        NaN
        3    lion  mammal       80.5
        sN   The 'convert' parameter is deprecated and will be removed in a future version.R   i   Rr   Rq   N(   Rs   R   R   R   R   t   validate_takeR   R  (   RZ   R	  Rr   t   convertRq   R   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  )  s
    Tc         C   s+  |  j  |  } |  j |  } | d	 k	 r | j | d | d | \ } } t d	  g |  j } | | | <t |  } |  j | }	 t |	 |	 j	 |  |  |	 S| d k r |  | S|  j
   |  j }
 t |
 t  r |  j j | d | \ } } n |  j j |  } t | t j  rf| j t j k rP| j   \ } |  j | d | S|  j | d | Sn  t |  s|  j | } n  t |  r|  j j |  } t |  s|  j d k rt j |  S|  j | d |  j d |  j | d | j }	 n |  j | }	 | |	 _ |	 j |  d |	 j |	 S(
   sL  
        Return cross-section from the Series/DataFrame.

        This method takes a `key` argument to select data at a particular
        level of a MultiIndex.

        Parameters
        ----------
        key : label or tuple of label
            Label contained in the index, or partially in a MultiIndex.
        axis : {0 or 'index', 1 or 'columns'}, default 0
            Axis to retrieve cross-section on.
        level : object, defaults to first n levels (n=1 or len(key))
            In case of a key partially contained in a MultiIndex, indicate
            which levels are used. Levels can be referred by label or position.
        drop_level : bool, default True
            If False, returns object with same levels as self.

        Returns
        -------
        Series or DataFrame
            Cross-section from the original Series or DataFrame
            corresponding to the selected index levels.

        See Also
        --------
        DataFrame.loc : Access a group of rows and columns
            by label(s) or a boolean array.
        DataFrame.iloc : Purely integer-location based indexing
            for selection by position.

        Notes
        -----
        `xs` can not be used to set values.

        MultiIndex Slicers is a generic way to get/set values on
        any level or levels.
        It is a superset of `xs` functionality, see
        :ref:`MultiIndex Slicers <advanced.mi_slicers>`.

        Examples
        --------
        >>> d = {'num_legs': [4, 4, 2, 2],
        ...      'num_wings': [0, 0, 2, 2],
        ...      'class': ['mammal', 'mammal', 'mammal', 'bird'],
        ...      'animal': ['cat', 'dog', 'bat', 'penguin'],
        ...      'locomotion': ['walks', 'walks', 'flies', 'walks']}
        >>> df = pd.DataFrame(data=d)
        >>> df = df.set_index(['class', 'animal', 'locomotion'])
        >>> df
                                   num_legs  num_wings
        class  animal  locomotion
        mammal cat     walks              4          0
               dog     walks              4          0
               bat     flies              2          2
        bird   penguin walks              2          2

        Get values at specified index

        >>> df.xs('mammal')
                           num_legs  num_wings
        animal locomotion
        cat    walks              4          0
        dog    walks              4          0
        bat    flies              2          2

        Get values at several indexes

        >>> df.xs(('mammal', 'dog'))
                    num_legs  num_wings
        locomotion
        walks              4          0

        Get values at specified index and level

        >>> df.xs('cat', level=1)
                           num_legs  num_wings
        class  locomotion
        mammal walks              4          0

        Get values at several indexes and levels

        >>> df.xs(('bird', 'walks'),
        ...       level=[0, 'locomotion'])
                 num_legs  num_wings
        animal
        penguin         2          2

        Get values at specified column and axis

        >>> df.xs('num_wings', axis=1)
        class   animal   locomotion
        mammal  cat      walks         0
                dog      walks         0
                bat      flies         2
        bird    penguin  walks         2
        Name: num_wings, dtype: int64
        R   t
   drop_leveli   Rr   RJ   R   RK   RQ   N(   R   R   Rs   t   get_loc_levelR  RL   R   R  R   R   R  RJ   R   R6   t   get_locR   t   ndarrayRK   R*  t   nonzeroR  R&   RY   t   fast_xsR    R	  t   maybe_box_datetimelikeR   RF  R  R  (   RZ   R   Rr   R   R  R   t   loct   new_axR  R_   RJ   t	   new_indext   indsR   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR?    sJ    c

		c         C   s   t  j d t d d |  j |  } |  j |  } |  j |  } t |  d k r | t j g  | D] } t	 | |   ^ qe  } n | } |  j
 i | | 6  S(   s  
        Return data corresponding to axis labels matching criteria.

        .. deprecated:: 0.21.0
            Use df.loc[df.index.map(crit)] to select via labels

        Parameters
        ----------
        crit : function
            To be called on each index (label). Should return True or False
        axis : int

        Returns
        -------
        selection : same type as caller
        ss   'select' is deprecated and will be removed in a future release. You can use .loc[labels.map(crit)] as a replacementR   i   i    (   R   R   R   R   R   R   R   R   t   asarrayR)  t   reindex(   RZ   t   critRr   R   t   axis_valuest   labelt   new_axis(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   select'  s    	2c         C   s:   | j  d |  j d | d | d | d |  } |  j |   S(   s  
        Return an object with matching indices as other object.

        Conform the object to the same index on all axes. Optional
        filling logic, placing NaN in locations having no value
        in the previous index. A new object is produced unless the
        new index is equivalent to the current one and copy=False.

        Parameters
        ----------
        other : Object of the same data type
            Its row and column indices are used to define the new indices
            of this object.
        method : {None, 'backfill'/'bfill', 'pad'/'ffill', 'nearest'}
            Method to use for filling holes in reindexed DataFrame.
            Please note: this is only applicable to DataFrames/Series with a
            monotonically increasing/decreasing index.

            * None (default): don't fill gaps
            * pad / ffill: propagate last valid observation forward to next
              valid
            * backfill / bfill: use next valid observation to fill gap
            * nearest: use nearest valid observations to fill gap

        copy : bool, default True
            Return a new object, even if the passed indexes are the same.
        limit : int, default None
            Maximum number of consecutive labels to fill for inexact matches.
        tolerance : optional
            Maximum distance between original and new labels for inexact
            matches. The values of the index at the matching locations most
            satisfy the equation ``abs(index[indexer] - target) <= tolerance``.

            Tolerance may be a scalar value, which applies the same tolerance
            to all values, or list-like, which applies variable tolerance per
            element. List-like includes list, tuple, array, Series, and must be
            the same size as the index and its dtype must exactly match the
            index's type.

            .. versionadded:: 0.21.0 (list-like tolerance)

        Returns
        -------
        Series or DataFrame
            Same type as caller, but with changed indices on each axis.

        See Also
        --------
        DataFrame.set_index : Set row labels.
        DataFrame.reset_index : Remove row labels or move them to new columns.
        DataFrame.reindex : Change to new indices or expand indices.

        Notes
        -----
        Same as calling
        ``.reindex(index=other.index, columns=other.columns,...)``.

        Examples
        --------
        >>> df1 = pd.DataFrame([[24.3, 75.7, 'high'],
        ...                     [31, 87.8, 'high'],
        ...                     [22, 71.6, 'medium'],
        ...                     [35, 95, 'medium']],
        ...     columns=['temp_celsius', 'temp_fahrenheit', 'windspeed'],
        ...     index=pd.date_range(start='2014-02-12',
        ...                         end='2014-02-15', freq='D'))

        >>> df1
                    temp_celsius  temp_fahrenheit windspeed
        2014-02-12          24.3             75.7      high
        2014-02-13          31.0             87.8      high
        2014-02-14          22.0             71.6    medium
        2014-02-15          35.0             95.0    medium

        >>> df2 = pd.DataFrame([[28, 'low'],
        ...                     [30, 'low'],
        ...                     [35.1, 'medium']],
        ...     columns=['temp_celsius', 'windspeed'],
        ...     index=pd.DatetimeIndex(['2014-02-12', '2014-02-13',
        ...                             '2014-02-15']))

        >>> df2
                    temp_celsius windspeed
        2014-02-12          28.0       low
        2014-02-13          30.0       low
        2014-02-15          35.1    medium

        >>> df2.reindex_like(df1)
                    temp_celsius  temp_fahrenheit windspeed
        2014-02-12          28.0              NaN       low
        2014-02-13          30.0              NaN       low
        2014-02-14           NaN              NaN       NaN
        2014-02-15          35.1              NaN    medium
        RB   R\   RQ   RH   t	   tolerance(   R   R   R  (   RZ   R  R\   RQ   RH   R  R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   reindex_likeI  s    `	R  c         C   s  t  | d  } | d  k	 ra | d  k	 s3 | d  k	 rB t d   n  |  j |  } i | | 6}	 nE | d  k	 sy | d  k	 r |  j | | f i   \ }	 }
 n t d   |  } xG |	 j   D]9 \ } } | d  k	 r | j | | d | d | } q q W| r|  j |  n | Sd  S(   NR]   s2   Cannot specify both 'labels' and 'index'/'columns's>   Need to specify at least one of 'labels', 'index' or 'columns'R   t   errors(   R   Rs   R   R   R   R~   t
   _drop_axisRX   (   RZ   R   Rr   RJ   RF  R   R]   R!  R   RB   t   _R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRC    s     !%c         C   s  |  j  |  } |  j |  } |  j |  } | j r | d k	 r~ t | t  s` t d   n  | j | d | d | } n | j | d | } |  j	 i | | 6  } nt
 t j |   } | d k	 r7t | t  s t d   n  | j |  j |  } | d k r| j   rt d j |    qnU | j |  } | j |  d k j   }	 | d k r|	 rt d j |    n  t d  g |  j }
 | |
 |  j  |  <|  j t |
  } | S(   s  
        Drop labels from specified axis. Used in the ``drop`` method
        internally.

        Parameters
        ----------
        labels : single label or list-like
        axis : int or axis name
        level : int or level name, default None
            For MultiIndex
        errors : {'ignore', 'raise'}, default 'raise'
            If 'ignore', suppress error and existing labels are dropped.

        s   axis must be a MultiIndexR   R!  R  s   {} not found in axisiN(   R   R   R   R  Rs   R   R6   R   RC  R  R   R	  t   index_labels_to_arrayR   t   isinR  R   RN   t   get_indexer_forR2  R  RL   R  R   (   RZ   R   Rr   R   R!  R   R  R_   R  t   labels_missingt   slicer(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR"    s2    	c         C   s=   |  j    |  j   t | d |  |  _ |  j d |  d S(   s   
        Replace self internals with result.

        Parameters
        ----------
        verify_is_copy : boolean, default True
            provide is_copy checks

        RY   R  N(   t   _reset_cacheR   R   RY   R  (   RZ   R_   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRX      s    

c         C   s5   t  j d j d | } i | |  j 6} |  j |   S(   s  
        Prefix labels with string `prefix`.

        For Series, the row labels are prefixed.
        For DataFrame, the column labels are prefixed.

        Parameters
        ----------
        prefix : str
            The string to add before each label.

        Returns
        -------
        Series or DataFrame
            New Series or DataFrame with updated labels.

        See Also
        --------
        Series.add_suffix: Suffix row labels with string `suffix`.
        DataFrame.add_suffix: Suffix column labels with string `suffix`.

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4])
        >>> s
        0    1
        1    2
        2    3
        3    4
        dtype: int64

        >>> s.add_prefix('item_')
        item_0    1
        item_1    2
        item_2    3
        item_3    4
        dtype: int64

        >>> df = pd.DataFrame({'A': [1, 2, 3, 4],  'B': [3, 4, 5, 6]})
        >>> df
           A  B
        0  1  3
        1  2  4
        2  3  5
        3  4  6

        >>> df.add_prefix('col_')
             col_A  col_B
        0       1       3
        1       2       4
        2       3       5
        3       4       6
        s
   {prefix}{}R   (   R  R  RN   R   R  (   RZ   R   R  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   add_prefix  s    6c         C   s5   t  j d j d | } i | |  j 6} |  j |   S(   s  
        Suffix labels with string `suffix`.

        For Series, the row labels are suffixed.
        For DataFrame, the column labels are suffixed.

        Parameters
        ----------
        suffix : str
            The string to add after each label.

        Returns
        -------
        Series or DataFrame
            New Series or DataFrame with updated labels.

        See Also
        --------
        Series.add_prefix: Prefix row labels with string `prefix`.
        DataFrame.add_prefix: Prefix column labels with string `prefix`.

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4])
        >>> s
        0    1
        1    2
        2    3
        3    4
        dtype: int64

        >>> s.add_suffix('_item')
        0_item    1
        1_item    2
        2_item    3
        3_item    4
        dtype: int64

        >>> df = pd.DataFrame({'A': [1, 2, 3, 4],  'B': [3, 4, 5, 6]})
        >>> df
           A  B
        0  1  3
        1  2  4
        2  3  5
        3  4  6

        >>> df.add_suffix('_col')
             A_col  B_col
        0       1       3
        1       2       4
        2       3       5
        3       4       6
        s
   {}{suffix}t   suffix(   R  R  RN   R   R  (   RZ   R+  R  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   add_suffixM  s    6t	   quicksortt   lastc         C   s   t  d   d S(   s	  
        Sort by the values along either axis

        Parameters
        ----------%(optional_by)s
        axis : %(axes_single_arg)s, default 0
             Axis to be sorted
        ascending : bool or list of bool, default True
             Sort ascending vs. descending. Specify list for multiple sort
             orders.  If this is a list of bools, must match the length of
             the by.
        inplace : bool, default False
             if True, perform operation in-place
        kind : {'quicksort', 'mergesort', 'heapsort'}, default 'quicksort'
             Choice of sorting algorithm. See also ndarray.np.sort for more
             information.  `mergesort` is the only stable algorithm. For
             DataFrames, this option is only applied when sorting on a single
             column or label.
        na_position : {'first', 'last'}, default 'last'
             `first` puts NaNs at the beginning, `last` puts NaNs at the end

        Returns
        -------
        sorted_obj : %(klass)s

        Examples
        --------
        >>> df = pd.DataFrame({
        ...     'col1' : ['A', 'A', 'B', np.nan, 'D', 'C'],
        ...     'col2' : [2, 1, 9, 8, 7, 4],
        ...     'col3': [0, 1, 9, 4, 2, 3],
        ... })
        >>> df
            col1 col2 col3
        0   A    2    0
        1   A    1    1
        2   B    9    9
        3   NaN  8    4
        4   D    7    2
        5   C    4    3

        Sort by col1

        >>> df.sort_values(by=['col1'])
            col1 col2 col3
        0   A    2    0
        1   A    1    1
        2   B    9    9
        5   C    4    3
        4   D    7    2
        3   NaN  8    4

        Sort by multiple columns

        >>> df.sort_values(by=['col1', 'col2'])
            col1 col2 col3
        1   A    1    1
        0   A    2    0
        2   B    9    9
        5   C    4    3
        4   D    7    2
        3   NaN  8    4

        Sort Descending

        >>> df.sort_values(by='col1', ascending=False)
            col1 col2 col3
        4   D    7    2
        5   C    4    3
        2   B    9    9
        0   A    2    0
        1   A    1    1
        3   NaN  8    4

        Putting NAs first

        >>> df.sort_values(by='col1', ascending=False, na_position='first')
            col1 col2 col3
        3   NaN  8    4
        4   D    7    2
        5   C    4    3
        2   B    9    9
        0   A    2    0
        1   A    1    1
        sA   sort_values has not been implemented on Panel or Panel4D objects.N(   R   (   RZ   t   byRr   t	   ascendingR]   R   t   na_position(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   sort_values  s    Wc         C   s   t  | d  } |  j |  } |  j |  } |  j |  }	 | d k	 rW t d   n  | rl t d   n  |	 j   }
 | s |
 d d d  }
 n  |	 j |
  } |  j i | | 6  S(   s  
        Sort object by labels (along an axis)

        Parameters
        ----------
        axis : %(axes)s to direct sorting
        level : int or level name or list of ints or list of level names
            if not None, sort on values in specified index level(s)
        ascending : boolean, default True
            Sort ascending vs. descending
        inplace : bool, default False
            if True, perform operation in-place
        kind : {'quicksort', 'mergesort', 'heapsort'}, default 'quicksort'
             Choice of sorting algorithm. See also ndarray.np.sort for more
             information.  `mergesort` is the only stable algorithm. For
             DataFrames, this option is only applied when sorting on a single
             column or label.
        na_position : {'first', 'last'}, default 'last'
             `first` puts NaNs at the beginning, `last` puts NaNs at the end.
             Not implemented for MultiIndex.
        sort_remaining : bool, default True
            if true and sorting by level and index is multilevel, sort by other
            levels too (in order) after sorting by specified level

        Returns
        -------
        sorted_obj : %(klass)s
        R]   s   level is not implementeds   inplace is not implementedNi(	   R   R   R   R   Rs   R   t   argsortR  R  (   RZ   Rr   R   R0  R]   R   R1  t   sort_remainingR   R   t
   sort_indexR  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR5    s    c   
         sv    j  | |  \ } } t j | j d d   } | j d d  } | j d t  } | j d d  } | j d d  } | j d d  }	 | j d d  | r t d j t | j	    d	    n    j
   t   f d
   | j   D  r| r  j   S  S  j | | |  rNy   j | | |	  SWqNt k
 rJqNXn    j | | | | | |	 |  j    S(   s  
        Conform %(klass)s to new index with optional filling logic, placing
        NA/NaN in locations having no value in the previous index. A new object
        is produced unless the new index is equivalent to the current one and
        ``copy=False``.

        Parameters
        ----------
        %(optional_labels)s
        %(axes)s : array-like, optional
            New labels / index to conform to, should be specified using
            keywords. Preferably an Index object to avoid duplicating data
        %(optional_axis)s
        method : {None, 'backfill'/'bfill', 'pad'/'ffill', 'nearest'}
            Method to use for filling holes in reindexed DataFrame.
            Please note: this is only applicable to DataFrames/Series with a
            monotonically increasing/decreasing index.

            * None (default): don't fill gaps
            * pad / ffill: propagate last valid observation forward to next
              valid
            * backfill / bfill: use next valid observation to fill gap
            * nearest: use nearest valid observations to fill gap

        copy : bool, default True
            Return a new object, even if the passed indexes are the same.
        level : int or name
            Broadcast across a level, matching Index values on the
            passed MultiIndex level.
        fill_value : scalar, default np.NaN
            Value to use for missing values. Defaults to NaN, but can be any
            "compatible" value.
        limit : int, default None
            Maximum number of consecutive elements to forward or backward fill.
        tolerance : optional
            Maximum distance between original and new labels for inexact
            matches. The values of the index at the matching locations most
            satisfy the equation ``abs(index[indexer] - target) <= tolerance``.

            Tolerance may be a scalar value, which applies the same tolerance
            to all values, or list-like, which applies variable tolerance per
            element. List-like includes list, tuple, array, Series, and must be
            the same size as the index and its dtype must exactly match the
            index's type.

            .. versionadded:: 0.21.0 (list-like tolerance)

        Returns
        -------
        %(klass)s with changed index.

        See Also
        --------
        DataFrame.set_index : Set row labels.
        DataFrame.reset_index : Remove row labels or move them to new columns.
        DataFrame.reindex_like : Change to same indices as other DataFrame.

        Examples
        --------

        ``DataFrame.reindex`` supports two calling conventions

        * ``(index=index_labels, columns=column_labels, ...)``
        * ``(labels, axis={'index', 'columns'}, ...)``

        We *highly* recommend using keyword arguments to clarify your
        intent.

        Create a dataframe with some fictional data.

        >>> index = ['Firefox', 'Chrome', 'Safari', 'IE10', 'Konqueror']
        >>> df = pd.DataFrame({
        ...      'http_status': [200,200,404,404,301],
        ...      'response_time': [0.04, 0.02, 0.07, 0.08, 1.0]},
        ...       index=index)
        >>> df
                   http_status  response_time
        Firefox            200           0.04
        Chrome             200           0.02
        Safari             404           0.07
        IE10               404           0.08
        Konqueror          301           1.00

        Create a new index and reindex the dataframe. By default
        values in the new index that do not have corresponding
        records in the dataframe are assigned ``NaN``.

        >>> new_index= ['Safari', 'Iceweasel', 'Comodo Dragon', 'IE10',
        ...             'Chrome']
        >>> df.reindex(new_index)
                       http_status  response_time
        Safari               404.0           0.07
        Iceweasel              NaN            NaN
        Comodo Dragon          NaN            NaN
        IE10                 404.0           0.08
        Chrome               200.0           0.02

        We can fill in the missing values by passing a value to
        the keyword ``fill_value``. Because the index is not monotonically
        increasing or decreasing, we cannot use arguments to the keyword
        ``method`` to fill the ``NaN`` values.

        >>> df.reindex(new_index, fill_value=0)
                       http_status  response_time
        Safari                 404           0.07
        Iceweasel                0           0.00
        Comodo Dragon            0           0.00
        IE10                   404           0.08
        Chrome                 200           0.02

        >>> df.reindex(new_index, fill_value='missing')
                      http_status response_time
        Safari                404          0.07
        Iceweasel         missing       missing
        Comodo Dragon     missing       missing
        IE10                  404          0.08
        Chrome                200          0.02

        We can also reindex the columns.

        >>> df.reindex(columns=['http_status', 'user_agent'])
                   http_status  user_agent
        Firefox            200         NaN
        Chrome             200         NaN
        Safari             404         NaN
        IE10               404         NaN
        Konqueror          301         NaN

        Or we can use "axis-style" keyword arguments

        >>> df.reindex(['http_status', 'user_agent'], axis="columns")
                   http_status  user_agent
        Firefox            200         NaN
        Chrome             200         NaN
        Safari             404         NaN
        IE10               404         NaN
        Konqueror          301         NaN

        To further illustrate the filling functionality in
        ``reindex``, we will create a dataframe with a
        monotonically increasing index (for example, a sequence
        of dates).

        >>> date_index = pd.date_range('1/1/2010', periods=6, freq='D')
        >>> df2 = pd.DataFrame({"prices": [100, 101, np.nan, 100, 89, 88]},
        ...                    index=date_index)
        >>> df2
                    prices
        2010-01-01   100.0
        2010-01-02   101.0
        2010-01-03     NaN
        2010-01-04   100.0
        2010-01-05    89.0
        2010-01-06    88.0

        Suppose we decide to expand the dataframe to cover a wider
        date range.

        >>> date_index2 = pd.date_range('12/29/2009', periods=10, freq='D')
        >>> df2.reindex(date_index2)
                    prices
        2009-12-29     NaN
        2009-12-30     NaN
        2009-12-31     NaN
        2010-01-01   100.0
        2010-01-02   101.0
        2010-01-03     NaN
        2010-01-04   100.0
        2010-01-05    89.0
        2010-01-06    88.0
        2010-01-07     NaN

        The index entries that did not have a value in the original data frame
        (for example, '2009-12-29') are by default filled with ``NaN``.
        If desired, we can fill in the missing values using one of several
        options.

        For example, to back-propagate the last valid value to fill the ``NaN``
        values, pass ``bfill`` as an argument to the ``method`` keyword.

        >>> df2.reindex(date_index2, method='bfill')
                    prices
        2009-12-29   100.0
        2009-12-30   100.0
        2009-12-31   100.0
        2010-01-01   100.0
        2010-01-02   101.0
        2010-01-03     NaN
        2010-01-04   100.0
        2010-01-05    89.0
        2010-01-06    88.0
        2010-01-07     NaN

        Please note that the ``NaN`` value present in the original dataframe
        (at index value 2010-01-03) will not be filled by any of the
        value propagation schemes. This is because filling while reindexing
        does not look at dataframe values, but only compares the original and
        desired indexes. If you do want to fill in the ``NaN`` values present
        in the original dataframe, use the ``fillna()`` method.

        See the :ref:`user guide <basics.reindexing>` for more.
        R\   R   RQ   RH   R  t
   fill_valueRr   s2   reindex() got an unexpected keyword argument "{0}"i    c         3   s9   |  ]/ \ } } | d  k	 r   j |  j |  Vq d  S(   N(   Rs   R   t	   identical(   R   Rr   R|   (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>  s   N(   R   R0   t   clean_reindex_fill_methodR   Rs   R   RM   RN   R   R  R  R  R~   RQ   t   _needs_reindex_multit   _reindex_multiR  t   _reindex_axesRW   (
   RZ   R   R   RB   R\   R   RQ   RH   R  R6  (    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s0    	

c         C   s   |  } x |  j  D] }	 | |	 }
 |
 d k r2 q n  |  j |	  } | j |
 d | d | d | d | \ } } |  j |	  } | j i | | g | 6d | d | d t } q W| S(	   s%   Perform the reindex for all the axes.R   RH   R  R\   R6  RQ   t
   allow_dupsN(   R   Rs   R   R  R   t   _reindex_with_indexersR   (   RZ   RB   R   RH   R  R\   R6  RQ   R   R   R   R|   R  R  Rr   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR;    s    
c         C   s>   t  j | j     |  j k o= | d k o= | d k o= |  j S(   s$   Check if we do need a multi reindex.N(   R	  R
  RT   R   Rs   R  (   RZ   RB   R\   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR9    s    c         C   s   t  S(   N(   t   NotImplemented(   RZ   RB   RQ   R6  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR:    s    s
  
        Conform input object to new index.

        .. deprecated:: 0.21.0
            Use `reindex` instead.

        By default, places NaN in locations having no value in the
        previous index. A new object is produced unless the new index
        is equivalent to the current one and copy=False.

        Parameters
        ----------
        labels : array-like
            New labels / index to conform to. Preferably an Index object to
            avoid duplicating data.
        axis : %(axes_single_arg)s
            Indicate whether to use rows or columns.
        method : {None, 'backfill'/'bfill', 'pad'/'ffill', 'nearest'}, optional
            Method to use for filling holes in reindexed DataFrame:

            * default: don't fill gaps.
            * pad / ffill: propagate last valid observation forward to next
              valid.
            * backfill / bfill: use next valid observation to fill gap.
            * nearest: use nearest valid observations to fill gap.

        level : int or str
            Broadcast across a level, matching Index values on the
            passed MultiIndex level.
        copy : bool, default True
            Return a new object, even if the passed indexes are the same.
        limit : int, optional
            Maximum number of consecutive elements to forward or backward fill.
        fill_value : float, default NaN
            Value used to fill in locations having no value in the previous
            index.

            .. versionadded:: 0.21.0 (list-like tolerance)

        Returns
        -------
        %(klass)s
            Returns a new DataFrame object with new indices, unless the new
            index is equivalent to the current one and copy=False.

        See Also
        --------
        DataFrame.set_index : Set row labels.
        DataFrame.reset_index : Remove row labels or move them to new columns.
        DataFrame.reindex : Change to new indices or expand indices.
        DataFrame.reindex_like : Change to same indices as other DataFrame.

        Examples
        --------
        >>> df = pd.DataFrame({'num_legs': [4, 2], 'num_wings': [0, 2]},
        ...                   index=['dog', 'hawk'])
        >>> df
              num_legs  num_wings
        dog          4          0
        hawk         2          2
        >>> df.reindex(['num_wings', 'num_legs', 'num_heads'],
        ...            axis='columns')
              num_wings  num_legs  num_heads
        dog           0         4        NaN
        hawk          2         2        NaN
        Rv   c         C   s   d } |  j    |  j |  }	 |  j |	  }
 t j |  } t j | t d d |
 j | | | d | \ } } |  j	 i | | g | 6d | d | S(   Ns^   '.reindex_axis' is deprecated and will be removed in a future version. Use '.reindex' instead.R   i   RH   R6  RQ   (
   R  R   R   R0   R8  R   R   R   R  R=  (   RZ   R   Rr   R\   R   RQ   RH   R6  R   R   R  R  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRv   e  s    
c   
      C   s   |  j  } x t | j    D] } | | \ } } |  j |  }	 | d k rS q n  t |  } | d k	 rz t |  } n  | j | | d |	 d | d | d | } q W| r | |  j  k r | j   } n  |  j	 |  j
 |   S(   s+   allow_dups indicates an internal call here Rr   R6  R<  RQ   N(   RY   t   sortedR  R   Rs   R8   R   t   reindex_indexerRQ   R   RW   (
   RZ   t
   reindexersR6  RQ   R<  R
  Rr   RJ   R  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR=  u  s     	c            s@  d d l  } t j |   |  } | d k r< t d   n  | d k rT |  j } n  |  j |  } | d k	 r |  j |  } |  j i g  | D] }	 |	 | k r |	 ^ q | 6  S  r   f d   }
 | j	 |
  } |  j
 d |  | S| r0 f d   }
 | j |   | j	 |
  } |  j
 d |  | St d   d S(	   s  
        Subset rows or columns of dataframe according to labels in
        the specified index.

        Note that this routine does not filter a dataframe on its
        contents. The filter is applied to the labels of the index.

        Parameters
        ----------
        items : list-like
            List of axis to restrict to (must not all be present).
        like : string
            Keep axis where "arg in col == True".
        regex : string (regular expression)
            Keep axis with re.search(regex, col) == True.
        axis : int or string axis name
            The axis to filter on.  By default this is the info axis,
            'index' for Series, 'columns' for DataFrame.

        Returns
        -------
        same type as input object

        See Also
        --------
        DataFrame.loc

        Notes
        -----
        The ``items``, ``like``, and ``regex`` parameters are
        enforced to be mutually exclusive.

        ``axis`` defaults to the info axis that is used when indexing
        with ``[]``.

        Examples
        --------
        >>> df = pd.DataFrame(np.array(([1,2,3], [4,5,6])),
        ...                   index=['mouse', 'rabbit'],
        ...                   columns=['one', 'two', 'three'])

        >>> # select columns by name
        >>> df.filter(items=['one', 'three'])
                 one  three
        mouse     1      3
        rabbit    4      6

        >>> # select columns by regular expression
        >>> df.filter(regex='e$', axis=1)
                 one  three
        mouse     1      3
        rabbit    4      6

        >>> # select rows containing 'bbi'
        >>> df.filter(like='bbi', axis=0)
                 one  two  three
        rabbit    4    5      6
        iNi   sD   Keyword arguments `items`, `like`, or `regex` are mutually exclusivec            s     t  |   k S(   N(   R   (   R   (   t   like(    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    Rr   c            s     j  t |    d  k	 S(   N(   t   searchR   Rs   (   R   (   t   matcher(    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    s,   Must pass either `items`, `like`, or `regex`(   t   reR	  R
  RM   Rs   R   R   R   R  R	   R  t   compile(   RZ   R~   RB  t   regexRr   RE  t   nkwR   R   t   rR  RT   (    (   RB  RD  s2   lib/python2.7/site-packages/pandas/core/generic.pyt   filter  s*    ;-i   c         C   s   |  j  |  S(   s  
        Return the first `n` rows.

        This function returns the first `n` rows for the object based
        on position. It is useful for quickly testing if your object
        has the right type of data in it.

        Parameters
        ----------
        n : int, default 5
            Number of rows to select.

        Returns
        -------
        obj_head : same type as caller
            The first `n` rows of the caller object.

        See Also
        --------
        DataFrame.tail: Returns the last `n` rows.

        Examples
        --------
        >>> df = pd.DataFrame({'animal':['alligator', 'bee', 'falcon', 'lion',
        ...                    'monkey', 'parrot', 'shark', 'whale', 'zebra']})
        >>> df
              animal
        0  alligator
        1        bee
        2     falcon
        3       lion
        4     monkey
        5     parrot
        6      shark
        7      whale
        8      zebra

        Viewing the first 5 lines

        >>> df.head()
              animal
        0  alligator
        1        bee
        2     falcon
        3       lion
        4     monkey

        Viewing the first `n` lines (three in this case)

        >>> df.head(3)
              animal
        0  alligator
        1        bee
        2     falcon
        (   R  (   RZ   t   n(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRk    s    9c         C   s&   | d k r |  j  d d !S|  j  | S(   s  
        Return the last `n` rows.

        This function returns last `n` rows from the object based on
        position. It is useful for quickly verifying data, for example,
        after sorting or appending rows.

        Parameters
        ----------
        n : int, default 5
            Number of rows to select.

        Returns
        -------
        type of caller
            The last `n` rows of the caller object.

        See Also
        --------
        DataFrame.head : The first `n` rows of the caller object.

        Examples
        --------
        >>> df = pd.DataFrame({'animal':['alligator', 'bee', 'falcon', 'lion',
        ...                    'monkey', 'parrot', 'shark', 'whale', 'zebra']})
        >>> df
              animal
        0  alligator
        1        bee
        2     falcon
        3       lion
        4     monkey
        5     parrot
        6      shark
        7      whale
        8      zebra

        Viewing the last 5 lines

        >>> df.tail()
           animal
        4  monkey
        5  parrot
        6   shark
        7   whale
        8   zebra

        Viewing the last `n` lines (three in this case)

        >>> df.tail(3)
          animal
        6  shark
        7  whale
        8  zebra
        i    (   R  (   RZ   RK  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   tail$  s    9c   
      C   s  | d k r |  j } n  |  j |  } |  j | } t j |  } | d k	 rt | t j  rz | j	 |  j
 |  } n  t | t  r t |  t j  r | d k r y |  | } Wq t k
 r t d   q Xq t d   q t d   n  t j | d d } t |  | k r,t d   n  | t j k j   sW| t j k j   rft d   n  | d k  j   rt d	   n  | j d  } | j   d
 k r| j   d k r| | j   } qt d   n  | j } n  | d k r	| d k r	d
 } n | d k	 r@| d k r@| d
 d k r@t d   nX | d k rq| d k	 rqt t | |   } n' | d k	 r| d k	 rt d   n  | d k  rt d   n  | j | d | d | d | }	 |  j |	 d | d t S(   s  
        Return a random sample of items from an axis of object.

        You can use `random_state` for reproducibility.

        Parameters
        ----------
        n : int, optional
            Number of items from axis to return. Cannot be used with `frac`.
            Default = 1 if `frac` = None.
        frac : float, optional
            Fraction of axis items to return. Cannot be used with `n`.
        replace : bool, default False
            Sample with or without replacement.
        weights : str or ndarray-like, optional
            Default 'None' results in equal probability weighting.
            If passed a Series, will align with target object on index. Index
            values in weights not found in sampled object will be ignored and
            index values in sampled object not in weights will be assigned
            weights of zero.
            If called on a DataFrame, will accept the name of a column
            when axis = 0.
            Unless weights are a Series, weights must be same length as axis
            being sampled.
            If weights do not sum to 1, they will be normalized to sum to 1.
            Missing values in the weights column will be treated as zero.
            Infinite values not allowed.
        random_state : int or numpy.random.RandomState, optional
            Seed for the random number generator (if int), or numpy RandomState
            object.
        axis : int or string, optional
            Axis to sample. Accepts axis number or name. Default is stat axis
            for given data type (0 for Series and DataFrames, 1 for Panels).

        Returns
        -------
        Series or DataFrame
            A new object of same type as caller containing `n` items randomly
            sampled from the caller object.

        See Also
        --------
        numpy.random.choice: Generates a random sample from a given 1-D numpy
            array.

        Examples
        --------
        >>> df = pd.DataFrame({'num_legs': [2, 4, 8, 0],
        ...                    'num_wings': [2, 0, 0, 0],
        ...                    'num_specimen_seen': [10, 2, 1, 8]},
        ...                   index=['falcon', 'dog', 'spider', 'fish'])
        >>> df
                num_legs  num_wings  num_specimen_seen
        falcon         2          2                 10
        dog            4          0                  2
        spider         8          0                  1
        fish           0          0                  8

        Extract 3 random elements from the ``Series`` ``df['num_legs']``:
        Note that we use `random_state` to ensure the reproducibility of
        the examples.

        >>> df['num_legs'].sample(n=3, random_state=1)
        fish      0
        spider    8
        falcon    2
        Name: num_legs, dtype: int64

        A random 50% sample of the ``DataFrame`` with replacement:

        >>> df.sample(frac=0.5, replace=True, random_state=1)
              num_legs  num_wings  num_specimen_seen
        dog          4          0                  2
        fish         0          0                  8

        Using a DataFrame column as weights. Rows with larger value in the
        `num_specimen_seen` column are more likely to be sampled.

        >>> df.sample(n=2, weights='num_specimen_seen', random_state=1)
                num_legs  num_wings  num_specimen_seen
        falcon         2          2                 10
        fish           0          0                  8
        i    s+   String passed to weights not a valid columnsL   Strings can only be passed to weights when sampling from rows on a DataFramesI   Strings cannot be passed as weights when sampling from a Series or Panel.RK   t   float64s5   Weights and axis to be sampled must be of same lengths*   weight vector may not include `inf` valuess.   weight vector many not include negative valuesi   s$   Invalid weights: weights sum to zeros$   Only integers accepted as `n` valuess0   Please enter a value for `frac` OR `n`, not bothsC   A negative number of rows requested. Please provide positive value.R   t   replacet   pRr   Rq   N(   Rs   R   R   R   R	  t   random_stateR   RU   RV   R  RB   R   t	   DataFrameR   R   R   R   Ru  R2  t   fillnat   sumRT   t   intR-  t   choiceR  R   (
   RZ   RK  t   fracRN  t   weightsRP  Rr   t   axis_lengtht   rst   locs(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   samplea  sT    V+	(!s  
        Apply func(self, \*args, \*\*kwargs).

        Parameters
        ----------
        func : function
            function to apply to the %(klass)s.
            ``args``, and ``kwargs`` are passed into ``func``.
            Alternatively a ``(callable, data_keyword)`` tuple where
            ``data_keyword`` is a string indicating the keyword of
            ``callable`` that expects the %(klass)s.
        args : iterable, optional
            positional arguments passed into ``func``.
        kwargs : mapping, optional
            a dictionary of keyword arguments passed into ``func``.

        Returns
        -------
        object : the return type of ``func``.

        See Also
        --------
        DataFrame.apply
        DataFrame.applymap
        Series.map

        Notes
        -----

        Use ``.pipe`` when chaining together functions that expect
        Series, DataFrames or GroupBy objects. Instead of writing

        >>> f(g(h(df), arg1=a), arg2=b, arg3=c)

        You can write

        >>> (df.pipe(h)
        ...    .pipe(g, arg1=a)
        ...    .pipe(f, arg2=b, arg3=c)
        ... )

        If you have a function that takes the data as (say) the second
        argument, pass a tuple indicating which keyword expects the
        data. For example, suppose ``f`` takes its data as ``arg2``:

        >>> (df.pipe(h)
        ...    .pipe(g, arg1=a)
        ...    .pipe((f, 'arg2'), arg1=a, arg3=c)
        ...  )
    t   pipec         O   s   t  j |  | | |  S(   N(   R	  t   _pipe(   RZ   t   funcR   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR\  7  s    s  
    Aggregate using one or more operations over the specified axis.

    %(versionadded)s

    Parameters
    ----------
    func : function, str, list or dict
        Function to use for aggregating the data. If a function, must either
        work when passed a %(klass)s or when passed to %(klass)s.apply.

        Accepted combinations are:

        - function
        - string function name
        - list of functions and/or function names, e.g. ``[np.sum, 'mean']``
        - dict of axis labels -> functions, function names or list of such.
    %(axis)s
    *args
        Positional arguments to pass to `func`.
    **kwargs
        Keyword arguments to pass to `func`.

    Returns
    -------
    DataFrame, Series or scalar
        if DataFrame.agg is called with a single function, returns a Series
        if DataFrame.agg is called with several functions, returns a DataFrame
        if Series.agg is called with single function, returns a scalar
        if Series.agg is called with several functions, returns a Series

    %(see_also)s

    Notes
    -----
    `agg` is an alias for `aggregate`. Use the alias.

    A passed user-defined-function will be passed a Series for evaluation.

    %(examples)s
    t	   aggregates  
    Call ``func`` on self producing a %(klass)s with transformed values
    and that has the same axis length as self.

    .. versionadded:: 0.20.0

    Parameters
    ----------
    func : function, str, list or dict
        Function to use for transforming the data. If a function, must either
        work when passed a %(klass)s or when passed to %(klass)s.apply.

        Accepted combinations are:

        - function
        - string function name
        - list of functions and/or function names, e.g. ``[np.exp. 'sqrt']``
        - dict of axis labels -> functions, function names or list of such.
    %(axis)s
    *args
        Positional arguments to pass to `func`.
    **kwargs
        Keyword arguments to pass to `func`.

    Returns
    -------
    %(klass)s
        A %(klass)s that must have the same length as self.

    Raises
    ------
    ValueError : If the returned %(klass)s has a different length than self.

    See Also
    --------
    %(klass)s.agg : Only perform aggregating type operations.
    %(klass)s.apply : Invoke function on a %(klass)s.

    Examples
    --------
    >>> df = pd.DataFrame({'A': range(3), 'B': range(1, 4)})
    >>> df
       A  B
    0  0  1
    1  1  2
    2  2  3
    >>> df.transform(lambda x: x + 1)
       A  B
    0  1  2
    1  2  3
    2  3  4

    Even though the resulting %(klass)s must have the same length as the
    input %(klass)s, it is possible to provide several input functions:

    >>> s = pd.Series(range(3))
    >>> s
    0    0
    1    1
    2    2
    dtype: int64
    >>> s.transform([np.sqrt, np.exp])
           sqrt        exp
    0  0.000000   1.000000
    1  1.000000   2.718282
    2  1.414214   7.389056
    t	   transformc         K   sI   t  | t  rE x3 |  j D]% } t j |  | t | | d   q Wn  |  S(   sK  
        Propagate metadata from other to self.

        Parameters
        ----------
        other : the object from which to get the attributes that we are going
            to propagate
        method : optional, a passed method name ; possibly to take different
            types of propagation actions based on this

        N(   R   RD   Rk   Rw   Rx   R   Rs   (   RZ   R  R\   R   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRW     s    &c         C   sk   | |  j  k s- | |  j k s- | |  j k r= t j |  |  S|  j j |  rW |  | St j |  |  Sd S(   s   After regular attribute access, try looking up the name
        This allows simpler access to columns for interactive use.
        N(   R   Rk   t
   _accessorsRw   t   __getattribute__R   t$   _can_hold_identifiers_and_holds_name(   RZ   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __getattr__  s    c         C   sN  y' t  j |  |  t  j |  | |  SWn t k
 r: n X| |  j k r` t  j |  | |  n | |  j k r t  j |  | |  n yg t |  |  } t | t  r t  j |  | |  n/ | |  j	 k r | |  | <n t  j |  | |  Wn[ t t
 f k
 rIt |  t  r3t |  r3t j d d d n  t  j |  | |  n Xd S(   s   After regular attribute access, try setting the name
        This allows simpler access to columns for interactive use.
        s   Pandas doesn't allow columns to be created via a new attribute name - see https://pandas.pydata.org/pandas-docs/stable/indexing.html#attribute-accessR   i   N(   Rw   Rb  Rx   R   R   Rk   R   R   R4   R   RM   R)   R    R   R   (   RZ   R   R  t   existing(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRx     s*    	
c         C   s?   d   |  j  j d d  d  D } t t |   j   j |  S(   s    add the string-like attributes from the info_axis.
        If info_axis is a MultiIndex, it's first level values are used.
        c         S   s1   h  |  ]' } t  | t  r t |  r |  q S(    (   R   R   R   (   R   t   c(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <setcomp>  s   	 R   i    id   (   R   t   uniquet   superRD   t   _dir_additionst   union(   RZ   t	   additions(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRi    s    #c         C   sD   t  |  j j  } |   } t  |  j j  | k r@ |  j   n  | S(   sV   Consolidate _data -- if the blocks have changed, then clear the
        cache
        (   R   RY   Ro   R   (   RZ   R  t   blocks_beforeR_   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _protect_consolidate  s
    	c            s      f d   }   j  |  d S(   s)   Consolidate data in place and return Nonec              s     j  j     _  d  S(   N(   RY   t   consolidate(    (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    N(   Rm  (   RZ   R  (    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    c            sZ   t  | d  } | r"   j   n4   f d   }   j |  }   j |  j    Sd S(   sg  
        Compute NDFrame with "consolidated" internals (data of each dtype
        grouped together in a single ndarray).

        Parameters
        ----------
        inplace : boolean, default False
            If False return new object, otherwise modify existing object

        Returns
        -------
        consolidated : same type as caller
        R]   c              s     j  j   S(   N(   RY   Rn  (    (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   <lambda>&  s    N(   R   R  Rm  R   RW   (   RZ   R]   R  t	   cons_data(    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _consolidate  s    c            s     f d   }   j  |  S(   Nc              s
     j  j S(   N(   RY   t   is_mixed_type(    (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRo  ,  s    (   Rm  (   RZ   R  (    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR  *  s    c            s     f d   }   j  |  S(   Nc              s
     j  j S(   N(   RY   t   is_numeric_mixed_type(    (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRo  1  s    (   Rm  (   RZ   R  (    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _is_numeric_mixed_type/  s    c            s     f d   }   j  |  S(   Nc              s
     j  j S(   N(   RY   t   is_datelike_mixed_type(    (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRo  6  s    (   Rm  (   RZ   R  (    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _is_datelike_mixed_type4  s    c         C   sS   |  j  rO |  j sO y t j |  r( t SWn t k
 r< n Xt d   qO n  t S(   sA    check whether we allow in-place setting with this type of value sH   Cannot do inplace boolean setting on mixed-types with a non np.nan value(   R  Rt  R   t   isnanR   R  RM   (   RZ   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _check_inplace_setting9  s    		c         C   s   |  j  |  j j    j |   S(   N(   R   RY   t   get_numeric_dataRW   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _get_numeric_dataK  s    c         C   s   |  j  |  j j    j |   S(   N(   R   RY   t   get_bool_dataRW   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _get_bool_dataO  s    c         C   s<   t  j d t d d |  j   |  j j d |  j d |  S(   s(  
        Convert the frame to its Numpy-array representation.

        .. deprecated:: 0.23.0
            Use :meth:`DataFrame.values` instead.

        Parameters
        ----------
        columns : list, optional, default:None
            If None, return all columns, otherwise, returns specified columns.

        Returns
        -------
        values : ndarray
            If the caller is heterogeneous and contains booleans or objects,
            the result will be of dtype=object. See Notes.

        See Also
        --------
        DataFrame.values

        Notes
        -----
        Return is NOT a Numpy-matrix, rather, a Numpy-array.

        The dtype will be a lower-common-denominator dtype (implicit
        upcasting); that is to say if the dtypes (even of numeric types)
        are mixed, the one that accommodates all will be chosen. Use this
        with care if you are not dealing with the blocks.

        e.g. If the dtypes are float16 and float32, dtype will be upcast to
        float32.  If dtypes are int32 and uint8, dtype will be upcase to
        int32. By numpy.find_common_type convention, mixing int64 and uint64
        will result in a float64 dtype.

        This method is provided for backwards compatibility. Generally,
        it is recommended to use '.values'.
        sK   Method .as_matrix will be removed in a future version. Use .values instead.R   i   R   R~   (   R   R   R   R  RY   t   as_arrayR   (   RZ   RF  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt	   as_matrixU  s
    '	
c         C   s    |  j    |  j j d |  j  S(   s	  
        Return a Numpy representation of the DataFrame.

        .. warning::

           We recommend using :meth:`DataFrame.to_numpy` instead.

        Only the values in the DataFrame will be returned, the axes labels
        will be removed.

        Returns
        -------
        numpy.ndarray
            The values of the DataFrame.

        See Also
        --------
        DataFrame.to_numpy : Recommended alternative to this method.
        pandas.DataFrame.index : Retrieve the index labels.
        pandas.DataFrame.columns : Retrieving the column names.

        Notes
        -----
        The dtype will be a lower-common-denominator dtype (implicit
        upcasting); that is to say if the dtypes (even of numeric types)
        are mixed, the one that accommodates all will be chosen. Use this
        with care if you are not dealing with the blocks.

        e.g. If the dtypes are float16 and float32, dtype will be upcast to
        float32.  If dtypes are int32 and uint8, dtype will be upcast to
        int32. By :func:`numpy.find_common_type` convention, mixing int64
        and uint64 will result in a float64 dtype.

        Examples
        --------
        A DataFrame where all columns are the same type (e.g., int64) results
        in an array of the same type.

        >>> df = pd.DataFrame({'age':    [ 3,  29],
        ...                    'height': [94, 170],
        ...                    'weight': [31, 115]})
        >>> df
           age  height  weight
        0    3      94      31
        1   29     170     115
        >>> df.dtypes
        age       int64
        height    int64
        weight    int64
        dtype: object
        >>> df.values
        array([[  3,  94,  31],
               [ 29, 170, 115]], dtype=int64)

        A DataFrame with mixed type columns(e.g., str/object, int64, float32)
        results in an ndarray of the broadest type that accommodates these
        mixed types (e.g., object).

        >>> df2 = pd.DataFrame([('parrot',   24.0, 'second'),
        ...                     ('lion',     80.5, 1),
        ...                     ('monkey', np.nan, None)],
        ...                   columns=('name', 'max_speed', 'rank'))
        >>> df2.dtypes
        name          object
        max_speed    float64
        rank          object
        dtype: object
        >>> df2.values
        array([['parrot', 24.0, 'second'],
               ['lion', 80.5, 1],
               ['monkey', nan, None]], dtype=object)
        R   (   R  RY   R}  R   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRT     s    J
c         C   s   |  j  S(   s   internal implementation(   RT   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR@    s    c         C   s   |  j  S(   N(   RT   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _get_values  s    c         C   s   |  j  S(   s  
        Return an ndarray after converting sparse values to dense.

        This is the same as ``.values`` for non-sparse data. For sparse
        data contained in a `pandas.SparseArray`, the data are first
        converted to a dense representation.

        Returns
        -------
        numpy.ndarray
            Numpy representation of DataFrame

        See Also
        --------
        values : Numpy representation of DataFrame.
        pandas.SparseArray : Container for sparse data.

        Examples
        --------
        >>> df = pd.DataFrame({'a': [1, 2], 'b': [True, False],
        ...                    'c': [1.0, 2.0]})
        >>> df
           a      b    c
        0  1   True  1.0
        1  2  False  2.0

        >>> df.get_values()
        array([[1, True, 1.0], [2, False, 2.0]], dtype=object)

        >>> df = pd.DataFrame({"a": pd.SparseArray([1, None, None]),
        ...                    "c": [1.0, 2.0, 3.0]})
        >>> df
             a    c
        0  1.0  1.0
        1  NaN  2.0
        2  NaN  3.0

        >>> df.get_values()
        array([[ 1.,  1.],
               [nan,  2.],
               [nan,  3.]])
        (   RT   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   get_values  s    +c         C   s#   d d l  m } | |  j j    S(   s  
        Return counts of unique dtypes in this object.

        Returns
        -------
        dtype : Series
            Series with the count of columns with each dtype.

        See Also
        --------
        dtypes : Return the dtypes in this object.

        Examples
        --------
        >>> a = [['a', 1, 1.0], ['b', 2, 2.0], ['c', 3, 3.0]]
        >>> df = pd.DataFrame(a, columns=['str', 'int', 'float'])
        >>> df
          str  int  float
        0   a    1    1.0
        1   b    2    2.0
        2   c    3    3.0

        >>> df.get_dtype_counts()
        float64    1
        int64      1
        object     1
        dtype: int64
        i(   RV   (   t   pandasRV   RY   t   get_dtype_counts(   RZ   RV   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    c         C   s9   t  j d t d d d d l m } | |  j j    S(   s  
        Return counts of unique ftypes in this object.

        .. deprecated:: 0.23.0

        This is useful for SparseDataFrame or for DataFrames containing
        sparse arrays.

        Returns
        -------
        dtype : Series
            Series with the count of columns with each type and
            sparsity (dense/sparse)

        See Also
        --------
        ftypes : Return ftypes (indication of sparse/dense and dtype) in
            this object.

        Examples
        --------
        >>> a = [['a', 1, 1.0], ['b', 2, 2.0], ['c', 3, 3.0]]
        >>> df = pd.DataFrame(a, columns=['str', 'int', 'float'])
        >>> df
          str  int  float
        0   a    1    1.0
        1   b    2    2.0
        2   c    3    3.0

        >>> df.get_ftype_counts()  # doctest: +SKIP
        float64:dense    1
        int64:dense      1
        object:dense     1
        dtype: int64
        sF   get_ftype_counts is deprecated and will be removed in a future versionR   i   i(   RV   (   R   R   R   R  RV   RY   t   get_ftype_counts(   RZ   RV   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  &  s    $	c         C   s5   d d l  m } | |  j j   d |  j d t j S(   s  
        Return the dtypes in the DataFrame.

        This returns a Series with the data type of each column.
        The result's index is the original DataFrame's columns. Columns
        with mixed types are stored with the ``object`` dtype. See
        :ref:`the User Guide <basics.dtypes>` for more.

        Returns
        -------
        pandas.Series
            The data type of each column.

        See Also
        --------
        pandas.DataFrame.ftypes : Dtype and sparsity information.

        Examples
        --------
        >>> df = pd.DataFrame({'float': [1.0],
        ...                    'int': [1],
        ...                    'datetime': [pd.Timestamp('20180310')],
        ...                    'string': ['foo']})
        >>> df.dtypes
        float              float64
        int                  int64
        datetime    datetime64[ns]
        string              object
        dtype: object
        i(   RV   RJ   RK   (   R  RV   RY   t
   get_dtypesR   R   t   object_(   RZ   RV   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   dtypesQ  s     c         C   s5   d d l  m } | |  j j   d |  j d t j S(   s  
        Return the ftypes (indication of sparse/dense and dtype) in DataFrame.

        This returns a Series with the data type of each column.
        The result's index is the original DataFrame's columns. Columns
        with mixed types are stored with the ``object`` dtype.  See
        :ref:`the User Guide <basics.dtypes>` for more.

        Returns
        -------
        pandas.Series
            The data type and indication of sparse/dense of each column.

        See Also
        --------
        pandas.DataFrame.dtypes: Series with just dtype information.
        pandas.SparseDataFrame : Container for sparse tabular data.

        Notes
        -----
        Sparse data should have the same dtypes as its dense representation.

        Examples
        --------
        >>> arr = np.random.RandomState(0).randn(100, 4)
        >>> arr[arr < .8] = np.nan
        >>> pd.DataFrame(arr).ftypes
        0    float64:dense
        1    float64:dense
        2    float64:dense
        3    float64:dense
        dtype: object

        >>> pd.SparseDataFrame(arr).ftypes
        0    float64:sparse
        1    float64:sparse
        2    float64:sparse
        3    float64:sparse
        dtype: object
        i(   RV   RJ   RK   (   R  RV   RY   t
   get_ftypesR   R   R  (   RZ   RV   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   ftypesu  s    *c         C   s&   t  j d t d d |  j d |  S(   s  
        Convert the frame to a dict of dtype -> Constructor Types that each has
        a homogeneous dtype.

        .. deprecated:: 0.21.0

        NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in
              as_matrix)

        Parameters
        ----------
        copy : boolean, default True

        Returns
        -------
        values : a dict of dtype -> Constructor Types
        s?   as_blocks is deprecated and will be removed in a future versionR   i   RQ   (   R   R   R   t   _to_dict_of_blocks(   RZ   RQ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRn     s    	c         C   s
   |  j    S(   sf   
        Internal property, property synonym for as_blocks().

        .. deprecated:: 0.21.0
        (   Rn   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRo     s    c            s)     f d     j  j d |  j   D S(   s~   
        Return a dict of dtype -> Constructor Types that
        each is a homogeneous dtype.

        Internal ONLY
        c            s1   i  |  ]' \ } }   j  |  j    |  q S(    (   R   RW   (   R   R   R   (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>  s   	RQ   (   RY   t   to_dictR~   (   RZ   RQ   (    (   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    c            s  t    r; j d k rn t   d k s<  j  k rK t d   n    j }  j |   | |  S j d k r t d   n  x/  j   D]! } |  k r t d   q q Wg  } x  j   D]c \ } } |  k r| j	 | j  | d    q | j	 | j	   r*| j
   n |   q Wn t   r j d k r    f d   t t  j   D } n:  j j d  d   d	 | |  }	  j |	  j   St j | d
 d d t }
  j |
 _ |
 S(   s	  
        Cast a pandas object to a specified dtype ``dtype``.

        Parameters
        ----------
        dtype : data type, or dict of column name -> data type
            Use a numpy.dtype or Python type to cast entire pandas object to
            the same type. Alternatively, use {col: dtype, ...}, where col is a
            column label and dtype is a numpy.dtype or Python type to cast one
            or more of the DataFrame's columns to column-specific types.
        copy : bool, default True
            Return a copy when ``copy=True`` (be very careful setting
            ``copy=False`` as changes to values then may propagate to other
            pandas objects).
        errors : {'raise', 'ignore'}, default 'raise'
            Control raising of exceptions on invalid data for provided dtype.

            - ``raise`` : allow exceptions to be raised
            - ``ignore`` : suppress exceptions. On error return original object

            .. versionadded:: 0.20.0

        kwargs : keyword arguments to pass on to the constructor

        Returns
        -------
        casted : same type as caller

        See Also
        --------
        to_datetime : Convert argument to datetime.
        to_timedelta : Convert argument to timedelta.
        to_numeric : Convert argument to a numeric type.
        numpy.ndarray.astype : Cast a numpy array to a specified type.

        Examples
        --------
        >>> ser = pd.Series([1, 2], dtype='int32')
        >>> ser
        0    1
        1    2
        dtype: int32
        >>> ser.astype('int64')
        0    1
        1    2
        dtype: int64

        Convert to categorical type:

        >>> ser.astype('category')
        0    1
        1    2
        dtype: category
        Categories (2, int64): [1, 2]

        Convert to ordered categorical type with custom ordering:

        >>> cat_dtype = pd.api.types.CategoricalDtype(
        ...                     categories=[2, 1], ordered=True)
        >>> ser.astype(cat_dtype)
        0    1
        1    2
        dtype: category
        Categories (2, int64): [2 < 1]

        Note that using ``copy=False`` and changing data on a new
        pandas object may propagate changes:

        >>> s1 = pd.Series([1,2])
        >>> s2 = s1.astype('int64', copy=False)
        >>> s2[0] = 10
        >>> s1  # note that s1[0] has changed too
        0    10
        1     2
        dtype: int64
        i   sF   Only the Series name can be used for the key in Series dtype mappings.i   s   astype() only accepts a dtype arg of type dict when invoked on Series and DataFrames. A single dtype must be specified when invoked on a Panel.sH   Only a column name can be used for the key in a dtype mappings argument.RQ   c         3   s7   |  ]- }  j  d  d   | f j  d   Vq d  S(   NRQ   (   R  Rt   (   R   R{   (   RQ   RK   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>5  s   RK   R!  Rr   (   R   RL   R   R   R   Rt   R   R  RO  R   RQ   R   R   RF  RY   R   RW   RU   t   concatR   (   RZ   RK   RQ   R!  R   t   new_typet   col_namet   resultsR  R
  R_   (    (   RQ   RK   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyRt     s4    M!#/	c         C   s+   |  j  j d |  } |  j |  j |   S(   s9  
        Make a copy of this object's indices and data.

        When ``deep=True`` (default), a new object will be created with a
        copy of the calling object's data and indices. Modifications to
        the data or indices of the copy will not be reflected in the
        original object (see notes below).

        When ``deep=False``, a new object will be created without copying
        the calling object's data or index (only references to the data
        and index are copied). Any changes to the data of the original
        will be reflected in the shallow copy (and vice versa).

        Parameters
        ----------
        deep : bool, default True
            Make a deep copy, including a copy of the data and the indices.
            With ``deep=False`` neither the indices nor the data are copied.

        Returns
        -------
        copy : Series, DataFrame or Panel
            Object type matches caller.

        Notes
        -----
        When ``deep=True``, data is copied but actual Python objects
        will not be copied recursively, only the reference to the object.
        This is in contrast to `copy.deepcopy` in the Standard Library,
        which recursively copies object data (see examples below).

        While ``Index`` objects are copied when ``deep=True``, the underlying
        numpy array is not copied for performance reasons. Since ``Index`` is
        immutable, the underlying data can be safely shared and a copy
        is not needed.

        Examples
        --------
        >>> s = pd.Series([1, 2], index=["a", "b"])
        >>> s
        a    1
        b    2
        dtype: int64

        >>> s_copy = s.copy()
        >>> s_copy
        a    1
        b    2
        dtype: int64

        **Shallow copy versus default (deep) copy:**

        >>> s = pd.Series([1, 2], index=["a", "b"])
        >>> deep = s.copy()
        >>> shallow = s.copy(deep=False)

        Shallow copy shares data and index with original.

        >>> s is shallow
        False
        >>> s.values is shallow.values and s.index is shallow.index
        True

        Deep copy has own copy of data and index.

        >>> s is deep
        False
        >>> s.values is deep.values or s.index is deep.index
        False

        Updates to the data shared by shallow copy and original is reflected
        in both; deep copy remains unchanged.

        >>> s[0] = 3
        >>> shallow[1] = 4
        >>> s
        a    3
        b    4
        dtype: int64
        >>> shallow
        a    3
        b    4
        dtype: int64
        >>> deep
        a    1
        b    2
        dtype: int64

        Note that when copying an object containing Python objects, a deep copy
        will copy the data, but will not do so recursively. Updating a nested
        data object will be reflected in the deep copy.

        >>> s = pd.Series([[1, 2], [3, 4]])
        >>> deep = s.copy()
        >>> s[0][0] = 10
        >>> s
        0    [10, 2]
        1     [3, 4]
        dtype: object
        >>> deep
        0    [10, 2]
        1     [3, 4]
        dtype: object
        R  (   RY   RQ   R   RW   (   RZ   R  Ry   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRQ   C  s    ic         C   s   |  j  d |  S(   NR  (   RQ   (   RZ   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __copy__  s    c         C   s%   | d k r i  } n  |  j d t  S(   sq   
        Parameters
        ----------
        memo, default None
            Standard signature. Unused
        R  N(   Rs   RQ   R   (   RZ   t   memo(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   __deepcopy__  s    	c         C   s=   |  j  |  j j d | d | d | d | d |   j |   S(   s  
        Attempt to infer better dtype for object columns

        Parameters
        ----------
        datetime : boolean, default False
            If True, convert to date where possible.
        numeric : boolean, default False
            If True, attempt to convert to numbers (including strings), with
            unconvertible values becoming NaN.
        timedelta : boolean, default False
            If True, convert to timedelta where possible.
        coerce : boolean, default False
            If True, force conversion with unconvertible values converted to
            nulls (NaN or NaT)
        copy : boolean, default True
            If True, return a copy even if no copy is necessary (e.g. no
            conversion was done). Note: This is meant for internal use, and
            should not be confused with inplace.

        Returns
        -------
        converted : same as input object
        t   datetimet   numericR    t   coerceRQ   (   R   RY   R  RW   (   RZ   R  R  R    R  RQ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _convert  s    c      
   C   se   d j  d |  j j  } t j | t d d |  j |  j j d | d | d | d |   j	 |   S(	   s  
        Attempt to infer better dtype for object columns.

        .. deprecated:: 0.21.0

        Parameters
        ----------
        convert_dates : boolean, default True
            If True, convert to date where possible. If 'coerce', force
            conversion, with unconvertible values becoming NaT.
        convert_numeric : boolean, default False
            If True, attempt to coerce to numbers (including strings), with
            unconvertible values becoming NaN.
        convert_timedeltas : boolean, default True
            If True, convert to timedelta where possible. If 'coerce', force
            conversion, with unconvertible values becoming NaT.
        copy : boolean, default True
            If True, return a copy even if no copy is necessary (e.g. no
            conversion was done). Note: This is meant for internal use, and
            should not be confused with inplace.

        Returns
        -------
        converted : same as input object

        See Also
        --------
        to_datetime : Convert argument to datetime.
        to_timedelta : Convert argument to timedelta.
        to_numeric : Convert argument to numeric type.
        s   convert_objects is deprecated.  To re-infer data dtypes for object columns, use {klass}.infer_objects()
For all other conversions use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric.RC   R   i   t   convert_datest   convert_numerict   convert_timedeltasRQ   (
   RN   R   RP   R   R   R   R   RY   R  RW   (   RZ   R  R  R  RQ   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRp     s    !	c         C   s=   |  j  |  j j d t d t d t d t d t   j |   S(   s  
        Attempt to infer better dtypes for object columns.

        Attempts soft conversion of object-dtyped
        columns, leaving non-object and unconvertible
        columns unchanged. The inference rules are the
        same as during normal Series/DataFrame construction.

        .. versionadded:: 0.21.0

        Returns
        -------
        converted : same type as input object

        See Also
        --------
        to_datetime : Convert argument to datetime.
        to_timedelta : Convert argument to timedelta.
        to_numeric : Convert argument to numeric type.

        Examples
        --------
        >>> df = pd.DataFrame({"A": ["a", 1, 2, 3]})
        >>> df = df.iloc[1:]
        >>> df
           A
        1  1
        2  2
        3  3

        >>> df.dtypes
        A    object
        dtype: object

        >>> df.infer_objects().dtypes
        A    int64
        dtype: object
        R  R  R    R  RQ   (   R   RY   R  R   R   RW   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   infer_objects
  s    *c            s  t  | d  } t     \    |  j   | d k rC d } n  |  j |  } d d l m }  d k rx|  j r | d k r | r t    n  |  j	 j
 d   d |  j	 } | j j   | _ | S|  j d k r t d	   qg|  j d k rB   f d
   |  j   D } |  j j |  }	 |	 j |   }
 |
 j } qg|  j j d   d | d | d | d t d |  } nt |  j |   d k r|  S|  j d k r1t  t t f  rd d l m } |    n- t   sn t d j t   j    |  j j
 d  d | d | d |  } n6t  t t f  r| d k rat d   n  | rm|  n	 |  j   } xX t  j   D]G \ } } | | k rqn  | | } | j
 | d | d t d | qW| s| Sd St   s|  j j
 d  d | d | d |  } nO t  |  rQ|  j d k rQ|  j! |  j"     } n t# d t     | r}|  j$ |  n |  j |  j |   Sd S(   s  
        Fill NA/NaN values using the specified method.

        Parameters
        ----------
        value : scalar, dict, Series, or DataFrame
            Value to use to fill holes (e.g. 0), alternately a
            dict/Series/DataFrame of values specifying which value to use for
            each index (for a Series) or column (for a DataFrame). (values not
            in the dict/Series/DataFrame will not be filled). This value cannot
            be a list.
        method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
            Method to use for filling holes in reindexed Series
            pad / ffill: propagate last valid observation forward to next valid
            backfill / bfill: use NEXT valid observation to fill gap
        axis : %(axes_single_arg)s
        inplace : boolean, default False
            If True, fill in place. Note: this will modify any
            other views on this object, (e.g. a no-copy slice for a column in a
            DataFrame).
        limit : int, default None
            If method is specified, this is the maximum number of consecutive
            NaN values to forward/backward fill. In other words, if there is
            a gap with more than this number of consecutive NaNs, it will only
            be partially filled. If method is not specified, this is the
            maximum number of entries along the entire axis where NaNs will be
            filled. Must be greater than 0 if not None.
        downcast : dict, default is None
            a dict of item->dtype of what to downcast if possible,
            or the string 'infer' which will try to downcast to an appropriate
            equal type (e.g. float64 to int64 if possible)

        Returns
        -------
        filled : %(klass)s

        See Also
        --------
        interpolate : Fill NaN values using interpolation.
        reindex, asfreq

        Examples
        --------
        >>> df = pd.DataFrame([[np.nan, 2, np.nan, 0],
        ...                    [3, 4, np.nan, 1],
        ...                    [np.nan, np.nan, np.nan, 5],
        ...                    [np.nan, 3, np.nan, 4]],
        ...                    columns=list('ABCD'))
        >>> df
             A    B   C  D
        0  NaN  2.0 NaN  0
        1  3.0  4.0 NaN  1
        2  NaN  NaN NaN  5
        3  NaN  3.0 NaN  4

        Replace all NaN elements with 0s.

        >>> df.fillna(0)
            A   B   C   D
        0   0.0 2.0 0.0 0
        1   3.0 4.0 0.0 1
        2   0.0 0.0 0.0 5
        3   0.0 3.0 0.0 4

        We can also propagate non-null values forward or backward.

        >>> df.fillna(method='ffill')
            A   B   C   D
        0   NaN 2.0 NaN 0
        1   3.0 4.0 NaN 1
        2   3.0 4.0 NaN 5
        3   3.0 3.0 NaN 4

        Replace all NaN elements in column 'A', 'B', 'C', and 'D', with 0, 1,
        2, and 3 respectively.

        >>> values = {'A': 0, 'B': 1, 'C': 2, 'D': 3}
        >>> df.fillna(value=values)
            A   B   C   D
        0   0.0 2.0 2.0 0
        1   3.0 4.0 2.0 1
        2   0.0 1.0 2.0 5
        3   0.0 3.0 2.0 4

        Only replace the first NaN element.

        >>> df.fillna(value=values, limit=1)
            A   B   C   D
        0   0.0 2.0 2.0 0
        1   3.0 4.0 NaN 1
        2   NaN 1.0 NaN 5
        3   NaN 3.0 NaN 4
        R]   i    i(   RQ  i   R\   RH   i   s'   Cannot fillna with a method for > 3dimsc            s1   i  |  ]' \ } } | j  d    d   |  q S(   R\   R  (   RR  (   R   R  R   (   R\   R  (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>  s   	Rr   R  t   downcast(   RV   sJ   "value" parameter must be a scalar, dict or Series, but you passed a "{0}"R  s9   Currently only can fill with dict/Series column by columni   s   invalid fill value with a %sN(%   R   R   R  Rs   R   R  RQ  R  R   t   TRR  RY   R  RL   RO  R   t	   from_dictRW   t   interpolateR   R   R   R   R   R+   RV   R    RM   RN   RO   RP   RQ   t   compatt   whereR.   R   RX   (   RZ   R  R\   Rr   R]   RH   R  RQ  R_   t
   prelim_objt   new_objR
  RV   R   R   R   (    (   R\   R  s2   lib/python2.7/site-packages/pandas/core/generic.pyRR  <  sv    _
		
#c         C   s(   |  j  d d d | d | d | d |  S(   sO   
        Synonym for :meth:`DataFrame.fillna` with ``method='ffill'``.
        R\   t   ffillRr   R]   RH   R  (   RR  (   RZ   Rr   R]   RH   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    c         C   s(   |  j  d d d | d | d | d |  S(   sO   
        Synonym for :meth:`DataFrame.fillna` with ``method='bfill'``.
        R\   t   bfillRr   R]   RH   R  (   RR  (   RZ   Rr   R]   RH   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    sJ*  
        Replace values given in `to_replace` with `value`.

        Values of the %(klass)s are replaced with other values dynamically.
        This differs from updating with ``.loc`` or ``.iloc``, which require
        you to specify a location to update with some value.

        Parameters
        ----------
        to_replace : str, regex, list, dict, Series, int, float, or None
            How to find the values that will be replaced.

            * numeric, str or regex:

                - numeric: numeric values equal to `to_replace` will be
                  replaced with `value`
                - str: string exactly matching `to_replace` will be replaced
                  with `value`
                - regex: regexs matching `to_replace` will be replaced with
                  `value`

            * list of str, regex, or numeric:

                - First, if `to_replace` and `value` are both lists, they
                  **must** be the same length.
                - Second, if ``regex=True`` then all of the strings in **both**
                  lists will be interpreted as regexs otherwise they will match
                  directly. This doesn't matter much for `value` since there
                  are only a few possible substitution regexes you can use.
                - str, regex and numeric rules apply as above.

            * dict:

                - Dicts can be used to specify different replacement values
                  for different existing values. For example,
                  ``{'a': 'b', 'y': 'z'}`` replaces the value 'a' with 'b' and
                  'y' with 'z'. To use a dict in this way the `value`
                  parameter should be `None`.
                - For a DataFrame a dict can specify that different values
                  should be replaced in different columns. For example,
                  ``{'a': 1, 'b': 'z'}`` looks for the value 1 in column 'a'
                  and the value 'z' in column 'b' and replaces these values
                  with whatever is specified in `value`. The `value` parameter
                  should not be ``None`` in this case. You can treat this as a
                  special case of passing two lists except that you are
                  specifying the column to search in.
                - For a DataFrame nested dictionaries, e.g.,
                  ``{'a': {'b': np.nan}}``, are read as follows: look in column
                  'a' for the value 'b' and replace it with NaN. The `value`
                  parameter should be ``None`` to use a nested dict in this
                  way. You can nest regular expressions as well. Note that
                  column names (the top-level dictionary keys in a nested
                  dictionary) **cannot** be regular expressions.

            * None:

                - This means that the `regex` argument must be a string,
                  compiled regular expression, or list, dict, ndarray or
                  Series of such elements. If `value` is also ``None`` then
                  this **must** be a nested dictionary or Series.

            See the examples section for examples of each of these.
        value : scalar, dict, list, str, regex, default None
            Value to replace any values matching `to_replace` with.
            For a DataFrame a dict of values can be used to specify which
            value to use for each column (columns not in the dict will not be
            filled). Regular expressions, strings and lists or dicts of such
            objects are also allowed.
        inplace : bool, default False
            If True, in place. Note: this will modify any
            other views on this object (e.g. a column from a DataFrame).
            Returns the caller if this is True.
        limit : int, default None
            Maximum size gap to forward or backward fill.
        regex : bool or same types as `to_replace`, default False
            Whether to interpret `to_replace` and/or `value` as regular
            expressions. If this is ``True`` then `to_replace` *must* be a
            string. Alternatively, this could be a regular expression or a
            list, dict, or array of regular expressions in which case
            `to_replace` must be ``None``.
        method : {'pad', 'ffill', 'bfill', `None`}
            The method to use when for replacement, when `to_replace` is a
            scalar, list or tuple and `value` is ``None``.

            .. versionchanged:: 0.23.0
                Added to DataFrame.

        Returns
        -------
        %(klass)s
            Object after replacement.

        Raises
        ------
        AssertionError
            * If `regex` is not a ``bool`` and `to_replace` is not
              ``None``.
        TypeError
            * If `to_replace` is a ``dict`` and `value` is not a ``list``,
              ``dict``, ``ndarray``, or ``Series``
            * If `to_replace` is ``None`` and `regex` is not compilable
              into a regular expression or is a list, dict, ndarray, or
              Series.
            * When replacing multiple ``bool`` or ``datetime64`` objects and
              the arguments to `to_replace` does not match the type of the
              value being replaced
        ValueError
            * If a ``list`` or an ``ndarray`` is passed to `to_replace` and
              `value` but they are not the same length.

        See Also
        --------
        %(klass)s.fillna : Fill NA values.
        %(klass)s.where : Replace values based on boolean condition.
        Series.str.replace : Simple string replacement.

        Notes
        -----
        * Regex substitution is performed under the hood with ``re.sub``. The
          rules for substitution for ``re.sub`` are the same.
        * Regular expressions will only substitute on strings, meaning you
          cannot provide, for example, a regular expression matching floating
          point numbers and expect the columns in your frame that have a
          numeric dtype to be matched. However, if those floating point
          numbers *are* strings, then you can do this.
        * This method has *a lot* of options. You are encouraged to experiment
          and play with this method to gain intuition about how it works.
        * When dict is used as the `to_replace` value, it is like
          key(s) in the dict are the to_replace part and
          value(s) in the dict are the value parameter.

        Examples
        --------

        **Scalar `to_replace` and `value`**

        >>> s = pd.Series([0, 1, 2, 3, 4])
        >>> s.replace(0, 5)
        0    5
        1    1
        2    2
        3    3
        4    4
        dtype: int64

        >>> df = pd.DataFrame({'A': [0, 1, 2, 3, 4],
        ...                    'B': [5, 6, 7, 8, 9],
        ...                    'C': ['a', 'b', 'c', 'd', 'e']})
        >>> df.replace(0, 5)
           A  B  C
        0  5  5  a
        1  1  6  b
        2  2  7  c
        3  3  8  d
        4  4  9  e

        **List-like `to_replace`**

        >>> df.replace([0, 1, 2, 3], 4)
           A  B  C
        0  4  5  a
        1  4  6  b
        2  4  7  c
        3  4  8  d
        4  4  9  e

        >>> df.replace([0, 1, 2, 3], [4, 3, 2, 1])
           A  B  C
        0  4  5  a
        1  3  6  b
        2  2  7  c
        3  1  8  d
        4  4  9  e

        >>> s.replace([1, 2], method='bfill')
        0    0
        1    3
        2    3
        3    3
        4    4
        dtype: int64

        **dict-like `to_replace`**

        >>> df.replace({0: 10, 1: 100})
             A  B  C
        0   10  5  a
        1  100  6  b
        2    2  7  c
        3    3  8  d
        4    4  9  e

        >>> df.replace({'A': 0, 'B': 5}, 100)
             A    B  C
        0  100  100  a
        1    1    6  b
        2    2    7  c
        3    3    8  d
        4    4    9  e

        >>> df.replace({'A': {0: 100, 4: 400}})
             A  B  C
        0  100  5  a
        1    1  6  b
        2    2  7  c
        3    3  8  d
        4  400  9  e

        **Regular expression `to_replace`**

        >>> df = pd.DataFrame({'A': ['bat', 'foo', 'bait'],
        ...                    'B': ['abc', 'bar', 'xyz']})
        >>> df.replace(to_replace=r'^ba.$', value='new', regex=True)
              A    B
        0   new  abc
        1   foo  new
        2  bait  xyz

        >>> df.replace({'A': r'^ba.$'}, {'A': 'new'}, regex=True)
              A    B
        0   new  abc
        1   foo  bar
        2  bait  xyz

        >>> df.replace(regex=r'^ba.$', value='new')
              A    B
        0   new  abc
        1   foo  new
        2  bait  xyz

        >>> df.replace(regex={r'^ba.$': 'new', 'foo': 'xyz'})
              A    B
        0   new  abc
        1   xyz  new
        2  bait  xyz

        >>> df.replace(regex=[r'^ba.$', 'foo'], value='new')
              A    B
        0   new  abc
        1   new  new
        2  bait  xyz

        Note that when replacing multiple ``bool`` or ``datetime64`` objects,
        the data types in the `to_replace` parameter must match the data
        type of the value being replaced:

        >>> df = pd.DataFrame({'A': [True, False, True],
        ...                    'B': [False, True, False]})
        >>> df.replace({'a string': 'new value', True: False})  # raises
        Traceback (most recent call last):
            ...
        TypeError: Cannot compare types 'ndarray(dtype=bool)' and 'str'

        This raises a ``TypeError`` because one of the ``dict`` keys is not of
        the correct type for replacement.

        Compare the behavior of ``s.replace({'a': None})`` and
        ``s.replace('a', None)`` to understand the peculiarities
        of the `to_replace` parameter:

        >>> s = pd.Series([10, 'a', 'a', 'b', 'a'])

        When one uses a dict as the `to_replace` value, it is like the
        value(s) in the dict are equal to the `value` parameter.
        ``s.replace({'a': None})`` is equivalent to
        ``s.replace(to_replace={'a': None}, value=None, method=None)``:

        >>> s.replace({'a': None})
        0      10
        1    None
        2    None
        3       b
        4    None
        dtype: object

        When ``value=None`` and `to_replace` is a scalar, list or
        tuple, `replace` uses the method parameter (default 'pad') to do the
        replacement. So this is why the 'a' values are being replaced by 10
        in rows 1 and 2 and 'b' in row 4 in this case.
        The command ``s.replace('a', None)`` is actually equivalent to
        ``s.replace(to_replace='a', value=None, method='pad')``:

        >>> s.replace('a', None)
        0    10
        1    10
        2    10
        3     b
        4     b
        dtype: object
    RN  t   padc         C   s  t  | d  } t |  r7 | d  k	 r7 t d   n  |  j   | d  k rIt |  rs t |  rs | g } n  t | t t f  r t |  t	 j
  r |  j t d | | | | f St |  | | | |  St |  st |  s t d   n  | } t } n  t t j |   } t |   p/g  g  f \ } }	 g  |	 D] }
 t |
  ^ q?} t |  rt |  s~t d   n  i  } i  } x} | D]u \ } }
 t |
 j     pg  g  f \ } }	 t |  t |	  @rt d   n  t |  | | <t |	  | | <qW| | } } n | |	 } } |  j | | d | d | d | Sx* |  j D] } t |  j |   sS|  SqSW|  j } t |  rt |  r(| r|  n	 |  j   } xh t j |  D]W \ } } | | k r| |  k r| | j d	 | d
 | | d t d |  | | <qqW| r$d  S| St |  sg  t j |  D]$ \ } } | |  k rD| | f ^ qD} t |  d } xn t |  D]Q \ } \ } } | | k } | j d	 | d
 | d | g d | d | d |  } qWqt d   nt |  rt |  rqt |  t |  k rGt d t |  t |  f   n  |  j j  d | d | d | d |  } q|  j j d	 | d
 | d | d |  } nA| d  k rt! |  pt |  pt |  st d j" t# |  j$    n  |  j | | d | d | d t St |  r|  j } x t j |  D]H \ } }
 | |  k r3| j d	 | d
 |
 d | g d | d |  } q3q3WnZ t |  s|  j j d	 | d
 | d | d |  } n$ d j" t# |  j$  } t |   | r|  j% |  n |  j& |  j' |   Sd  S(   NR]   s4   'to_replace' must be 'None' if 'regex' is not a boolR   sf   If "to_replace" and "value" are both None and "to_replace" is not a list, then regex must be a mappingsS   If a nested mapping is passed, all values of the top level mapping must be mappingss8   Replacement not allowed with overlapping keys and valuesRH   RG  R[   R  i   RJ  R  s.   value argument must be scalar, dict, or Seriess<   Replacement lists must match in length. Expecting %d got %d t   src_listt	   dest_lists   'regex' must be a string or a compiled regular expression or a list or dict of strings or regular expressions, you passed a {0!r}s    Invalid "to_replace" type: {0!r}((   R   R   Rs   R   R  R   R   R   R   RU   RQ  t   applyRa   RM   R   R  RO  R   R2  R  R~   R   R   RN  R   R   R   RY   RQ   R   R    Ru   t   replace_listR%   RN   RO   RP   RX   R   RW   (   RZ   R[   R  R]   RH   RG  R\   R~   R  RT   R   t   are_mappingst   to_rep_dictt
   value_dictR   R   R
  R  Rf  t   srct   keys_lenR{   R  R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRN  '  s    
	
	$	
			s  
        Please note that only ``method='linear'`` is supported for
        DataFrame/Series with a MultiIndex.

        Parameters
        ----------
        method : str, default 'linear'
            Interpolation technique to use. One of:

            * 'linear': Ignore the index and treat the values as equally
              spaced. This is the only method supported on MultiIndexes.
            * 'time': Works on daily and higher resolution data to interpolate
              given length of interval.
            * 'index', 'values': use the actual numerical values of the index.
            * 'pad': Fill in NaNs using existing values.
            * 'nearest', 'zero', 'slinear', 'quadratic', 'cubic', 'spline',
              'barycentric', 'polynomial': Passed to
              `scipy.interpolate.interp1d`. Both 'polynomial' and 'spline'
              require that you also specify an `order` (int),
              e.g. ``df.interpolate(method='polynomial', order=4)``.
              These use the numerical values of the index.
            * 'krogh', 'piecewise_polynomial', 'spline', 'pchip', 'akima':
              Wrappers around the SciPy interpolation methods of similar
              names. See `Notes`.
            * 'from_derivatives': Refers to
              `scipy.interpolate.BPoly.from_derivatives` which
              replaces 'piecewise_polynomial' interpolation method in
              scipy 0.18.

            .. versionadded:: 0.18.1

               Added support for the 'akima' method.
               Added interpolate method 'from_derivatives' which replaces
               'piecewise_polynomial' in SciPy 0.18; backwards-compatible with
               SciPy < 0.18

        axis : {0 or 'index', 1 or 'columns', None}, default None
            Axis to interpolate along.
        limit : int, optional
            Maximum number of consecutive NaNs to fill. Must be greater than
            0.
        inplace : bool, default False
            Update the data in place if possible.
        limit_direction : {'forward', 'backward', 'both'}, default 'forward'
            If limit is specified, consecutive NaNs will be filled in this
            direction.
        limit_area : {`None`, 'inside', 'outside'}, default None
            If limit is specified, consecutive NaNs will be filled with this
            restriction.

            * ``None``: No fill restriction.
            * 'inside': Only fill NaNs surrounded by valid values
              (interpolate).
            * 'outside': Only fill NaNs outside valid values (extrapolate).

            .. versionadded:: 0.21.0

        downcast : optional, 'infer' or None, defaults to None
            Downcast dtypes if possible.
        **kwargs
            Keyword arguments to pass on to the interpolating function.

        Returns
        -------
        Series or DataFrame
            Returns the same object type as the caller, interpolated at
            some or all ``NaN`` values

        See Also
        --------
        fillna : Fill missing values using different methods.
        scipy.interpolate.Akima1DInterpolator : Piecewise cubic polynomials
            (Akima interpolator).
        scipy.interpolate.BPoly.from_derivatives : Piecewise polynomial in the
            Bernstein basis.
        scipy.interpolate.interp1d : Interpolate a 1-D function.
        scipy.interpolate.KroghInterpolator : Interpolate polynomial (Krogh
            interpolator).
        scipy.interpolate.PchipInterpolator : PCHIP 1-d monotonic cubic
            interpolation.
        scipy.interpolate.CubicSpline : Cubic spline data interpolator.

        Notes
        -----
        The 'krogh', 'piecewise_polynomial', 'spline', 'pchip' and 'akima'
        methods are wrappers around the respective SciPy implementations of
        similar names. These use the actual numerical values of the index.
        For more information on their behavior, see the
        `SciPy documentation
        <http://docs.scipy.org/doc/scipy/reference/interpolate.html#univariate-interpolation>`__
        and `SciPy tutorial
        <http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html>`__.

        Examples
        --------
        Filling in ``NaN`` in a :class:`~pandas.Series` via linear
        interpolation.

        >>> s = pd.Series([0, 1, np.nan, 3])
        >>> s
        0    0.0
        1    1.0
        2    NaN
        3    3.0
        dtype: float64
        >>> s.interpolate()
        0    0.0
        1    1.0
        2    2.0
        3    3.0
        dtype: float64

        Filling in ``NaN`` in a Series by padding, but filling at most two
        consecutive ``NaN`` at a time.

        >>> s = pd.Series([np.nan, "single_one", np.nan,
        ...                "fill_two_more", np.nan, np.nan, np.nan,
        ...                4.71, np.nan])
        >>> s
        0              NaN
        1       single_one
        2              NaN
        3    fill_two_more
        4              NaN
        5              NaN
        6              NaN
        7             4.71
        8              NaN
        dtype: object
        >>> s.interpolate(method='pad', limit=2)
        0              NaN
        1       single_one
        2       single_one
        3    fill_two_more
        4    fill_two_more
        5    fill_two_more
        6              NaN
        7             4.71
        8             4.71
        dtype: object

        Filling in ``NaN`` in a Series via polynomial interpolation or splines:
        Both 'polynomial' and 'spline' methods require that you also specify
        an ``order`` (int).

        >>> s = pd.Series([0, 2, np.nan, 8])
        >>> s.interpolate(method='polynomial', order=2)
        0    0.000000
        1    2.000000
        2    4.666667
        3    8.000000
        dtype: float64

        Fill the DataFrame forward (that is, going down) along each column
        using linear interpolation.

        Note how the last entry in column 'a' is interpolated differently,
        because there is no entry after it to use for interpolation.
        Note how the first entry in column 'b' remains ``NaN``, because there
        is no entry befofe it to use for interpolation.

        >>> df = pd.DataFrame([(0.0,  np.nan, -1.0, 1.0),
        ...                    (np.nan, 2.0, np.nan, np.nan),
        ...                    (2.0, 3.0, np.nan, 9.0),
        ...                    (np.nan, 4.0, -4.0, 16.0)],
        ...                   columns=list('abcd'))
        >>> df
             a    b    c     d
        0  0.0  NaN -1.0   1.0
        1  NaN  2.0  NaN   NaN
        2  2.0  3.0  NaN   9.0
        3  NaN  4.0 -4.0  16.0
        >>> df.interpolate(method='linear', limit_direction='forward', axis=0)
             a    b    c     d
        0  0.0  NaN -1.0   1.0
        1  1.0  2.0 -2.0   5.0
        2  2.0  3.0 -3.0   9.0
        3  2.0  4.0 -4.0  16.0

        Using polynomial interpolation.

        >>> df['d'].interpolate(method='polynomial', order=2)
        0     1.0
        1     4.0
        2     9.0
        3    16.0
        Name: d, dtype: float64
        R  t   lineart   forwardc         K   s   t  | d  } |  j d k r- t d   n  | d k rK |  j }	 |  }
 n$ | d k ri |  j }
 d }	 n |  }
 |
 j |	  }	 |
 j d k r d |	 } n |	 } t |
 j t  r | d k r t	 d   n  |
 j
 j   j d  t |
 j  k rt d	   n  | d k r0t j t |
 j |    } n |
 j |  } t |  j   r`t d
   n  |
 j
 } | j d | d |	 d | d |
 d | d | d | d | d | |  	} | r| d k r|  j |  j j
 } n  |  j |  n4 |  j |  j |   } | d k r| j } n  | Sd S(   sD   
        Interpolate values according to different methods.
        R]   i   sC   Interpolate has not been implemented on Panel and Panel 4D objects.i    i   R  s@   Only `method=linear` interpolation is supported on MultiIndexes.Rw   sv   Cannot interpolate with all object-dtype columns in the DataFrame. Try setting at least one column to a numeric dtype.sk   Interpolation with NaNs in the index has not been implemented. Try filling those NaNs before interpolating.R\   Rr   RJ   RT   RH   t   limit_directiont
   limit_areaR  N(   R   RL   R   R   R  R   R   RJ   R6   R   RY   R  R   R   RM   R   t   arangeR   R-   R2  R  R   RX   RW   (   RZ   R\   Rr   RH   R]   R  R  R  R   R|   t   _maybe_transposed_selft   alt_axRJ   Ry   R
  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  {  sP    				!			c         C   sJ  t  | t j  r1 d d l m } | |  } n  |  j j sL t d   n  t  |  t  } | r | d k	 r t d   q n` |  j
 d k r t d j d t |      n0 | d k r |  j } n  t |  s | g } n  t |  } | s|  j d } t  |  j t  r7t | d	 |  j j j } | j } n  | | k  rv| sod d
 l m } | d |  j d |  St j S| r|  j j | d d } | d k r| d 8} n  |  j }	 x* | d k rt |	 |  r| d 8} qW|	 | Sn  t  | t  s!| rt |  n t | g  } n  | r3|  j   n |  | j   j d  }
 |
 j   r| r}|  j t j d | d |  j S| rd d l m } | t j d | d |  j Sd d
 l m } | t j d |  j d | d Sn  |  j j  | |
 j!  } | d k } |  j" | d t# } | | _ t j | j$ | <| r?| S| j% d S(   sm  
        Return the last row(s) without any NaNs before `where`.

        The last row (for each element in `where`, if list) without any
        NaN is taken.
        In case of a :class:`~pandas.DataFrame`, the last row without NaN
        considering only the subset of columns (if not `None`)

        .. versionadded:: 0.19.0 For DataFrame

        If there is no good value, NaN is returned for a Series or
        a Series of NaN values for a DataFrame

        Parameters
        ----------
        where : date or array-like of dates
            Date(s) before which the last row(s) are returned.
        subset : str or array-like of str, default `None`
            For DataFrame, if not `None`, only use these columns to
            check for NaNs.

        Returns
        -------
        scalar, Series, or DataFrame

           * scalar : when `self` is a Series and `where` is a scalar
           * Series: when `self` is a Series and `where` is an array-like,
             or when `self` is a DataFrame and `where` is a scalar
           * DataFrame : when `self` is a DataFrame and `where` is an
             array-like

        See Also
        --------
        merge_asof : Perform an asof merge. Similar to left join.

        Notes
        -----
        Dates are assumed to be sorted. Raises if this is not the case.

        Examples
        --------
        A Series and a scalar `where`.

        >>> s = pd.Series([1, 2, np.nan, 4], index=[10, 20, 30, 40])
        >>> s
        10    1.0
        20    2.0
        30    NaN
        40    4.0
        dtype: float64

        >>> s.asof(20)
        2.0

        For a sequence `where`, a Series is returned. The first value is
        NaN, because the first element of `where` is before the first
        index value.

        >>> s.asof([5, 20])
        5     NaN
        20    2.0
        dtype: float64

        Missing values are not considered. The following is ``2.0``, not
        NaN, even though NaN is at the index location for ``30``.

        >>> s.asof(30)
        2.0

        Take all columns into consideration

        >>> df = pd.DataFrame({'a': [10, 20, 30, 40, 50],
        ...                    'b': [None, None, None, None, 500]},
        ...                   index=pd.DatetimeIndex(['2018-02-27 09:01:00',
        ...                                           '2018-02-27 09:02:00',
        ...                                           '2018-02-27 09:03:00',
        ...                                           '2018-02-27 09:04:00',
        ...                                           '2018-02-27 09:05:00']))
        >>> df.asof(pd.DatetimeIndex(['2018-02-27 09:03:30',
        ...                           '2018-02-27 09:04:30']))
                              a   b
        2018-02-27 09:03:30 NaN NaN
        2018-02-27 09:04:30 NaN NaN

        Take a single column into consideration

        >>> df.asof(pd.DatetimeIndex(['2018-02-27 09:03:30',
        ...                           '2018-02-27 09:04:30']),
        ...         subset=['a'])
                                 a   b
        2018-02-27 09:03:30   30.0 NaN
        2018-02-27 09:04:30   40.0 NaN
        i(   t   to_datetimes   asof requires a sorted indexs   subset is not valid for Seriesi   s"   asof is not implemented for {type}RO   i    t   freq(   RV   RJ   R   t   sidet   righti   (   RQ  RF  Rq   N(&   R   R  R   R  R  RJ   t   is_monotonicR   R+   Rs   RL   R   RN   RO   RF  R    R;   R:   R  t   ordinalRV   R   t   nant   searchsortedR@  R-   R4   R2  R  R   R   RQ  t	   asof_locsRT   R  R   R  R  (   RZ   R  t   subsetR  t	   is_seriest   is_listt   startRV   R  RT   t   nullsRQ  RZ  R0   Ry   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   asof  sh    ^	$+#	sq  
        Detect missing values.

        Return a boolean same-sized object indicating if the values are NA.
        NA values, such as None or :attr:`numpy.NaN`, gets mapped to True
        values.
        Everything else gets mapped to False values. Characters such as empty
        strings ``''`` or :attr:`numpy.inf` are not considered NA values
        (unless you set ``pandas.options.mode.use_inf_as_na = True``).

        Returns
        -------
        %(klass)s
            Mask of bool values for each element in %(klass)s that
            indicates whether an element is not an NA value.

        See Also
        --------
        %(klass)s.isnull : Alias of isna.
        %(klass)s.notna : Boolean inverse of isna.
        %(klass)s.dropna : Omit axes labels with missing values.
        isna : Top-level isna.

        Examples
        --------
        Show which entries in a DataFrame are NA.

        >>> df = pd.DataFrame({'age': [5, 6, np.NaN],
        ...                    'born': [pd.NaT, pd.Timestamp('1939-05-27'),
        ...                             pd.Timestamp('1940-04-25')],
        ...                    'name': ['Alfred', 'Batman', ''],
        ...                    'toy': [None, 'Batmobile', 'Joker']})
        >>> df
           age       born    name        toy
        0  5.0        NaT  Alfred       None
        1  6.0 1939-05-27  Batman  Batmobile
        2  NaN 1940-04-25              Joker

        >>> df.isna()
             age   born   name    toy
        0  False   True  False   True
        1  False  False  False  False
        2   True  False  False  False

        Show which entries in a Series are NA.

        >>> ser = pd.Series([5, 6, np.NaN])
        >>> ser
        0    5.0
        1    6.0
        2    NaN
        dtype: float64

        >>> ser.isna()
        0    False
        1    False
        2     True
        dtype: bool
        R-   c         C   s   t  |   j |   S(   N(   R-   RW   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR-     s    c         C   s   t  |   j |   S(   N(   R-   RW   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   isnull  s    s  
        Detect existing (non-missing) values.

        Return a boolean same-sized object indicating if the values are not NA.
        Non-missing values get mapped to True. Characters such as empty
        strings ``''`` or :attr:`numpy.inf` are not considered NA values
        (unless you set ``pandas.options.mode.use_inf_as_na = True``).
        NA values, such as None or :attr:`numpy.NaN`, get mapped to False
        values.

        Returns
        -------
        %(klass)s
            Mask of bool values for each element in %(klass)s that
            indicates whether an element is not an NA value.

        See Also
        --------
        %(klass)s.notnull : Alias of notna.
        %(klass)s.isna : Boolean inverse of notna.
        %(klass)s.dropna : Omit axes labels with missing values.
        notna : Top-level notna.

        Examples
        --------
        Show which entries in a DataFrame are not NA.

        >>> df = pd.DataFrame({'age': [5, 6, np.NaN],
        ...                    'born': [pd.NaT, pd.Timestamp('1939-05-27'),
        ...                             pd.Timestamp('1940-04-25')],
        ...                    'name': ['Alfred', 'Batman', ''],
        ...                    'toy': [None, 'Batmobile', 'Joker']})
        >>> df
           age       born    name        toy
        0  5.0        NaT  Alfred       None
        1  6.0 1939-05-27  Batman  Batmobile
        2  NaN 1940-04-25              Joker

        >>> df.notna()
             age   born  name    toy
        0   True  False  True  False
        1   True   True  True   True
        2  False   True  True   True

        Show which entries in a Series are not NA.

        >>> ser = pd.Series([5, 6, np.NaN])
        >>> ser
        0    5.0
        1    6.0
        2    NaN
        dtype: float64

        >>> ser.notna()
        0     True
        1     True
        2    False
        dtype: bool
        R.   c         C   s   t  |   j |   S(   N(   R.   RW   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR.     s    c         C   s   t  |   j |   S(   N(   R.   RW   (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   notnull  s    c         C   s:  | d  k	 r! t j t |   sB | d  k	 rQ t j t |   rQ t d   n  |  } t |  j  } t j d d   | d  k	 r |  j   | k } | j | | d d  d t	 } n  | d  k	 r |  j   | k } | j | | d d  d t	 } n  Wd  QXt j |  rt j
 | | <n  | r2|  j |  n | Sd  S(   Ns*   Cannot use an NA value as a clip thresholdR  t   ignoreRr   R]   (   Rs   R   R2  R-   R   RT   t   errstatet   to_numpyR  R   R  RX   (   RZ   R   t   upperR]   R_   RI   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _clip_with_scalar  s"    !!!'c         C   s  | d  k	 r |  j |  } n  t |  rq t |  rq | j d k r[ |  j d  | d | S|  j | d  d | S| | d | t |   B} t | t  r t	 |  r t |  t  r t
 j | d |  j } q t |  | |  } n  |  j | | d | d | S(   Nt   leR]   Rr   RJ   (   Rs   R   R&   R!   RP   R  R-   R   R+   R    RU   RV   RJ   R=   R  (   RZ   t	   thresholdR\   Rr   R]   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _clip_with_one_bound  s    	c         O   s  t  |  t  r t d   n  t | d  } t j | | |  } | d k	 r` |  j |  } n  t |  r t	 j
 t j |   r d } n  t |  r t	 j
 t j |   r d } n  | d k	 r| d k	 rt |  rt |  rt | |  t | |  } } qn  | d k s5t |  rot |  ro| d k sYt |  rot |  ro|  j | | d | S|  } | d k	 r| j | d |  j d | d | } n  | d k	 r| r|  } n  | j | d |  j d | d | } n  | S(   sI  
        Trim values at input threshold(s).

        Assigns values outside boundary to boundary values. Thresholds
        can be singular values or array like, and in the latter case
        the clipping is performed element-wise in the specified axis.

        Parameters
        ----------
        lower : float or array_like, default None
            Minimum threshold value. All values below this
            threshold will be set to it.
        upper : float or array_like, default None
            Maximum threshold value. All values above this
            threshold will be set to it.
        axis : int or string axis name, optional
            Align object with lower and upper along the given axis.
        inplace : boolean, default False
            Whether to perform the operation in place on the data.

            .. versionadded:: 0.21.0
        *args, **kwargs
            Additional keywords have no effect but might be accepted
            for compatibility with numpy.

        Returns
        -------
        Series or DataFrame
            Same type as calling object with the values outside the
            clip boundaries replaced

        Examples
        --------
        >>> data = {'col_0': [9, -3, 0, -1, 5], 'col_1': [-2, -7, 6, 8, -5]}
        >>> df = pd.DataFrame(data)
        >>> df
           col_0  col_1
        0      9     -2
        1     -3     -7
        2      0      6
        3     -1      8
        4      5     -5

        Clips per column using lower and upper thresholds:

        >>> df.clip(-4, 6)
           col_0  col_1
        0      6     -2
        1     -3     -4
        2      0      6
        3     -1      6
        4      5     -4

        Clips using specific lower and upper thresholds per column element:

        >>> t = pd.Series([2, -4, -1, 6, 3])
        >>> t
        0    2
        1   -4
        2   -1
        3    6
        4    3
        dtype: int64

        >>> df.clip(t, t + 4, axis=0)
           col_0  col_1
        0      6      2
        1     -3     -4
        2      0      3
        3      6      8
        4      5      3
        s$   clip is not supported yet for panelsR]   R\   Rr   N(   R   R*   R   R   R   t   validate_clip_with_axisRs   R   R    R   R2  RU   R  R&   t   mint   maxR!   R  R  t   geR  (   RZ   R   R  Rr   R]   R   R   R_   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   clip#  s4    J%	%	%$$	c         C   s8   t  j d t d d |  j | d |  j d | d | S(   sY  
        Trim values above a given threshold.

        .. deprecated:: 0.24.0
            Use clip(upper=threshold) instead.

        Elements above the `threshold` will be changed to match the
        `threshold` value(s). Threshold can be a single value or an array,
        in the latter case it performs the truncation element-wise.

        Parameters
        ----------
        threshold : numeric or array-like
            Maximum value allowed. All values above threshold will be set to
            this value.

            * float : every value is compared to `threshold`.
            * array-like : The shape of `threshold` should match the object
              it's compared to. When `self` is a Series, `threshold` should be
              the length. When `self` is a DataFrame, `threshold` should 2-D
              and the same shape as `self` for ``axis=None``, or 1-D and the
              same length as the axis being compared.

        axis : {0 or 'index', 1 or 'columns'}, default 0
            Align object with `threshold` along the given axis.
        inplace : boolean, default False
            Whether to perform the operation in place on the data.

            .. versionadded:: 0.21.0

        Returns
        -------
        Series or DataFrame
            Original data with values trimmed.

        See Also
        --------
        Series.clip : General purpose method to trim Series values to given
            threshold(s).
        DataFrame.clip : General purpose method to trim DataFrame values to
            given threshold(s).

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4, 5])
        >>> s
        0    1
        1    2
        2    3
        3    4
        4    5
        dtype: int64

        >>> s.clip(upper=3)
        0    1
        1    2
        2    3
        3    3
        4    3
        dtype: int64

        >>> elemwise_thresholds = [5, 4, 3, 2, 1]
        >>> elemwise_thresholds
        [5, 4, 3, 2, 1]

        >>> s.clip(upper=elemwise_thresholds)
        0    1
        1    2
        2    3
        3    2
        4    1
        dtype: int64
        sF   clip_upper(threshold) is deprecated, use clip(upper=threshold) insteadR   i   R\   Rr   R]   (   R   R   R   R  R  (   RZ   R  Rr   R]   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   clip_upper  s    J	c         C   s8   t  j d t d d |  j | d |  j d | d | S(   s  
        Trim values below a given threshold.

        .. deprecated:: 0.24.0
            Use clip(lower=threshold) instead.

        Elements below the `threshold` will be changed to match the
        `threshold` value(s). Threshold can be a single value or an array,
        in the latter case it performs the truncation element-wise.

        Parameters
        ----------
        threshold : numeric or array-like
            Minimum value allowed. All values below threshold will be set to
            this value.

            * float : every value is compared to `threshold`.
            * array-like : The shape of `threshold` should match the object
              it's compared to. When `self` is a Series, `threshold` should be
              the length. When `self` is a DataFrame, `threshold` should 2-D
              and the same shape as `self` for ``axis=None``, or 1-D and the
              same length as the axis being compared.

        axis : {0 or 'index', 1 or 'columns'}, default 0
            Align `self` with `threshold` along the given axis.

        inplace : boolean, default False
            Whether to perform the operation in place on the data.

            .. versionadded:: 0.21.0

        Returns
        -------
        Series or DataFrame
            Original data with values trimmed.

        See Also
        --------
        Series.clip : General purpose method to trim Series values to given
            threshold(s).
        DataFrame.clip : General purpose method to trim DataFrame values to
            given threshold(s).

        Examples
        --------

        Series single threshold clipping:

        >>> s = pd.Series([5, 6, 7, 8, 9])
        >>> s.clip(lower=8)
        0    8
        1    8
        2    8
        3    8
        4    9
        dtype: int64

        Series clipping element-wise using an array of thresholds. `threshold`
        should be the same length as the Series.

        >>> elemwise_thresholds = [4, 8, 7, 2, 5]
        >>> s.clip(lower=elemwise_thresholds)
        0    5
        1    8
        2    7
        3    8
        4    9
        dtype: int64

        DataFrames can be compared to a scalar.

        >>> df = pd.DataFrame({"A": [1, 3, 5], "B": [2, 4, 6]})
        >>> df
           A  B
        0  1  2
        1  3  4
        2  5  6

        >>> df.clip(lower=3)
           A  B
        0  3  3
        1  3  4
        2  5  6

        Or to an array of values. By default, `threshold` should be the same
        shape as the DataFrame.

        >>> df.clip(lower=np.array([[3, 4], [2, 2], [6, 2]]))
           A  B
        0  3  4
        1  3  4
        2  6  6

        Control how `threshold` is broadcast with `axis`. In this case
        `threshold` should be the same length as the axis specified by
        `axis`.

        >>> df.clip(lower=[3, 3, 5], axis='index')
           A  B
        0  3  3
        1  3  4
        2  5  6

        >>> df.clip(lower=[4, 5], axis='columns')
           A  B
        0  4  5
        1  4  5
        2  5  6
        sF   clip_lower(threshold) is deprecated, use clip(lower=threshold) insteadR   i   R\   Rr   R]   (   R   R   R   R  R  (   RZ   R  Rr   R]   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt
   clip_lower  s    n	c	         K   s   d d l  m }
 | d k r7 | d k r7 t d   n  |  j |  } |
 |  d | d | d | d | d | d	 | d
 | d | |	 S(   s  
        Group DataFrame or Series using a mapper or by a Series of columns.

        A groupby operation involves some combination of splitting the
        object, applying a function, and combining the results. This can be
        used to group large amounts of data and compute operations on these
        groups.

        Parameters
        ----------
        by : mapping, function, label, or list of labels
            Used to determine the groups for the groupby.
            If ``by`` is a function, it's called on each value of the object's
            index. If a dict or Series is passed, the Series or dict VALUES
            will be used to determine the groups (the Series' values are first
            aligned; see ``.align()`` method). If an ndarray is passed, the
            values are used as-is determine the groups. A label or list of
            labels may be passed to group by the columns in ``self``. Notice
            that a tuple is interpreted a (single) key.
        axis : {0 or 'index', 1 or 'columns'}, default 0
            Split along rows (0) or columns (1).
        level : int, level name, or sequence of such, default None
            If the axis is a MultiIndex (hierarchical), group by a particular
            level or levels.
        as_index : bool, default True
            For aggregated output, return object with group labels as the
            index. Only relevant for DataFrame input. as_index=False is
            effectively "SQL-style" grouped output.
        sort : bool, default True
            Sort group keys. Get better performance by turning this off.
            Note this does not influence the order of observations within each
            group. Groupby preserves the order of rows within each group.
        group_keys : bool, default True
            When calling apply, add group keys to index to identify pieces.
        squeeze : bool, default False
            Reduce the dimensionality of the return type if possible,
            otherwise return a consistent type.
        observed : bool, default False
            This only applies if any of the groupers are Categoricals.
            If True: only show observed values for categorical groupers.
            If False: show all values for categorical groupers.

            .. versionadded:: 0.23.0

        **kwargs
            Optional, only accepts keyword argument 'mutated' and is passed
            to groupby.

        Returns
        -------
        DataFrameGroupBy or SeriesGroupBy
            Depends on the calling object and returns groupby object that
            contains information about the groups.

        See Also
        --------
        resample : Convenience method for frequency conversion and resampling
            of time series.

        Notes
        -----
        See the `user guide
        <http://pandas.pydata.org/pandas-docs/stable/groupby.html>`_ for more.

        Examples
        --------
        >>> df = pd.DataFrame({'Animal' : ['Falcon', 'Falcon',
        ...                                'Parrot', 'Parrot'],
        ...                    'Max Speed' : [380., 370., 24., 26.]})
        >>> df
           Animal  Max Speed
        0  Falcon      380.0
        1  Falcon      370.0
        2  Parrot       24.0
        3  Parrot       26.0
        >>> df.groupby(['Animal']).mean()
                Max Speed
        Animal
        Falcon      375.0
        Parrot       25.0

        **Hierarchical Indexes**

        We can groupby different levels of a hierarchical index
        using the `level` parameter:

        >>> arrays = [['Falcon', 'Falcon', 'Parrot', 'Parrot'],
        ...           ['Capitve', 'Wild', 'Capitve', 'Wild']]
        >>> index = pd.MultiIndex.from_arrays(arrays, names=('Animal', 'Type'))
        >>> df = pd.DataFrame({'Max Speed' : [390., 350., 30., 20.]},
        ...                    index=index)
        >>> df
                        Max Speed
        Animal Type
        Falcon Capitve      390.0
               Wild         350.0
        Parrot Capitve       30.0
               Wild          20.0
        >>> df.groupby(level=0).mean()
                Max Speed
        Animal
        Falcon      370.0
        Parrot       25.0
        >>> df.groupby(level=1).mean()
                 Max Speed
        Type
        Capitve      210.0
        Wild         185.0
        i(   t   groupbys*   You have to supply one of 'by' and 'level'R/  Rr   R   t   as_indext   sortt
   group_keysR  t   observedN(   t   pandas.core.groupby.groupbyR  Rs   RM   R   (   RZ   R/  Rr   R   R  R  R  R  R  R   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  Z  s    o!c         C   s5   d d l  m } | |  | d | d | d | d | S(   sI  
        Convert TimeSeries to specified frequency.

        Optionally provide filling method to pad/backfill missing values.

        Returns the original data conformed to a new index with the specified
        frequency. ``resample`` is more appropriate if an operation, such as
        summarization, is necessary to represent the data at the new frequency.

        Parameters
        ----------
        freq : DateOffset object, or string
        method : {'backfill'/'bfill', 'pad'/'ffill'}, default None
            Method to use for filling holes in reindexed Series (note this
            does not fill NaNs that already were present):

            * 'pad' / 'ffill': propagate last valid observation forward to next
              valid
            * 'backfill' / 'bfill': use NEXT valid observation to fill
        how : {'start', 'end'}, default end
            For PeriodIndex only, see PeriodIndex.asfreq
        normalize : bool, default False
            Whether to reset output index to midnight
        fill_value : scalar, optional
            Value to use for missing values, applied during upsampling (note
            this does not fill NaNs that already were present).

            .. versionadded:: 0.20.0

        Returns
        -------
        converted : same type as caller

        See Also
        --------
        reindex

        Notes
        -----
        To learn more about the frequency strings, please see `this link
        <http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases>`__.

        Examples
        --------

        Start by creating a series with 4 one minute timestamps.

        >>> index = pd.date_range('1/1/2000', periods=4, freq='T')
        >>> series = pd.Series([0.0, None, 2.0, 3.0], index=index)
        >>> df = pd.DataFrame({'s':series})
        >>> df
                               s
        2000-01-01 00:00:00    0.0
        2000-01-01 00:01:00    NaN
        2000-01-01 00:02:00    2.0
        2000-01-01 00:03:00    3.0

        Upsample the series into 30 second bins.

        >>> df.asfreq(freq='30S')
                               s
        2000-01-01 00:00:00    0.0
        2000-01-01 00:00:30    NaN
        2000-01-01 00:01:00    NaN
        2000-01-01 00:01:30    NaN
        2000-01-01 00:02:00    2.0
        2000-01-01 00:02:30    NaN
        2000-01-01 00:03:00    3.0

        Upsample again, providing a ``fill value``.

        >>> df.asfreq(freq='30S', fill_value=9.0)
                               s
        2000-01-01 00:00:00    0.0
        2000-01-01 00:00:30    9.0
        2000-01-01 00:01:00    NaN
        2000-01-01 00:01:30    9.0
        2000-01-01 00:02:00    2.0
        2000-01-01 00:02:30    9.0
        2000-01-01 00:03:00    3.0

        Upsample again, providing a ``method``.

        >>> df.asfreq(freq='30S', method='bfill')
                               s
        2000-01-01 00:00:00    0.0
        2000-01-01 00:00:30    NaN
        2000-01-01 00:01:00    NaN
        2000-01-01 00:01:30    2.0
        2000-01-01 00:02:00    2.0
        2000-01-01 00:02:30    3.0
        2000-01-01 00:03:00    3.0
        i(   t   asfreqR\   t   howt	   normalizeR6  (   t   pandas.core.resampleR  (   RZ   R  R\   R  R  R6  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s    _c         C   s   | d k r |  j } n  |  j |  } |  j |  } y | j | d | } Wn t k
 rn t d   n X|  j | d | S(   s  
        Select values at particular time of day (e.g. 9:30AM).

        Parameters
        ----------
        time : datetime.time or string
        axis : {0 or 'index', 1 or 'columns'}, default 0

            .. versionadded:: 0.24.0

        Returns
        -------
        values_at_time : same type as caller

        Raises
        ------
        TypeError
            If the index is not  a :class:`DatetimeIndex`

        See Also
        --------
        between_time : Select values between particular times of the day.
        first : Select initial periods of time series based on a date offset.
        last : Select final periods of time series based on a date offset.
        DatetimeIndex.indexer_at_time : Get just the index locations for
            values at particular time of the day.

        Examples
        --------
        >>> i = pd.date_range('2018-04-09', periods=4, freq='12H')
        >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
        >>> ts
                             A
        2018-04-09 00:00:00  1
        2018-04-09 12:00:00  2
        2018-04-10 00:00:00  3
        2018-04-10 12:00:00  4

        >>> ts.at_time('12:00')
                             A
        2018-04-09 12:00:00  2
        2018-04-10 12:00:00  4
        R  s   Index must be DatetimeIndexRr   N(   Rs   R   R   R   t   indexer_at_timeR   RM   R  (   RZ   t   timeR  Rr   RJ   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   at_time5  s    ,c         C   s   | d k r |  j } n  |  j |  } |  j |  } y" | j | | d | d | } Wn t k
 rw t d   n X|  j | d | S(   s0  
        Select values between particular times of the day (e.g., 9:00-9:30 AM).

        By setting ``start_time`` to be later than ``end_time``,
        you can get the times that are *not* between the two times.

        Parameters
        ----------
        start_time : datetime.time or string
        end_time : datetime.time or string
        include_start : boolean, default True
        include_end : boolean, default True
        axis : {0 or 'index', 1 or 'columns'}, default 0

            .. versionadded:: 0.24.0

        Returns
        -------
        values_between_time : same type as caller

        Raises
        ------
        TypeError
            If the index is not  a :class:`DatetimeIndex`

        See Also
        --------
        at_time : Select values at a particular time of the day.
        first : Select initial periods of time series based on a date offset.
        last : Select final periods of time series based on a date offset.
        DatetimeIndex.indexer_between_time : Get just the index locations for
            values between particular times of the day.

        Examples
        --------
        >>> i = pd.date_range('2018-04-09', periods=4, freq='1D20min')
        >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
        >>> ts
                             A
        2018-04-09 00:00:00  1
        2018-04-10 00:20:00  2
        2018-04-11 00:40:00  3
        2018-04-12 01:00:00  4

        >>> ts.between_time('0:15', '0:45')
                             A
        2018-04-10 00:20:00  2
        2018-04-11 00:40:00  3

        You get the times that are *not* between two times by setting
        ``start_time`` later than ``end_time``:

        >>> ts.between_time('0:45', '0:15')
                             A
        2018-04-09 00:00:00  1
        2018-04-12 01:00:00  4
        t   include_startt   include_ends   Index must be DatetimeIndexRr   N(   Rs   R   R   R   t   indexer_between_timeR   RM   R  (   RZ   t
   start_timet   end_timeR  R  Rr   RJ   R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   between_timem  s    ;R  c         C   s   d d l  m } m } |  j |  } | |  d | d | d | d | d | d |	 d	 | d
 | d | d | 
} | | d | d | d |
 S(   s*  
        Resample time-series data.

        Convenience method for frequency conversion and resampling of time
        series. Object must have a datetime-like index (`DatetimeIndex`,
        `PeriodIndex`, or `TimedeltaIndex`), or pass datetime-like values
        to the `on` or `level` keyword.

        Parameters
        ----------
        rule : str
            The offset string or object representing target conversion.
        how : str
            Method for down/re-sampling, default to 'mean' for downsampling.

            .. deprecated:: 0.18.0
               The new syntax is ``.resample(...).mean()``, or
               ``.resample(...).apply(<func>)``
        axis : {0 or 'index', 1 or 'columns'}, default 0
            Which axis to use for up- or down-sampling. For `Series` this
            will default to 0, i.e. along the rows. Must be
            `DatetimeIndex`, `TimedeltaIndex` or `PeriodIndex`.
        fill_method : str, default None
            Filling method for upsampling.

            .. deprecated:: 0.18.0
               The new syntax is ``.resample(...).<func>()``,
               e.g. ``.resample(...).pad()``
        closed : {'right', 'left'}, default None
            Which side of bin interval is closed. The default is 'left'
            for all frequency offsets except for 'M', 'A', 'Q', 'BM',
            'BA', 'BQ', and 'W' which all have a default of 'right'.
        label : {'right', 'left'}, default None
            Which bin edge label to label bucket with. The default is 'left'
            for all frequency offsets except for 'M', 'A', 'Q', 'BM',
            'BA', 'BQ', and 'W' which all have a default of 'right'.
        convention : {'start', 'end', 's', 'e'}, default 'start'
            For `PeriodIndex` only, controls whether to use the start or
            end of `rule`.
        kind : {'timestamp', 'period'}, optional, default None
            Pass 'timestamp' to convert the resulting index to a
            `DateTimeIndex` or 'period' to convert it to a `PeriodIndex`.
            By default the input representation is retained.
        loffset : timedelta, default None
            Adjust the resampled time labels.
        limit : int, default None
            Maximum size gap when reindexing with `fill_method`.

            .. deprecated:: 0.18.0
        base : int, default 0
            For frequencies that evenly subdivide 1 day, the "origin" of the
            aggregated intervals. For example, for '5min' frequency, base could
            range from 0 through 4. Defaults to 0.
        on : str, optional
            For a DataFrame, column to use instead of index for resampling.
            Column must be datetime-like.

            .. versionadded:: 0.19.0

        level : str or int, optional
            For a MultiIndex, level (name or number) to use for
            resampling. `level` must be datetime-like.

            .. versionadded:: 0.19.0

        Returns
        -------
        Resampler object

        See Also
        --------
        groupby : Group by mapping, function, label, or list of labels.
        Series.resample : Resample a Series.
        DataFrame.resample: Resample a DataFrame.

        Notes
        -----
        See the `user guide
        <http://pandas.pydata.org/pandas-docs/stable/timeseries.html#resampling>`_
        for more.

        To learn more about the offset strings, please see `this link
        <http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases>`__.

        Examples
        --------

        Start by creating a series with 9 one minute timestamps.

        >>> index = pd.date_range('1/1/2000', periods=9, freq='T')
        >>> series = pd.Series(range(9), index=index)
        >>> series
        2000-01-01 00:00:00    0
        2000-01-01 00:01:00    1
        2000-01-01 00:02:00    2
        2000-01-01 00:03:00    3
        2000-01-01 00:04:00    4
        2000-01-01 00:05:00    5
        2000-01-01 00:06:00    6
        2000-01-01 00:07:00    7
        2000-01-01 00:08:00    8
        Freq: T, dtype: int64

        Downsample the series into 3 minute bins and sum the values
        of the timestamps falling into a bin.

        >>> series.resample('3T').sum()
        2000-01-01 00:00:00     3
        2000-01-01 00:03:00    12
        2000-01-01 00:06:00    21
        Freq: 3T, dtype: int64

        Downsample the series into 3 minute bins as above, but label each
        bin using the right edge instead of the left. Please note that the
        value in the bucket used as the label is not included in the bucket,
        which it labels. For example, in the original series the
        bucket ``2000-01-01 00:03:00`` contains the value 3, but the summed
        value in the resampled bucket with the label ``2000-01-01 00:03:00``
        does not include 3 (if it did, the summed value would be 6, not 3).
        To include this value close the right side of the bin interval as
        illustrated in the example below this one.

        >>> series.resample('3T', label='right').sum()
        2000-01-01 00:03:00     3
        2000-01-01 00:06:00    12
        2000-01-01 00:09:00    21
        Freq: 3T, dtype: int64

        Downsample the series into 3 minute bins as above, but close the right
        side of the bin interval.

        >>> series.resample('3T', label='right', closed='right').sum()
        2000-01-01 00:00:00     0
        2000-01-01 00:03:00     6
        2000-01-01 00:06:00    15
        2000-01-01 00:09:00    15
        Freq: 3T, dtype: int64

        Upsample the series into 30 second bins.

        >>> series.resample('30S').asfreq()[0:5]   # Select first 5 rows
        2000-01-01 00:00:00   0.0
        2000-01-01 00:00:30   NaN
        2000-01-01 00:01:00   1.0
        2000-01-01 00:01:30   NaN
        2000-01-01 00:02:00   2.0
        Freq: 30S, dtype: float64

        Upsample the series into 30 second bins and fill the ``NaN``
        values using the ``pad`` method.

        >>> series.resample('30S').pad()[0:5]
        2000-01-01 00:00:00    0
        2000-01-01 00:00:30    0
        2000-01-01 00:01:00    1
        2000-01-01 00:01:30    1
        2000-01-01 00:02:00    2
        Freq: 30S, dtype: int64

        Upsample the series into 30 second bins and fill the
        ``NaN`` values using the ``bfill`` method.

        >>> series.resample('30S').bfill()[0:5]
        2000-01-01 00:00:00    0
        2000-01-01 00:00:30    1
        2000-01-01 00:01:00    1
        2000-01-01 00:01:30    2
        2000-01-01 00:02:00    2
        Freq: 30S, dtype: int64

        Pass a custom function via ``apply``

        >>> def custom_resampler(array_like):
        ...     return np.sum(array_like) + 5
        ...
        >>> series.resample('3T').apply(custom_resampler)
        2000-01-01 00:00:00     8
        2000-01-01 00:03:00    17
        2000-01-01 00:06:00    26
        Freq: 3T, dtype: int64

        For a Series with a PeriodIndex, the keyword `convention` can be
        used to control whether to use the start or end of `rule`.

        Resample a year by quarter using 'start' `convention`. Values are
        assigned to the first quarter of the period.

        >>> s = pd.Series([1, 2], index=pd.period_range('2012-01-01',
        ...                                             freq='A',
        ...                                             periods=2))
        >>> s
        2012    1
        2013    2
        Freq: A-DEC, dtype: int64
        >>> s.resample('Q', convention='start').asfreq()
        2012Q1    1.0
        2012Q2    NaN
        2012Q3    NaN
        2012Q4    NaN
        2013Q1    2.0
        2013Q2    NaN
        2013Q3    NaN
        2013Q4    NaN
        Freq: Q-DEC, dtype: float64

        Resample quarters by month using 'end' `convention`. Values are
        assigned to the last month of the period.

        >>> q = pd.Series([1, 2, 3, 4], index=pd.period_range('2018-01-01',
        ...                                                   freq='Q',
        ...                                                   periods=4))
        >>> q
        2018Q1    1
        2018Q2    2
        2018Q3    3
        2018Q4    4
        Freq: Q-DEC, dtype: int64
        >>> q.resample('M', convention='end').asfreq()
        2018-03    1.0
        2018-04    NaN
        2018-05    NaN
        2018-06    2.0
        2018-07    NaN
        2018-08    NaN
        2018-09    3.0
        2018-10    NaN
        2018-11    NaN
        2018-12    4.0
        Freq: M, dtype: float64

        For DataFrame objects, the keyword `on` can be used to specify the
        column instead of the index for resampling.

        >>> d = dict({'price': [10, 11, 9, 13, 14, 18, 17, 19],
        ...           'volume': [50, 60, 40, 100, 50, 100, 40, 50]})
        >>> df = pd.DataFrame(d)
        >>> df['week_starting'] = pd.date_range('01/01/2018',
        ...                                     periods=8,
        ...                                     freq='W')
        >>> df
           price  volume week_starting
        0     10      50    2018-01-07
        1     11      60    2018-01-14
        2      9      40    2018-01-21
        3     13     100    2018-01-28
        4     14      50    2018-02-04
        5     18     100    2018-02-11
        6     17      40    2018-02-18
        7     19      50    2018-02-25
        >>> df.resample('M', on='week_starting').mean()
                       price  volume
        week_starting
        2018-01-31     10.75    62.5
        2018-02-28     17.00    60.0

        For a DataFrame with MultiIndex, the keyword `level` can be used to
        specify on which level the resampling needs to take place.

        >>> days = pd.date_range('1/1/2000', periods=4, freq='D')
        >>> d2 = dict({'price': [10, 11, 9, 13, 14, 18, 17, 19],
        ...            'volume': [50, 60, 40, 100, 50, 100, 40, 50]})
        >>> df2 = pd.DataFrame(d2,
        ...                    index=pd.MultiIndex.from_product([days,
        ...                                                     ['morning',
        ...                                                      'afternoon']]
        ...                                                     ))
        >>> df2
                              price  volume
        2000-01-01 morning       10      50
                   afternoon     11      60
        2000-01-02 morning        9      40
                   afternoon     13     100
        2000-01-03 morning       14      50
                   afternoon     18     100
        2000-01-04 morning       17      40
                   afternoon     19      50
        >>> df2.resample('D', level=0).sum()
                    price  volume
        2000-01-01     21     110
        2000-01-02     22     140
        2000-01-03     32     150
        2000-01-04     36      90
        i(   t   resamplet   _maybe_process_deprecationsR  R  t   closedRr   R   t   loffsett
   conventiont   baseR   R   R  t   fill_methodRH   (   R  R  R  R   (   RZ   t   ruleR  Rr   R  R  R  R  R   R  RH   R  t   onR   R  R  RI  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR    s      	c         C   s   t  |  j t  s! t d   n  t |  j  d k r: |  St |  } |  j d | } } | j   r t | d  r | |  j k r |  j j | d d } |  j	 |  Sn  |  j
 |  S(   s  
        Convenience method for subsetting initial periods of time series data
        based on a date offset.

        Parameters
        ----------
        offset : string, DateOffset, dateutil.relativedelta

        Returns
        -------
        subset : same type as caller

        Raises
        ------
        TypeError
            If the index is not  a :class:`DatetimeIndex`

        See Also
        --------
        last : Select final periods of time series based on a date offset.
        at_time : Select values at a particular time of the day.
        between_time : Select values between particular times of the day.

        Examples
        --------
        >>> i = pd.date_range('2018-04-09', periods=4, freq='2D')
        >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
        >>> ts
                    A
        2018-04-09  1
        2018-04-11  2
        2018-04-13  3
        2018-04-15  4

        Get the rows for the first 3 days:

        >>> ts.first('3D')
                    A
        2018-04-09  1
        2018-04-11  2

        Notice the data for 3 first calender days were returned, not the first
        3 days observed in the dataset, and therefore data for 2018-04-13 was
        not returned.
        s+   'first' only supports a DatetimeIndex indexi    t   _incR  t   left(   R   RJ   R9   RM   R   RA   t
   isAnchoredR  R  R  R  (   RZ   t   offsett   end_datet   end(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   first  s    .c         C   sz   t  |  j t  s! t d   n  t |  j  d k r: |  St |  } |  j d | } |  j j | d d } |  j | S(   s  
        Convenience method for subsetting final periods of time series data
        based on a date offset.

        Parameters
        ----------
        offset : string, DateOffset, dateutil.relativedelta

        Returns
        -------
        subset : same type as caller

        Raises
        ------
        TypeError
            If the index is not  a :class:`DatetimeIndex`

        See Also
        --------
        first : Select initial periods of time series based on a date offset.
        at_time : Select values at a particular time of the day.
        between_time : Select values between particular times of the day.

        Examples
        --------
        >>> i = pd.date_range('2018-04-09', periods=4, freq='2D')
        >>> ts = pd.DataFrame({'A': [1,2,3,4]}, index=i)
        >>> ts
                    A
        2018-04-09  1
        2018-04-11  2
        2018-04-13  3
        2018-04-15  4

        Get the rows for the last 3 days:

        >>> ts.last('3D')
                    A
        2018-04-13  3
        2018-04-15  4

        Notice the data for 3 last calender days were returned, not the last
        3 observed days in the dataset, and therefore data for 2018-04-11 was
        not returned.
        s*   'last' only supports a DatetimeIndex indexi    iR  R  (   R   RJ   R9   RM   R   RA   R  R  (   RZ   R  t
   start_dateR  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR.      s    .t   averaget   keepc   
         s    j      j d k r3 d } t |   n   d d d h k r] d } t |   n         f d   } | d k r y |   SWq t k
 r t } q Xn  | r  j   }	 n  }	 | |	  S(	   s  
        Compute numerical data ranks (1 through n) along axis. Equal values are
        assigned a rank that is the average of the ranks of those values.

        Parameters
        ----------
        axis : {0 or 'index', 1 or 'columns'}, default 0
            index to direct ranking
        method : {'average', 'min', 'max', 'first', 'dense'}
            * average: average rank of group
            * min: lowest rank in group
            * max: highest rank in group
            * first: ranks assigned in order they appear in the array
            * dense: like 'min', but rank always increases by 1 between groups
        numeric_only : boolean, default None
            Include only float, int, boolean data. Valid only for DataFrame or
            Panel objects
        na_option : {'keep', 'top', 'bottom'}
            * keep: leave NA values where they are
            * top: smallest rank if ascending
            * bottom: smallest rank if descending
        ascending : boolean, default True
            False for ranks by high (1) to low (N)
        pct : boolean, default False
            Computes percentage rank of data

        Returns
        -------
        ranks : same type as caller
        i   s&   rank does not make sense when ndim > 2R  t   topt   bottoms3   na_option must be one of 'keep', 'top', or 'bottom'c            sU   t  j |  j d  d  d   d  d  }  j | |  j    } | j   S(   NRr   R\   R0  t	   na_optiont   pct(   t   algost   rankRT   R   R   RW   (   Ry   t   ranks(   R0  Rr   R\   R  R  RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   ranker   s
    	N(   R   RL   R   R   Rs   RM   R   Rz  (
   RZ   Rr   R\   t   numeric_onlyR  R0  R  R   R  Ry   (    (   R0  Rr   R\   R  R  RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR   Z   s"     	s  
        Align two objects on their axes with the
        specified join method for each axis Index.

        Parameters
        ----------
        other : DataFrame or Series
        join : {'outer', 'inner', 'left', 'right'}, default 'outer'
        axis : allowed axis of the other object, default None
            Align on index (0), columns (1), or both (None)
        level : int or level name, default None
            Broadcast across a level, matching Index values on the
            passed MultiIndex level
        copy : boolean, default True
            Always returns new objects. If copy=False and no reindexing is
            required then original objects are returned.
        fill_value : scalar, default np.NaN
            Value to use for missing values. Defaults to NaN, but can be any
            "compatible" value
        method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
            Method to use for filling holes in reindexed Series
            pad / ffill: propagate last valid observation forward to next valid
            backfill / bfill: use NEXT valid observation to fill gap
        limit : int, default None
            If method is specified, this is the maximum number of consecutive
            NaN values to forward/backward fill. In other words, if there is
            a gap with more than this number of consecutive NaNs, it will only
            be partially filled. If method is not specified, this is the
            maximum number of entries along the entire axis where NaNs will be
            filled. Must be greater than 0 if not None.
        fill_axis : %(axes_single_arg)s, default 0
            Filling axis, method and limit
        broadcast_axis : %(axes_single_arg)s, default None
            Broadcast values along this axis, if aligning two objects of
            different dimensions

        Returns
        -------
        (left, right) : (%(klass)s, type of other)
            Aligned objects
        t   alignt   outerc            s  d d l  m } m } t j |  } |
 d k r@ j   j k r@t  |  r  j } |  f d     j D   j	    } | j
   d | d | d | d | d	 | d
 | d | d |	 St   |  r@  j } |   f d    j D  j	    }  j
 | d | d | d | d | d	 | d
 | d | d |	 Sn  | d  k	 r^ j |  } n  t   |  r j
   d | d | d | d | d	 | d
 | d | d |	 St   |  r j   d | d | d | d | d	 | d
 | d | d |	 St d t      d  S(   Ni(   RQ  RV   i   c            s   i  |  ] }   |  q S(    (    (   R   Rf  (   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>   s   	 Rb  Rr   R   RQ   R6  R\   RH   t	   fill_axisc            s   i  |  ] }   |  q S(    (    (   R   Rf  (   R  (    s2   lib/python2.7/site-packages/pandas/core/generic.pys
   <dictcomp>   s   	 s   unsupported type: %s(   R  RQ  RV   R0   t   clean_fill_methodRL   R   R   RF  R   t   _align_frameRs   R   t   _align_seriesRM   RO   (   RZ   R  Rb  Rr   R   RQ   R6  R\   RH   R  t   broadcast_axisRQ  RV   t   consR  (    (   R  RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR     s@    		
c
         C   sN  d \ }
 } d \ } } d \ } } t |  t  } | d  k sK | d k r |  j j | j  s |  j j | j d | d | d t \ }
 } } q n  | d  k s | d k r| r|  j j | j  r|  j j | j d | d | d t \ } } } qn  | ri |
 | g d 6} n  i |
 | g d 6| | g d 6} |  j | d | d | d t } | j i |
 | g d 6| | g d 6d | d | d t } | d  k	 r| j	 d	 |	 d
 | d |  } | j	 d	 |	 d
 | d |  } n  t
 | j  r2| j j | j j k r2|
 d  k	 r/|
 | _ |
 | _ q/q2n  | j |   | j |  f S(   Ni    R  R   t   return_indexersi   RQ   R6  R<  Rr   R\   RH   (   NN(   NN(   NN(   Rs   R   R+   RJ   R  Rb  R   RF  R=  RR  R   t   tzRW   (   RZ   R  Rb  Rr   R   RQ   R6  R\   RH   R  t
   join_indext   join_columnst   ilidxt   iridxt   clidxt   cridxR  RA  R  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR     s>    	-	- 		!	c
         C   s)  t  |  t  }
 |
 r | r* t d   n  |  j j | j  rQ d \ } } } n0 |  j j | j d | d | d t \ } } } |  j | | |  } | j | | |  } n|  j	 } | d k rJ|  j } d \ } } |  j j | j  s |  j j | j d | d | d t \ } } } n  | d  k	 r| j
 | | d d } qn | d k r|  j } d \ } } |  j j | j  s|  j j | j d | d | d t \ } } } n  | d  k	 r| j
 | | d d } qn t d   | r| |  j	 k r| j   } n  |  j |  } | d  k r1| } n | j | d | } t |  p[| d  k	 } | r| j | d	 | d
 | d |	 } | j | d	 | d
 | } n  |
 s|
 r| d k rt | j  r| j j | j j k r
| d  k	 r| | _ | | _ qq
qn  | j |   | j |  f S(   Ns1   cannot align series to a series other than axis 0R  R   R  i    Rr   i   s   Must specify axis=0 or 1R\   RH   (   NNN(   NN(   NN(   R   R+   R   RJ   R  Rs   Rb  R   t   _reindex_indexerRY   R@  RF  RQ   R   R  R.   RR  R   R  RW   (   RZ   R  Rb  Rr   R   RQ   R6  R\   RH   R  R  R  t   lidxt   ridxR  R  t   fdatat   fill_na(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR	  !  sb    								c            s  t  | d  } t j | |   } t | t  rT | j |  d d d d \ } } nZ t | d  su t j |  } n  | j	 |  j	 k r t
 d   n  |  j | |  j    } | r t n t }	 | j |	  } d }
 t | t j  st |  s[t
 |
 j d	 | j    q[nG | j s[x; | j D]- } t |  s't
 |
 j d	 |    q'q'Wn  | rh| n | } t } t   d
  r  j |  j k r|  j   d d d | d | d t j \ }   | d k rt   f d   t |  j  D  rt  qqt d   n  t   t j  r|  j	 |  j	 k ra|  j d k rR| j  } t!    d k rvt j"   d    q^t! | |  t!    k rC| ry/ t j# |   } | j$   }   | | <|   Wqt% k
 rt } qXn  | sOt&   j  \ } }	 t j t! |  d	 | } | j' |	  t( | |    |   qOq^t
 d   qyt
 d   q||  j   |  j      n  | d k rd } n  |  j t)   d d  k rt } n |  j* |  d k } |  j+ |  } | r2|  j,    |  j- j. d | d   d
 | d t d | d |  j/  } |  j0 |  nR |  j- j1 d   d | d
 | d | d | d | d |  j/  } |  j |  j2 |   Sd S(   s   
        Equivalent to public method `where`, except that `other` is not
        applied as a function even if callable. Used in __setitem__.
        R]   Rb  R  R
  i   R   s,   Array conditional must be same shape as selfs5   Boolean array expected for the condition, not {dtype}RK   R  R  Rr   R   R6  c         3   s-   |  ]# \ } }   j  |  j |  Vq d  S(   N(   R   R  (   R   R{   R|   (   R  (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>!  s   s.   cannot align with a higher dimensional NDFramei    s/   Length of replacements must equal series lengths4   other must be the same shape as self when an ndarrayRL   RI   t   newR   R  t   condR!  t   try_castN(3   R   R	  t   apply_if_callableR   RD   R  R  R   t
   asanyarrayR   R   R   R   R   R   RR  RU   RQ  R   RN   RK   RR  R  RL   R  Rs   R  Ru   RB   R5   R   R  RT   R   t   arrayR  RQ   R  R   t   fillR   R   R   R   Rx  RY   t   putmaskR   RX   R  RW   (   RZ   R  R  R]   Rr   R   R!  R  R#  R6  R   t   dtt	   try_quickt   icondt	   new_otherRK   R  t
   block_axisR
  (    (   R  s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _wherel!  s    $!	"	

		s  
        Replace values where the condition is %(cond_rev)s.

        Parameters
        ----------
        cond : boolean %(klass)s, array-like, or callable
            Where `cond` is %(cond)s, keep the original value. Where
            %(cond_rev)s, replace with corresponding value from `other`.
            If `cond` is callable, it is computed on the %(klass)s and
            should return boolean %(klass)s or array. The callable must
            not change input %(klass)s (though pandas doesn't check it).

            .. versionadded:: 0.18.1
                A callable can be used as cond.

        other : scalar, %(klass)s, or callable
            Entries where `cond` is %(cond_rev)s are replaced with
            corresponding value from `other`.
            If other is callable, it is computed on the %(klass)s and
            should return scalar or %(klass)s. The callable must not
            change input %(klass)s (though pandas doesn't check it).

            .. versionadded:: 0.18.1
                A callable can be used as other.

        inplace : boolean, default False
            Whether to perform the operation in place on the data.
        axis : int, default None
            Alignment axis if needed.
        level : int, default None
            Alignment level if needed.
        errors : str, {'raise', 'ignore'}, default `raise`
            Note that currently this parameter won't affect
            the results and will always coerce to a suitable dtype.

            - `raise` : allow exceptions to be raised.
            - `ignore` : suppress exceptions. On error return original object.

        try_cast : boolean, default False
            Try to cast the result back to the input type (if possible).
        raise_on_error : boolean, default True
            Whether to raise on invalid data types (e.g. trying to where on
            strings).

            .. deprecated:: 0.21.0

               Use `errors`.

        Returns
        -------
        wh : same type as caller

        See Also
        --------
        :func:`DataFrame.%(name_other)s` : Return an object of same shape as
            self.

        Notes
        -----
        The %(name)s method is an application of the if-then idiom. For each
        element in the calling DataFrame, if ``cond`` is ``%(cond)s`` the
        element is used; otherwise the corresponding element from the DataFrame
        ``other`` is used.

        The signature for :func:`DataFrame.where` differs from
        :func:`numpy.where`. Roughly ``df1.where(m, df2)`` is equivalent to
        ``np.where(m, df1, df2)``.

        For further details and examples see the ``%(name)s`` documentation in
        :ref:`indexing <indexing.where_mask>`.

        Examples
        --------
        >>> s = pd.Series(range(5))
        >>> s.where(s > 0)
        0    NaN
        1    1.0
        2    2.0
        3    3.0
        4    4.0
        dtype: float64

        >>> s.mask(s > 0)
        0    0.0
        1    NaN
        2    NaN
        3    NaN
        4    NaN
        dtype: float64

        >>> s.where(s > 1, 10)
        0    10
        1    10
        2    2
        3    3
        4    4
        dtype: int64

        >>> df = pd.DataFrame(np.arange(10).reshape(-1, 2), columns=['A', 'B'])
        >>> m = df %% 3 == 0
        >>> df.where(m, -df)
           A  B
        0  0 -1
        1 -2  3
        2 -4 -5
        3  6 -7
        4 -8  9
        >>> df.where(m, -df) == np.where(m, df, -df)
              A     B
        0  True  True
        1  True  True
        2  True  True
        3  True  True
        4  True  True
        >>> df.where(m, -df) == df.mask(~m, -df)
              A     B
        0  True  True
        1  True  True
        2  True  True
        3  True  True
        4  True  True
        R  R  R   t   cond_revR   R   t
   name_otherRI   c	   	   
   C   sq   | d  k	 r: t j d t d d | r1 d } q: d } n  t j | |   } |  j | | | | | d | d | S(   Ns>   raise_on_error is deprecated in favor of errors='raise|ignore'R   i   R  R  R!  R  (   Rs   R   R   R   R	  R  R&  (	   RZ   R  R  R]   Rr   R   R!  R  t   raise_on_error(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  o"  s    		c	   	      C   s   | d  k	 r: t j d t d d | r1 d } q: d } n  t | d  } t j | |   } t | d  s| t j	 |  } n  |  j
 | d | d | d	 | d
 | d | d | S(   Ns>   raise_on_error is deprecated in favor of errors='raise|ignore'R   i   R  R  R]   R'  R  Rr   R   R  R!  (   Rs   R   R   R   R   R	  R  R  R   R  R  (	   RZ   R  R  R]   Rr   R   R!  R  R)  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRI   "  s    		s/
  
        Shift index by desired number of periods with an optional time `freq`.

        When `freq` is not passed, shift the index without realigning the data.
        If `freq` is passed (in this case, the index must be date or datetime,
        or it will raise a `NotImplementedError`), the index will be
        increased using the periods and the `freq`.

        Parameters
        ----------
        periods : int
            Number of periods to shift. Can be positive or negative.
        freq : DateOffset, tseries.offsets, timedelta, or str, optional
            Offset to use from the tseries module or time rule (e.g. 'EOM').
            If `freq` is specified then the index values are shifted but the
            data is not realigned. That is, use `freq` if you would like to
            extend the index when shifting and preserve the original data.
        axis : {0 or 'index', 1 or 'columns', None}, default None
            Shift direction.
        fill_value : object, optional
            The scalar value to use for newly introduced missing values.
            the default depends on the dtype of `self`.
            For numeric data, ``np.nan`` is used.
            For datetime, timedelta, or period data, etc. :attr:`NaT` is used.
            For extension dtypes, ``self.dtype.na_value`` is used.

            .. versionchanged:: 0.24.0

        Returns
        -------
        %(klass)s
            Copy of input object, shifted.

        See Also
        --------
        Index.shift : Shift values of Index.
        DatetimeIndex.shift : Shift values of DatetimeIndex.
        PeriodIndex.shift : Shift values of PeriodIndex.
        tshift : Shift the time index, using the index's frequency if
            available.

        Examples
        --------
        >>> df = pd.DataFrame({'Col1': [10, 20, 15, 30, 45],
        ...                    'Col2': [13, 23, 18, 33, 48],
        ...                    'Col3': [17, 27, 22, 37, 52]})

        >>> df.shift(periods=3)
           Col1  Col2  Col3
        0   NaN   NaN   NaN
        1   NaN   NaN   NaN
        2   NaN   NaN   NaN
        3  10.0  13.0  17.0
        4  20.0  23.0  27.0

        >>> df.shift(periods=1, axis='columns')
           Col1  Col2  Col3
        0   NaN  10.0  13.0
        1   NaN  20.0  23.0
        2   NaN  15.0  18.0
        3   NaN  30.0  33.0
        4   NaN  45.0  48.0

        >>> df.shift(periods=3, fill_value=0)
           Col1  Col2  Col3
        0     0     0     0
        1     0     0     0
        2     0     0     0
        3    10    13    17
        4    20    23    27
    t   shifti   c         C   s{   | d k r |  j    S|  j |  } | d  k rU |  j j d | d | d |  } n |  j | |  S|  j |  j |   S(   Ni    t   periodsRr   R6  (   RQ   R   Rs   RY   R*  t   tshiftR   RW   (   RZ   R+  R  Rr   R6  R%  R
  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR*  "  s    
c         C   s   | d k r |  S| d k r> t  d |  } t  | d  } n t  | d  } t  d |  } |  j | d | } |  j |  | } | j | d | d t | j |   S(   s
  
        Equivalent to `shift` without copying data. The shifted data will
        not include the dropped periods and the shifted axis will be smaller
        than the original.

        Parameters
        ----------
        periods : int
            Number of periods to move, can be positive or negative

        Returns
        -------
        shifted : same type as caller

        Notes
        -----
        While the `slice_shift` is faster than `shift`, you may pay for it
        later during alignment.
        i    Rr   R]   N(   R  Rs   R  R   R   R   RW   (   RZ   R+  Rr   t   vslicert   islicerR  t   shifted_axis(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   slice_shift"  s    c   	      C   sd  |  j  |  } | d k r0 t | d d  } n  | d k rQ t | d d  } n  | d k rr d } t |   n  | d k r |  St | t  r t |  } n  |  j |  } t | t  r&t | j	  } | | k r|  j
 j   } | j |  | j | <qNd | j | j f } t |   n( |  j
 j   } | j | |  | j | <|  j |  j |   S(   s  
        Shift the time index, using the index's frequency if available.

        Parameters
        ----------
        periods : int
            Number of periods to move, can be positive or negative
        freq : DateOffset, timedelta, or time rule string, default None
            Increment to use from the tseries module or time rule (e.g. 'EOM')
        axis : int or basestring
            Corresponds to the axis that contains the Index

        Returns
        -------
        shifted : NDFrame

        Notes
        -----
        If freq is not specified then tries to use the freq or inferred_freq
        attributes of the index. If neither of those attributes exist, a
        ValueError is thrown
        R  t   inferred_freqs/   Freq was not given and was not set in the indexi    s0   Given freq %s does not match PeriodIndex freq %sN(   R   Rs   R   R   R   R   RA   R   R;   R  RY   RQ   R*  RB   t	   rule_codeR   RW   (	   RZ   R+  R  Rr   RJ   R   R%  t	   orig_freqR
  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR,  #  s0    c   	      C   s\  | d k r |  j } n  |  j |  } |  j |  } | j rY | j rY t d   n  | j r d d l m	 } | |  } | |  } n  | d k	 r | d k	 r | | k r t d | | f   q n  t
 d d  g |  j } t
 | |  | | <|  j t |  } t | t  rCt | |  j |  | j | |   n  | rX| j   } n  | S(   s&  
        Truncate a Series or DataFrame before and after some index value.

        This is a useful shorthand for boolean indexing based on index
        values above or below certain thresholds.

        Parameters
        ----------
        before : date, string, int
            Truncate all rows before this index value.
        after : date, string, int
            Truncate all rows after this index value.
        axis : {0 or 'index', 1 or 'columns'}, optional
            Axis to truncate. Truncates the index (rows) by default.
        copy : boolean, default is True,
            Return a copy of the truncated section.

        Returns
        -------
        type of caller
            The truncated Series or DataFrame.

        See Also
        --------
        DataFrame.loc : Select a subset of a DataFrame by label.
        DataFrame.iloc : Select a subset of a DataFrame by position.

        Notes
        -----
        If the index being truncated contains only datetime values,
        `before` and `after` may be specified as strings instead of
        Timestamps.

        Examples
        --------
        >>> df = pd.DataFrame({'A': ['a', 'b', 'c', 'd', 'e'],
        ...                    'B': ['f', 'g', 'h', 'i', 'j'],
        ...                    'C': ['k', 'l', 'm', 'n', 'o']},
        ...                    index=[1, 2, 3, 4, 5])
        >>> df
           A  B  C
        1  a  f  k
        2  b  g  l
        3  c  h  m
        4  d  i  n
        5  e  j  o

        >>> df.truncate(before=2, after=4)
           A  B  C
        2  b  g  l
        3  c  h  m
        4  d  i  n

        The columns of a DataFrame can be truncated.

        >>> df.truncate(before="A", after="B", axis="columns")
           A  B
        1  a  f
        2  b  g
        3  c  h
        4  d  i
        5  e  j

        For Series, only rows can be truncated.

        >>> df['A'].truncate(before=2, after=4)
        2    b
        3    c
        4    d
        Name: A, dtype: object

        The index values in ``truncate`` can be datetimes or string
        dates.

        >>> dates = pd.date_range('2016-01-01', '2016-02-01', freq='s')
        >>> df = pd.DataFrame(index=dates, data={'A': 1})
        >>> df.tail()
                             A
        2016-01-31 23:59:56  1
        2016-01-31 23:59:57  1
        2016-01-31 23:59:58  1
        2016-01-31 23:59:59  1
        2016-02-01 00:00:00  1

        >>> df.truncate(before=pd.Timestamp('2016-01-05'),
        ...             after=pd.Timestamp('2016-01-10')).tail()
                             A
        2016-01-09 23:59:56  1
        2016-01-09 23:59:57  1
        2016-01-09 23:59:58  1
        2016-01-09 23:59:59  1
        2016-01-10 00:00:00  1

        Because the index is a DatetimeIndex containing only dates, we can
        specify `before` and `after` as strings. They will be coerced to
        Timestamps before truncation.

        >>> df.truncate('2016-01-05', '2016-01-10').tail()
                             A
        2016-01-09 23:59:56  1
        2016-01-09 23:59:57  1
        2016-01-09 23:59:58  1
        2016-01-09 23:59:59  1
        2016-01-10 00:00:00  1

        Note that ``truncate`` assumes a 0 value for any unspecified time
        component (midnight). This differs from partial string slicing, which
        returns any partially matching dates.

        >>> df.loc['2016-01-05':'2016-01-10', :].tail()
                             A
        2016-01-10 23:59:55  1
        2016-01-10 23:59:56  1
        2016-01-10 23:59:57  1
        2016-01-10 23:59:58  1
        2016-01-10 23:59:59  1
        s    truncate requires a sorted indexi(   R  s   Truncate: %s must be after %sN(   Rs   R   R   R   t   is_monotonic_increasingt   is_monotonic_decreasingR   t   is_all_datest   pandas.core.tools.datetimesR  R  R   R  R   R   R6   R   R   t   truncateRQ   (	   RZ   t   beforet   afterRr   RQ   R|   R  R(  R_   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR8  S#  s.    w	c   	         s    j        j    }    f d   } t | t  r| | j |  } | | j | |  } | j | d | } n? | d d | j f k r t	 d j
 |    n  | | |  }  j  j d | } | j | d   d t } | j   S(	   s  
        Convert tz-aware axis to target time zone.

        Parameters
        ----------
        tz : string or pytz.timezone object
        axis : the axis to convert
        level : int, str, default None
            If axis ia a MultiIndex, convert a specific level. Otherwise
            must be None
        copy : boolean, default True
            Also make a copy of the underlying data

        Returns
        -------

        Raises
        ------
        TypeError
            If the axis is tz-naive.
        c            sk   t  |  d  sX t |   d k rC  j    } t d |   qg t g  d | }  n |  j |  }  |  S(   Nt
   tz_converti    s.   %s is not a valid DatetimeIndex or PeriodIndexR  (   R  R   R   RM   R9   R;  (   R|   R  t   ax_name(   Rr   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _tz_convert$  s    R   i    s   The level {0} is not validRQ   Rr   R]   N(   R   R   R   R6   R  t   levelst
   set_levelsRs   R   R   RN   R   RY   R   R   RW   (	   RZ   R  Rr   R   RQ   R|   R=  t	   new_levelR_   (    (   Rr   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyR;  #  s    c            s8  d } | | k r1 t  | t  r1 t d   n   j       j    }    f d   }	 t  | t  r | j |  } |	 | j | | | |  }
 | j |
 d | } nE | d d | j
 f k r t d	 j |    n  |	 | | | |  }  j  j d
 | } | j | d   d t } | j   S(   s  
        Localize tz-naive index of a Series or DataFrame to target time zone.

        This operation localizes the Index. To localize the values in a
        timezone-naive Series, use :meth:`Series.dt.tz_localize`.

        Parameters
        ----------
        tz : string or pytz.timezone object
        axis : the axis to localize
        level : int, str, default None
            If axis ia a MultiIndex, localize a specific level. Otherwise
            must be None
        copy : boolean, default True
            Also make a copy of the underlying data
        ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise'
            When clocks moved backward due to DST, ambiguous times may arise.
            For example in Central European Time (UTC+01), when going from
            03:00 DST to 02:00 non-DST, 02:30:00 local time occurs both at
            00:30:00 UTC and at 01:30:00 UTC. In such a situation, the
            `ambiguous` parameter dictates how ambiguous times should be
            handled.

            - 'infer' will attempt to infer fall dst-transition hours based on
              order
            - bool-ndarray where True signifies a DST time, False designates
              a non-DST time (note that this flag is only applicable for
              ambiguous times)
            - 'NaT' will return NaT where there are ambiguous times
            - 'raise' will raise an AmbiguousTimeError if there are ambiguous
              times
        nonexistent : str, default 'raise'
            A nonexistent time does not exist in a particular timezone
            where clocks moved forward due to DST. Valid valuse are:

            - 'shift_forward' will shift the nonexistent time forward to the
              closest existing time
            - 'shift_backward' will shift the nonexistent time backward to the
              closest existing time
            - 'NaT' will return NaT where there are nonexistent times
            - timedelta objects will shift nonexistent times by the timedelta
            - 'raise' will raise an NonExistentTimeError if there are
              nonexistent times

            .. versionadded:: 0.24.0

        Returns
        -------
        Series or DataFrame
            Same type as the input.

        Raises
        ------
        TypeError
            If the TimeSeries is tz-aware and tz is not None.

        Examples
        --------

        Localize local times:

        >>> s = pd.Series([1],
        ... index=pd.DatetimeIndex(['2018-09-15 01:30:00']))
        >>> s.tz_localize('CET')
        2018-09-15 01:30:00+02:00    1
        dtype: int64

        Be careful with DST changes. When there is sequential data, pandas
        can infer the DST time:

        >>> s = pd.Series(range(7), index=pd.DatetimeIndex([
        ... '2018-10-28 01:30:00',
        ... '2018-10-28 02:00:00',
        ... '2018-10-28 02:30:00',
        ... '2018-10-28 02:00:00',
        ... '2018-10-28 02:30:00',
        ... '2018-10-28 03:00:00',
        ... '2018-10-28 03:30:00']))
        >>> s.tz_localize('CET', ambiguous='infer')
        2018-10-28 01:30:00+02:00    0
        2018-10-28 02:00:00+02:00    1
        2018-10-28 02:30:00+02:00    2
        2018-10-28 02:00:00+01:00    3
        2018-10-28 02:30:00+01:00    4
        2018-10-28 03:00:00+01:00    5
        2018-10-28 03:30:00+01:00    6
        dtype: int64

        In some cases, inferring the DST is impossible. In such cases, you can
        pass an ndarray to the ambiguous parameter to set the DST explicitly

        >>> s = pd.Series(range(3), index=pd.DatetimeIndex([
        ... '2018-10-28 01:20:00',
        ... '2018-10-28 02:36:00',
        ... '2018-10-28 03:46:00']))
        >>> s.tz_localize('CET', ambiguous=np.array([True, True, False]))
        2018-10-28 01:20:00+02:00    0
        2018-10-28 02:36:00+02:00    1
        2018-10-28 03:46:00+01:00    2
        dtype: int64

        If the DST transition causes nonexistent times, you can shift these
        dates forward or backwards with a timedelta object or `'shift_forward'`
        or `'shift_backwards'`.
        >>> s = pd.Series(range(2), index=pd.DatetimeIndex([
        ... '2015-03-29 02:30:00',
        ... '2015-03-29 03:30:00']))
        >>> s.tz_localize('Europe/Warsaw', nonexistent='shift_forward')
        2015-03-29 03:00:00+02:00    0
        2015-03-29 03:30:00+02:00    1
        dtype: int64
        >>> s.tz_localize('Europe/Warsaw', nonexistent='shift_backward')
        2015-03-29 01:59:59.999999999+01:00    0
        2015-03-29 03:30:00+02:00              1
        dtype: int64
        >>> s.tz_localize('Europe/Warsaw', nonexistent=pd.Timedelta('1H'))
        2015-03-29 03:30:00+02:00    0
        2015-03-29 03:30:00+02:00    1
        dtype: int64
        R  t   NaTt   shift_forwardt   shift_backwardso   The nonexistent argument must be one of 'raise', 'NaT', 'shift_forward', 'shift_backward' or a timedelta objectc            sw   t  |  d  sX t |   d k rC  j    } t d |   qs t g  d | }  n |  j | d | d | }  |  S(   Nt   tz_localizei    s.   %s is not a valid DatetimeIndex or PeriodIndexR  t	   ambiguoust   nonexistent(   R  R   R   RM   R9   RD  (   R|   R  RE  RF  R<  (   Rr   RZ   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _tz_localize$  s    R   i    s   The level {0} is not validRQ   Rr   R]   (   R  RA  RB  RC  N(   R   R    R   R   R   R6   R  R>  R?  Rs   R   RN   R   RY   R   R   RW   (   RZ   R  Rr   R   RQ   RE  RF  t   nonexistent_optionsR|   RG  R@  R_   (    (   Rr   RZ   s2   lib/python2.7/site-packages/pandas/core/generic.pyRD  !$  s&    z c         C   s   t  j |   S(   s  
        Return a Series/DataFrame with absolute numeric value of each element.

        This function only applies to elements that are all numeric.

        Returns
        -------
        abs
            Series/DataFrame containing the absolute value of each element.

        See Also
        --------
        numpy.absolute : Calculate the absolute value element-wise.

        Notes
        -----
        For ``complex`` inputs, ``1.2 + 1j``, the absolute value is
        :math:`\sqrt{ a^2 + b^2 }`.

        Examples
        --------
        Absolute numeric values in a Series.

        >>> s = pd.Series([-1.10, 2, -3.33, 4])
        >>> s.abs()
        0    1.10
        1    2.00
        2    3.33
        3    4.00
        dtype: float64

        Absolute numeric values in a Series with complex numbers.

        >>> s = pd.Series([1.2 + 1j])
        >>> s.abs()
        0    1.56205
        dtype: float64

        Absolute numeric values in a Series with a Timedelta element.

        >>> s = pd.Series([pd.Timedelta('1 days')])
        >>> s.abs()
        0   1 days
        dtype: timedelta64[ns]

        Select rows with data closest to certain value using argsort (from
        `StackOverflow <https://stackoverflow.com/a/17758115>`__).

        >>> df = pd.DataFrame({
        ...     'a': [4, 5, 6, 7],
        ...     'b': [10, 20, 30, 40],
        ...     'c': [100, 50, -30, -50]
        ... })
        >>> df
             a    b    c
        0    4   10  100
        1    5   20   50
        2    6   30  -30
        3    7   40  -50
        >>> df.loc[(df.c - 43).abs().argsort()]
             a    b    c
        1    5   20   50
        0    4   10  100
        2    6   30  -30
        3    7   40  -50
        (   R   R+  (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR+  $  s    Cc            s  |  j  d k r$ d } t |   n0 |  j  d k rT |  j j d k rT t d   n   d k	 r t    |  j   d  k r  j d  n  t	 j
    n t	 j d d d g   t	 j   } t |  t   k  r t d	   n  |  t      f d
    d        f d   } |  j  d k rM| |   S| d k r| d k r|  j d t	 j g  } t | j  d k r|  } qnN | d k r| d k	 rd } t |   n  |  } n |  j d | d |  } g  | j   D] \ } }	 | |	  ^ q}
 g  } t d   |
 D d t } x; | D]3 } x* | D]" } | | k rM| j |  qMqMWq@Wt j |
 d t j | g  d d } | j j   | _ | S(   s!  
        Generate descriptive statistics that summarize the central tendency,
        dispersion and shape of a dataset's distribution, excluding
        ``NaN`` values.

        Analyzes both numeric and object series, as well
        as ``DataFrame`` column sets of mixed data types. The output
        will vary depending on what is provided. Refer to the notes
        below for more detail.

        Parameters
        ----------
        percentiles : list-like of numbers, optional
            The percentiles to include in the output. All should
            fall between 0 and 1. The default is
            ``[.25, .5, .75]``, which returns the 25th, 50th, and
            75th percentiles.
        include : 'all', list-like of dtypes or None (default), optional
            A white list of data types to include in the result. Ignored
            for ``Series``. Here are the options:

            - 'all' : All columns of the input will be included in the output.
            - A list-like of dtypes : Limits the results to the
              provided data types.
              To limit the result to numeric types submit
              ``numpy.number``. To limit it instead to object columns submit
              the ``numpy.object`` data type. Strings
              can also be used in the style of
              ``select_dtypes`` (e.g. ``df.describe(include=['O'])``). To
              select pandas categorical columns, use ``'category'``
            - None (default) : The result will include all numeric columns.
        exclude : list-like of dtypes or None (default), optional,
            A black list of data types to omit from the result. Ignored
            for ``Series``. Here are the options:

            - A list-like of dtypes : Excludes the provided data types
              from the result. To exclude numeric types submit
              ``numpy.number``. To exclude object columns submit the data
              type ``numpy.object``. Strings can also be used in the style of
              ``select_dtypes`` (e.g. ``df.describe(include=['O'])``). To
              exclude pandas categorical columns, use ``'category'``
            - None (default) : The result will exclude nothing.

        Returns
        -------
        Series or DataFrame
            Summary statistics of the Series or Dataframe provided.

        See Also
        --------
        DataFrame.count: Count number of non-NA/null observations.
        DataFrame.max: Maximum of the values in the object.
        DataFrame.min: Minimum of the values in the object.
        DataFrame.mean: Mean of the values.
        DataFrame.std: Standard deviation of the obersvations.
        DataFrame.select_dtypes: Subset of a DataFrame including/excluding
            columns based on their dtype.

        Notes
        -----
        For numeric data, the result's index will include ``count``,
        ``mean``, ``std``, ``min``, ``max`` as well as lower, ``50`` and
        upper percentiles. By default the lower percentile is ``25`` and the
        upper percentile is ``75``. The ``50`` percentile is the
        same as the median.

        For object data (e.g. strings or timestamps), the result's index
        will include ``count``, ``unique``, ``top``, and ``freq``. The ``top``
        is the most common value. The ``freq`` is the most common value's
        frequency. Timestamps also include the ``first`` and ``last`` items.

        If multiple object values have the highest count, then the
        ``count`` and ``top`` results will be arbitrarily chosen from
        among those with the highest count.

        For mixed data types provided via a ``DataFrame``, the default is to
        return only an analysis of numeric columns. If the dataframe consists
        only of object and categorical data without any numeric columns, the
        default is to return an analysis of both the object and categorical
        columns. If ``include='all'`` is provided as an option, the result
        will include a union of attributes of each type.

        The `include` and `exclude` parameters can be used to limit
        which columns in a ``DataFrame`` are analyzed for the output.
        The parameters are ignored when analyzing a ``Series``.

        Examples
        --------
        Describing a numeric ``Series``.

        >>> s = pd.Series([1, 2, 3])
        >>> s.describe()
        count    3.0
        mean     2.0
        std      1.0
        min      1.0
        25%      1.5
        50%      2.0
        75%      2.5
        max      3.0
        dtype: float64

        Describing a categorical ``Series``.

        >>> s = pd.Series(['a', 'a', 'b', 'c'])
        >>> s.describe()
        count     4
        unique    3
        top       a
        freq      2
        dtype: object

        Describing a timestamp ``Series``.

        >>> s = pd.Series([
        ...   np.datetime64("2000-01-01"),
        ...   np.datetime64("2010-01-01"),
        ...   np.datetime64("2010-01-01")
        ... ])
        >>> s.describe()
        count                       3
        unique                      2
        top       2010-01-01 00:00:00
        freq                        2
        first     2000-01-01 00:00:00
        last      2010-01-01 00:00:00
        dtype: object

        Describing a ``DataFrame``. By default only numeric fields
        are returned.

        >>> df = pd.DataFrame({'categorical': pd.Categorical(['d','e','f']),
        ...                    'numeric': [1, 2, 3],
        ...                    'object': ['a', 'b', 'c']
        ...                   })
        >>> df.describe()
               numeric
        count      3.0
        mean       2.0
        std        1.0
        min        1.0
        25%        1.5
        50%        2.0
        75%        2.5
        max        3.0

        Describing all columns of a ``DataFrame`` regardless of data type.

        >>> df.describe(include='all')
                categorical  numeric object
        count            3      3.0      3
        unique           3      NaN      3
        top              f      NaN      c
        freq             1      NaN      1
        mean           NaN      2.0    NaN
        std            NaN      1.0    NaN
        min            NaN      1.0    NaN
        25%            NaN      1.5    NaN
        50%            NaN      2.0    NaN
        75%            NaN      2.5    NaN
        max            NaN      3.0    NaN

        Describing a column from a ``DataFrame`` by accessing it as
        an attribute.

        >>> df.numeric.describe()
        count    3.0
        mean     2.0
        std      1.0
        min      1.0
        25%      1.5
        50%      2.0
        75%      2.5
        max      3.0
        Name: numeric, dtype: float64

        Including only numeric columns in a ``DataFrame`` description.

        >>> df.describe(include=[np.number])
               numeric
        count      3.0
        mean       2.0
        std        1.0
        min        1.0
        25%        1.5
        50%        2.0
        75%        2.5
        max        3.0

        Including only string columns in a ``DataFrame`` description.

        >>> df.describe(include=[np.object])
               object
        count       3
        unique      3
        top         c
        freq        1

        Including only categorical columns from a ``DataFrame`` description.

        >>> df.describe(include=['category'])
               categorical
        count            3
        unique           3
        top              f
        freq             1

        Excluding numeric columns from a ``DataFrame`` description.

        >>> df.describe(exclude=[np.number])
               categorical object
        count            3      3
        unique           3      3
        top              f      c
        freq             1      1

        Excluding object columns from a ``DataFrame`` description.

        >>> df.describe(exclude=[np.object])
               categorical  numeric
        count            3      3.0
        unique           3      NaN
        top              f      NaN
        freq             1      NaN
        mean           NaN      2.0
        std            NaN      1.0
        min            NaN      1.0
        25%            NaN      1.5
        50%            NaN      2.0
        75%            NaN      2.5
        max            NaN      3.0
        i   s-   describe is not implemented on Panel objects.i   i    s+   Cannot describe a DataFrame without columnsg      ?g      ?g      ?s%   percentiles cannot contain duplicatesc            s   d d d d g   d g } |  j    |  j   |  j   |  j   g |  j   j   |  j   g } t j | d | d |  j	 S(   Nt   countt   meant   stdR  R  RJ   R   (
   RI  RJ  RK  R  t   quantilet   tolistR  RU   RV   R   (   t   seriest
   stat_indexR   (   t   formatted_percentilest   percentiles(    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   describe_numeric_1d&  s    Jc   	      S   su  d d g } |  j    } t | | d k  } |  j   | g } | d d k rY| j d | j d } } t |   r6|  j j } |  j   j	 j
 d  } t |  } | j d  k	 r | d  k	 r | j |  } n | j |  } | d d d d	 g 7} | | | t | j   d
 | t | j   d
 | g 7} qY| d d g 7} | | | g 7} n  t j | d | d |  j S(   NRI  Rg  i    i   t   i8R  R  R  R.  R  RJ   R   (   t   value_countsR   RI  RJ   R  R   R!  R  t   dropnaRT   t   viewR   t   tzinfoRs   R;  RD  R  R  RU   RV   R   (	   Ry   R   t	   objcountst   count_uniqueR_   R  R  R  t   asint(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   describe_categorical_1d&  s(    	c            sP   t  |   r   |   St |   r,  |   St |   rB  |   S  |   Sd  S(   N(   R   R"   R'   (   Ry   (   R[  RR  (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   describe_1d3&  s    


i   t   includeR  s*   exclude must be None when include is 'all't   excludec         s   s   |  ] } | j  Vq d  S(   N(   RJ   (   R   R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>O&  s    R   t	   join_axesRr   N(   RL   R   RF  R   R   Rs   R   t   _check_percentileR   R   R  R  Rg  R   R?   t   select_dtypest   numberRO  R?  RU   R  R4   RQ   (   RZ   RQ  R]  R^  R   t   unique_pctsR\  Ry   R#  R   t   ldescR   t   ldesc_indexest   idxnamesR   R   (    (   R[  RR  RP  RQ  s2   lib/python2.7/site-packages/pandas/core/generic.pyt   describe%  sT    !	

	+'c         C   s   d } t  j |  } | j d k r_ d | k o; d k n s t | j | d    q n2 t d   | D  s t | j | d    n  | S(   sG   
        Validate percentiles (used by describe and quantile).
        sB   percentiles should all be in the interval [0, 1]. Try {0} instead.i    i   g      Y@c         s   s+   |  ]! } d  | k o  d k n Vq d S(   i    i   N(    (   R   t   qs(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pys	   <genexpr>e&  s    (   R   R  RL   R   RN   R  (   RZ   t   qR   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR`  Y&  s    s  
        Percentage change between the current and a prior element.

        Computes the percentage change from the immediately previous row by
        default. This is useful in comparing the percentage of change in a time
        series of elements.

        Parameters
        ----------
        periods : int, default 1
            Periods to shift for forming percent change.
        fill_method : str, default 'pad'
            How to handle NAs before computing percent changes.
        limit : int, default None
            The number of consecutive NAs to fill before stopping.
        freq : DateOffset, timedelta, or offset alias string, optional
            Increment to use from time series API (e.g. 'M' or BDay()).
        **kwargs
            Additional keyword arguments are passed into
            `DataFrame.shift` or `Series.shift`.

        Returns
        -------
        chg : Series or DataFrame
            The same type as the calling object.

        See Also
        --------
        Series.diff : Compute the difference of two elements in a Series.
        DataFrame.diff : Compute the difference of two elements in a DataFrame.
        Series.shift : Shift the index by some number of periods.
        DataFrame.shift : Shift the index by some number of periods.

        Examples
        --------
        **Series**

        >>> s = pd.Series([90, 91, 85])
        >>> s
        0    90
        1    91
        2    85
        dtype: int64

        >>> s.pct_change()
        0         NaN
        1    0.011111
        2   -0.065934
        dtype: float64

        >>> s.pct_change(periods=2)
        0         NaN
        1         NaN
        2   -0.055556
        dtype: float64

        See the percentage change in a Series where filling NAs with last
        valid observation forward to next valid.

        >>> s = pd.Series([90, 91, None, 85])
        >>> s
        0    90.0
        1    91.0
        2     NaN
        3    85.0
        dtype: float64

        >>> s.pct_change(fill_method='ffill')
        0         NaN
        1    0.011111
        2    0.000000
        3   -0.065934
        dtype: float64

        **DataFrame**

        Percentage change in French franc, Deutsche Mark, and Italian lira from
        1980-01-01 to 1980-03-01.

        >>> df = pd.DataFrame({
        ...     'FR': [4.0405, 4.0963, 4.3149],
        ...     'GR': [1.7246, 1.7482, 1.8519],
        ...     'IT': [804.74, 810.01, 860.13]},
        ...     index=['1980-01-01', '1980-02-01', '1980-03-01'])
        >>> df
                        FR      GR      IT
        1980-01-01  4.0405  1.7246  804.74
        1980-02-01  4.0963  1.7482  810.01
        1980-03-01  4.3149  1.8519  860.13

        >>> df.pct_change()
                          FR        GR        IT
        1980-01-01       NaN       NaN       NaN
        1980-02-01  0.013810  0.013684  0.006549
        1980-03-01  0.053365  0.059318  0.061876

        Percentage of change in GOOG and APPL stock volume. Shows computing
        the percentage change between columns.

        >>> df = pd.DataFrame({
        ...     '2016': [1769950, 30586265],
        ...     '2015': [1500923, 40912316],
        ...     '2014': [1371819, 41403351]},
        ...     index=['GOOG', 'APPL'])
        >>> df
                  2016      2015      2014
        GOOG   1769950   1500923   1371819
        APPL  30586265  40912316  41403351

        >>> df.pct_change(axis='columns')
              2016      2015      2014
        GOOG   NaN -0.151997 -0.086016
        APPL   NaN  0.337604  0.012002
        t
   pct_changec   
   	   K   s   |  j  | j d |  j   } | d  k r3 |  } n |  j d | d | d |  } | j | j d | d | d | |   d } | j |  } | d  k r t t	 j
 |   }	 t j | j |	 t j  n  | S(   NRr   R\   RH   R+  R  i   (   R   R   R   Rs   RR  t   divR*  R   R-   R	  R  R   R   RT   R  (
   RZ   R+  R  RH   R  R   Rr   Ry   RY  RI   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRj  &  s    	c            s     d  k r t d   n  |  j d | d   d t  } t | |  ra  ra t | |     S|  j      t t |   |        f d   } | j |  S(   Ns.   Must specify 'axis' when aggregating by level.R   Rr   R  c            s    |  d   d   S(   NRr   t   skipna(    (   R   (   Rr   R   R\   Rl  (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRo  &  s    (	   Rs   R   R  R   R  R   R   RO   R_  (   RZ   R   Rr   R   Rl  R   t   groupedt   applyf(    (   Rr   R   R\   Rl  s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _agg_by_level&  s    c         C   s  t  |   \ } } } t |  d | | | t t j t t d t 	|  _ t |  d | | | t	 t j
 t t d t 	|  _ t d d d d d | d	 | d
 | d d d d d d  t t  d6 d6 d6 d    } | |  _ t |  d | | | d t j  |  _ t |  d | | | d t j  |  _ t |  d | | | d t j  |  _ t d d d d d | d	 | d
 | d d d d d d  t t  d6 d6 d6 d    } | |  _ t |  d | | | d d   d t j t j t   |  _! t |  d | | | d d   d d  t j t"  |  _# t |  d! | | | d" d#   d$ d% t j t$  |  _% t |  d& | | | d' d(   d) t j t j t&  |  _' t( |  d | | | d* t j) t* t+ 	 |  _, t- |  d+ | | | d, t j.  |  _/ t- |  d- | | | d. t j0  |  _1 t- |  d/ | | | d0 t j2  |  _3 |  j3 |  _4 t( |  d$ | | | d1 t j5 d t6 |  _7 |  j7 |  _8 t- |  d2 | | | d3 t j9  |  _: t- |  d) | | | d4 t j; t* t< 	 |  _= t- |  d | | | d5 t j> t* t? 	 |  _@ d6 S(7   sO   
        Add the operations to the cls; evaluate the doc strings again
        R2  t   empty_valueR  t   outnamet   madt   descsH   Return the mean absolute deviation of the values for the requested axis.t   name1t   name2t
   axis_descrt	   min_countR<  t   see_alsot   examplesc         S   s   | d  k r t } n  | d  k r- |  j } n  | d  k	 rX |  j d d | d | d | S|  j   } | d k r | | j d d  } n! | j | j d d  d d } t j |  j d | d |  S(   NRr  Rr   R   Rl  i    i   (	   Rs   R   R   Ro  Rz  RJ  t   subR   R+  (   RZ   Rr   Rl  R   Ry   t   demeaned(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRr  '  s    	!t   sems   Return unbiased standard error of the mean over requested axis.

Normalized by N-1 by default. This can be changed using the ddof argumentt   varsx   Return unbiased variance over requested axis.

Normalized by N-1 by default. This can be changed using the ddof argumentRK  s   Return sample standard deviation over requested axis.

Normalized by N-1 by default. This can be changed using the ddof argumentt
   compoundedsD   Return the compound percentage of the values for the requested axis.c         S   s9   | d  k r t } n  d |  j d | d | d |  d S(   Ni   Rr   Rl  R   (   Rs   R   R   (   RZ   Rr   Rl  R   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   compound2'  s    	t   cummint   minimumc         S   s   t  j j |  |  S(   N(   R   R  t
   accumulate(   t   yRr   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRo  A'  s    R  t   cumsumRS  c         S   s   |  j  |  S(   N(   R  (   R  Rr   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRo  E'  s    g        t   cumprodt   productc         S   s   |  j  |  S(   N(   R  (   R  Rr   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRo  I'  s    R   g      ?t   cummaxt   maximumc         S   s   t  j j |  |  S(   N(   R   R  R  (   R  Rr   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRo  M'  s    R  sq   Return the sum of the values for the requested axis.

            This is equivalent to the method ``numpy.sum``.RJ  s5   Return the mean of the values for the requested axis.t   skews;   Return unbiased skew over requested axis
Normalized by N-1.t   kurts   Return unbiased kurtosis over requested axis using Fisher's definition of
kurtosis (kurtosis of normal == 0.0). Normalized by N-1.s8   Return the product of the values for the requested axis.t   medians7   Return the median of the values for the requested axis.s   Return the maximum of the values for the requested axis.

            If you want the *index* of the maximum, use ``idxmax``. This is
            the equivalent of the ``numpy.ndarray`` method ``argmax``.s   Return the minimum of the values for the requested axis.

            If you want the *index* of the minimum, use ``idxmin``. This is
            the equivalent of the ``numpy.ndarray`` method ``argmin``.N(A   t
   _doc_parmst   _make_logical_functiont	   _any_descR1   t   nananyt   _any_see_alsot   _any_examplesR   R2  t	   _all_desct   nanallt   _all_see_alsot   _all_examplesR   R  R   R   t   _num_docRs   Rr  t   _make_stat_function_ddoft   nansemR|  t   nanvarR}  t   nanstdRK  R  t   _make_cum_functionR   Ru  R  t   _cummin_examplesR  t   _cumsum_examplesR  t   _cumprod_examplesR  t   _cummax_examplesR  t   _make_min_count_stat_functiont   nansumt   _stat_func_see_alsot   _sum_examplesRS  t   _make_stat_functiont   nanmeanRJ  t   nanskewR  t   nankurtR  t   kurtosist   nanprodt   _prod_examplesR   R  t	   nanmedianR  t   nanmaxt   _max_examplesR  t   nanmint   _min_examplesR  (   R   Rv  R   Ru  Rr  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _add_numeric_operations&  s    						c         C   sI   t  |   \ } } } d t d  } t |  d | | | d |  |  _ d S(   sd   
        Add the series only operations to the cls; evaluate the doc
        strings again.
        i    c         S   sH   t  j |  | |  } t  j |  | |  } t j d t d d | | S(   NsY   Method .ptp is deprecated and will be removed in a future version. Use numpy.ptp instead.R   i   (   R1   R  R  R   R   R   (   RT   Rr   Rl  t   nmaxt   nmin(    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   nanptp'  s
    	t   ptps   Returns the difference between the maximum value and the
            minimum value in the object. This is the equivalent of the
            ``numpy.ndarray`` method ``ptp``.

.. deprecated:: 0.24.0
                Use numpy.ptp insteadN(   R  R   R  R  (   R   Rv  R   Ru  R  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _add_series_only_operationsz'  s    c            s   d d l  m   t   j j  d t d d d d   f d   } | |  _ t   j j  d t d   f d   } | |  _ t   j j  d d d d d t	 t d   f d   } | |  _ d S(	   sq   
        Add the series or dataframe only operations to the cls; evaluate
        the doc strings again.
        i(   t   windowi    c            sF   |  j  |  }   j |  d | d | d | d | d | d | d | S(   NR  t   min_periodst   centert   win_typeR  Rr   R  (   R   t   rolling(   RZ   R  R  R  R  R  Rr   R  (   t   rwindow(    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  '  s
    i   c            s.   |  j  |  }   j |  d | d | d | S(   NR  R  Rr   (   R   t	   expanding(   RZ   R  R  Rr   (   R  (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  '  s    c	   	         sL   |  j  |  }   j |  d | d | d | d | d | d | d | d | S(	   NR	  t   spant   halflifet   alphaR  t   adjustt	   ignore_naRr   (   R   t   ewm(	   RZ   R	  R  R  R  R  R  R  Rr   (   R  (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  '  s    N(
   t   pandas.coreR  R   R  R  Rs   R   R  R  R   (   R   R  R  R  (    (   R  s2   lib/python2.7/site-packages/pandas/core/generic.pyt#   _add_series_or_dataframe_operations'  s    			Rr   c         O   sL   |  j  | | |  } t |  s9 t |  t |   k rH t d   n  | S(   Ns,   transforms cannot produce aggregated results(   t   aggR&   R   R   (   RZ   R^  R   R   R_   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR`  '  s    $s	  
        Return index for %(position)s non-NA/null value.

        Returns
        --------
        scalar : type of index

        Notes
        --------
        If all elements are non-NA/null, returns None.
        Also returns None for empty %(klass)s.
        t   valid_indexc         C   s   | d k s t   t |   d k r( d S|  j   } |  j d k rV | j d  } n  | d k r | j d d d  j   } n  | d k r t |   d | j d d d  j   } n  | j | } |  j	 | } | s d S| S(	   s  
        Retrieves the index of the first valid value.

        Parameters
        ----------
        how : {'first', 'last'}
            Use this parameter to change between the first or last valid index.

        Returns
        -------
        idx_first_valid : type of index
        R  R.  i    i   i   Ni(   R  R.  (
   R   R   Rs   R-   RL   R2  RT   t   argmaxt   iatRJ   (   RZ   R  t   is_validt   idxpost	   chk_notnaR  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   _find_valid_index'  s    -R  t   positionRD   c         C   s   |  j  d  S(   NR  (   R  (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   first_valid_index'  s    c         C   s   |  j  d  S(   NR.  (   R  (   RZ   (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   last_valid_index'  s    (   RP   t
   __module__R  RX  R   R   t	   frozensetRa  t   _deprecationsRk   Rs   Re   t	   timetupleR   R}   R   R  Rq   t   setterR   R   R   R   t   classmethodR   R   R   t   staticmethodR   R   R   R   R   R   R   R   R   R   R   R   R   RB   RL   R   R   R   R   R   R   R   R   R   R   R  R  R  R   R   R  R  R  R  R$  R&  R'  R(  t   __bool__R)  R,  R/  R1  R0  R4  R;  RA  RJ  RK  RM  R  RO  RP  RQ  RR  t   __array_priority__RS  R"  RU  RW  R`  Rd  Rg  Rr  t   _shared_docsR   R   Rs  Rn  R  R  R  t   pklt   HIGHEST_PROTOCOLR  R  R  Rf  R  R  R   R  R  R  R   R  R  R  R  R  R  R  R   R  R  R  R  R  R  R  R  R?  t   _xsR  R   RC  R"  RX   R*  R,  R2  R5  R  R;  R9  R:  t   _shared_doc_kwargsRv   R=  RJ  Rk  RL  R[  R\  R   RW   Rd  Rx   Ri  Rm  R  Rq  R  Rt  Rv  Rx  Rz  R|  R~  RT   R@  R  R  R  R  R  R  Rn   Ro   R  Rt   RQ   R  R  R  Rp   R  RR  R  R  RN  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  RI   R*  R0  R,  R8  R;  RD  R+  Rg  R`  Rj  Ro  R  R  R  R`  R  R  R  (    (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyRD   b   sd  
							
		7'						v		*;	2r	@		Y						! 2HU							6	
		*		
	t
				h	=9	a														"			T	".\"	e5	;	;Y.				D
X;=
(D
		'		
				-M	-	 	+$.	
vl	-	2 )
 Q
D
>
	sPtw	b8H *	?	:	g
)	-	K 


^
$94		E N	
')
	#c         C   sx   d d j  g  t |  j  D] \ } } d j | |  ^ q  } |  j d k r\ |  j j n d } |  j } | | | f S(   s    Return a tuple of the doc parms.s   {%s}s   , s	   {0} ({1})i   t   scalar(   Rb  Ru   R   RN   R   R   RP   (   R   R{   R   Rv  R   Ru  (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  (  s
    5!	s  
%(desc)s

Parameters
----------
axis : %(axis_descr)s
    Axis for the function to be applied on.
skipna : bool, default True
    Exclude NA/null values when computing the result.
level : int or level name, default None
    If the axis is a MultiIndex (hierarchical), count along a
    particular level, collapsing into a %(name1)s.
numeric_only : bool, default None
    Include only float, int, boolean columns. If None, will attempt to use
    everything, then use only numeric data. Not implemented for Series.
%(min_count)s**kwargs
    Additional keyword arguments to be passed to the function.

Returns
-------
%(outname)s : %(name1)s or %(name2)s (if level specified)
%(see_also)s
%(examples)ss  
%(desc)s

Parameters
----------
axis : %(axis_descr)s
skipna : boolean, default True
    Exclude NA/null values. If an entire row/column is NA, the result
    will be NA
level : int or level name, default None
    If the axis is a MultiIndex (hierarchical), count along a
    particular level, collapsing into a %(name1)s
ddof : int, default 1
    Delta Degrees of Freedom. The divisor used in calculations is N - ddof,
    where N represents the number of elements.
numeric_only : boolean, default None
    Include only float, int, boolean columns. If None, will attempt to use
    everything, then use only numeric data. Not implemented for Series.

Returns
-------
%(outname)s : %(name1)s or %(name2)s (if level specified)
s  
%(desc)s

Parameters
----------
axis : {0 or 'index', 1 or 'columns', None}, default 0
    Indicate which axis or axes should be reduced.

    * 0 / 'index' : reduce the index, return a Series whose index is the
      original column labels.
    * 1 / 'columns' : reduce the columns, return a Series whose index is the
      original index.
    * None : reduce all axes, return a scalar.

bool_only : bool, default None
    Include only boolean columns. If None, will attempt to use everything,
    then use only boolean data. Not implemented for Series.
skipna : bool, default True
    Exclude NA/null values. If the entire row/column is NA and skipna is
    True, then the result will be %(empty_value)s, as for an empty row/column.
    If skipna is False, then NA are treated as True, because these are not
    equal to zero.
level : int or level name, default None
    If the axis is a MultiIndex (hierarchical), count along a
    particular level, collapsing into a %(name1)s.
**kwargs : any, default None
    Additional keywords have no effect but might be accepted for
    compatibility with NumPy.

Returns
-------
%(name1)s or %(name2)s
    If level is specified, then, %(name2)s is returned; otherwise, %(name1)s
    is returned.

%(see_also)s
%(examples)ss   Return whether all elements are True, potentially over an axis.

Returns True unless there at least one element within a series or
along a Dataframe axis that is False or equivalent (e.g. zero or
empty).s  Examples
--------
**Series**

>>> pd.Series([True, True]).all()
True
>>> pd.Series([True, False]).all()
False
>>> pd.Series([]).all()
True
>>> pd.Series([np.nan]).all()
True
>>> pd.Series([np.nan]).all(skipna=False)
True

**DataFrames**

Create a dataframe from a dictionary.

>>> df = pd.DataFrame({'col1': [True, True], 'col2': [True, False]})
>>> df
   col1   col2
0  True   True
1  True  False

Default behaviour checks if column-wise values all return True.

>>> df.all()
col1     True
col2    False
dtype: bool

Specify ``axis='columns'`` to check if row-wise values all return True.

>>> df.all(axis='columns')
0     True
1    False
dtype: bool

Or ``axis=None`` for whether every value is True.

>>> df.all(axis=None)
False
s   See Also
--------
Series.all : Return True if all elements are True.
DataFrame.any : Return True if one (or more) elements are True.
s  
Return cumulative %(desc)s over a DataFrame or Series axis.

Returns a DataFrame or Series of the same size containing the cumulative
%(desc)s.

Parameters
----------
axis : {0 or 'index', 1 or 'columns'}, default 0
    The index or the name of the axis. 0 is equivalent to None or 'index'.
skipna : boolean, default True
    Exclude NA/null values. If an entire row/column is NA, the result
    will be NA.
*args, **kwargs :
    Additional keywords have no effect but might be accepted for
    compatibility with NumPy.

Returns
-------
%(outname)s : %(name1)s or %(name2)s

See Also
--------
core.window.Expanding.%(accum_func_name)s : Similar functionality
    but ignores ``NaN`` values.
%(name2)s.%(accum_func_name)s : Return the %(desc)s over
    %(name2)s axis.
%(name2)s.cummax : Return cumulative maximum over %(name2)s axis.
%(name2)s.cummin : Return cumulative minimum over %(name2)s axis.
%(name2)s.cumsum : Return cumulative sum over %(name2)s axis.
%(name2)s.cumprod : Return cumulative product over %(name2)s axis.

%(examples)s
s  Examples
--------
**Series**

>>> s = pd.Series([2, np.nan, 5, -1, 0])
>>> s
0    2.0
1    NaN
2    5.0
3   -1.0
4    0.0
dtype: float64

By default, NA values are ignored.

>>> s.cummin()
0    2.0
1    NaN
2    2.0
3   -1.0
4   -1.0
dtype: float64

To include NA values in the operation, use ``skipna=False``

>>> s.cummin(skipna=False)
0    2.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64

**DataFrame**

>>> df = pd.DataFrame([[2.0, 1.0],
...                    [3.0, np.nan],
...                    [1.0, 0.0]],
...                    columns=list('AB'))
>>> df
     A    B
0  2.0  1.0
1  3.0  NaN
2  1.0  0.0

By default, iterates over rows and finds the minimum
in each column. This is equivalent to ``axis=None`` or ``axis='index'``.

>>> df.cummin()
     A    B
0  2.0  1.0
1  2.0  NaN
2  1.0  0.0

To iterate over columns and find the minimum in each row,
use ``axis=1``

>>> df.cummin(axis=1)
     A    B
0  2.0  1.0
1  3.0  NaN
2  1.0  0.0
s  Examples
--------
**Series**

>>> s = pd.Series([2, np.nan, 5, -1, 0])
>>> s
0    2.0
1    NaN
2    5.0
3   -1.0
4    0.0
dtype: float64

By default, NA values are ignored.

>>> s.cumsum()
0    2.0
1    NaN
2    7.0
3    6.0
4    6.0
dtype: float64

To include NA values in the operation, use ``skipna=False``

>>> s.cumsum(skipna=False)
0    2.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64

**DataFrame**

>>> df = pd.DataFrame([[2.0, 1.0],
...                    [3.0, np.nan],
...                    [1.0, 0.0]],
...                    columns=list('AB'))
>>> df
     A    B
0  2.0  1.0
1  3.0  NaN
2  1.0  0.0

By default, iterates over rows and finds the sum
in each column. This is equivalent to ``axis=None`` or ``axis='index'``.

>>> df.cumsum()
     A    B
0  2.0  1.0
1  5.0  NaN
2  6.0  1.0

To iterate over columns and find the sum in each row,
use ``axis=1``

>>> df.cumsum(axis=1)
     A    B
0  2.0  3.0
1  3.0  NaN
2  1.0  1.0
s  Examples
--------
**Series**

>>> s = pd.Series([2, np.nan, 5, -1, 0])
>>> s
0    2.0
1    NaN
2    5.0
3   -1.0
4    0.0
dtype: float64

By default, NA values are ignored.

>>> s.cumprod()
0     2.0
1     NaN
2    10.0
3   -10.0
4    -0.0
dtype: float64

To include NA values in the operation, use ``skipna=False``

>>> s.cumprod(skipna=False)
0    2.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64

**DataFrame**

>>> df = pd.DataFrame([[2.0, 1.0],
...                    [3.0, np.nan],
...                    [1.0, 0.0]],
...                    columns=list('AB'))
>>> df
     A    B
0  2.0  1.0
1  3.0  NaN
2  1.0  0.0

By default, iterates over rows and finds the product
in each column. This is equivalent to ``axis=None`` or ``axis='index'``.

>>> df.cumprod()
     A    B
0  2.0  1.0
1  6.0  NaN
2  6.0  0.0

To iterate over columns and find the product in each row,
use ``axis=1``

>>> df.cumprod(axis=1)
     A    B
0  2.0  2.0
1  3.0  NaN
2  1.0  0.0
s  Examples
--------
**Series**

>>> s = pd.Series([2, np.nan, 5, -1, 0])
>>> s
0    2.0
1    NaN
2    5.0
3   -1.0
4    0.0
dtype: float64

By default, NA values are ignored.

>>> s.cummax()
0    2.0
1    NaN
2    5.0
3    5.0
4    5.0
dtype: float64

To include NA values in the operation, use ``skipna=False``

>>> s.cummax(skipna=False)
0    2.0
1    NaN
2    NaN
3    NaN
4    NaN
dtype: float64

**DataFrame**

>>> df = pd.DataFrame([[2.0, 1.0],
...                    [3.0, np.nan],
...                    [1.0, 0.0]],
...                    columns=list('AB'))
>>> df
     A    B
0  2.0  1.0
1  3.0  NaN
2  1.0  0.0

By default, iterates over rows and finds the maximum
in each column. This is equivalent to ``axis=None`` or ``axis='index'``.

>>> df.cummax()
     A    B
0  2.0  1.0
1  3.0  NaN
2  3.0  1.0

To iterate over columns and find the maximum in each row,
use ``axis=1``

>>> df.cummax(axis=1)
     A    B
0  2.0  2.0
1  3.0  NaN
2  1.0  1.0
s2  See Also
--------
numpy.any : Numpy version of this method.
Series.any : Return whether any element is True.
Series.all : Return whether all elements are True.
DataFrame.any : Return whether any element is True over requested axis.
DataFrame.all : Return whether all elements are True over requested axis.
s   Return whether any element is True, potentially over an axis.

Returns False unless there at least one element within a series or
along a Dataframe axis that is True or equivalent (e.g. non-zero or
non-empty).sK  Examples
--------
**Series**

For Series input, the output is a scalar indicating whether any element
is True.

>>> pd.Series([False, False]).any()
False
>>> pd.Series([True, False]).any()
True
>>> pd.Series([]).any()
False
>>> pd.Series([np.nan]).any()
False
>>> pd.Series([np.nan]).any(skipna=False)
True

**DataFrame**

Whether each column contains at least one True element (the default).

>>> df = pd.DataFrame({"A": [1, 2], "B": [0, 2], "C": [0, 0]})
>>> df
   A  B  C
0  1  0  0
1  2  2  0

>>> df.any()
A     True
B     True
C    False
dtype: bool

Aggregating over the columns.

>>> df = pd.DataFrame({"A": [True, False], "B": [1, 2]})
>>> df
       A  B
0   True  1
1  False  2

>>> df.any(axis='columns')
0    True
1    True
dtype: bool

>>> df = pd.DataFrame({"A": [True, False], "B": [1, 0]})
>>> df
       A  B
0   True  1
1  False  0

>>> df.any(axis='columns')
0    True
1    False
dtype: bool

Aggregating over the entire DataFrame with ``axis=None``.

>>> df.any(axis=None)
True

`any` for an empty DataFrame is an empty Series.

>>> pd.DataFrame([]).any()
Series([], dtype: bool)
s  Examples
--------

>>> idx = pd.MultiIndex.from_arrays([
...     ['warm', 'warm', 'cold', 'cold'],
...     ['dog', 'falcon', 'fish', 'spider']],
...     names=['blooded', 'animal'])
>>> s = pd.Series([4, 2, 0, 8], name='legs', index=idx)
>>> s
blooded  animal
warm     dog       4
         falcon    2
cold     fish      0
         spider    8
Name: legs, dtype: int64

>>> s.{stat_func}()
{default_output}

{verb} using level names, as well as indices.

>>> s.{stat_func}(level='blooded')
blooded
warm    {level_output_0}
cold    {level_output_1}
Name: legs, dtype: int64

>>> s.{stat_func}(level=0)
blooded
warm    {level_output_0}
cold    {level_output_1}
Name: legs, dtype: int64
t   stat_func_examplet	   stat_funcRS  t   verbt   Sumt   default_outputi   t   level_output_0i   t   level_output_1i   s  
By default, the sum of an empty or all-NA Series is ``0``.

>>> pd.Series([]).sum()  # min_count=0 is the default
0.0

This can be controlled with the ``min_count`` parameter. For example, if
you'd like the sum of an empty series to be NaN, pass ``min_count=1``.

>>> pd.Series([]).sum(min_count=1)
nan

Thanks to the ``skipna`` parameter, ``min_count`` handles all-NA and
empty series identically.

>>> pd.Series([np.nan]).sum()
0.0

>>> pd.Series([np.nan]).sum(min_count=1)
nan
R  t   Maxi   R  t   Mini    i   s  
See Also
--------
Series.sum : Return the sum.
Series.min : Return the minimum.
Series.max : Return the maximum.
Series.idxmin : Return the index of the minimum.
Series.idxmax : Return the index of the maximum.
DataFrame.min : Return the sum over the requested axis.
DataFrame.min : Return the minimum over the requested axis.
DataFrame.max : Return the maximum over the requested axis.
DataFrame.idxmin : Return the index of the minimum over the requested axis.
DataFrame.idxmax : Return the index of the maximum over the requested axis.
s  Examples
--------
By default, the product of an empty or all-NA Series is ``1``

>>> pd.Series([]).prod()
1.0

This can be controlled with the ``min_count`` parameter

>>> pd.Series([]).prod(min_count=1)
nan

Thanks to the ``skipna`` parameter, ``min_count`` handles all-NA and
empty series identically.

>>> pd.Series([np.nan]).prod()
1.0

>>> pd.Series([np.nan]).prod(min_count=1)
nan
sl  min_count : int, default 0
    The required number of valid values to perform the operation. If fewer than
    ``min_count`` non-NA values are present the result will be NA.

    .. versionadded :: 0.22.0

       Added with the default being 0. This means the sum of an all-NA
       or empty Series is 0, and the product of an all-NA or empty
       Series is 1.
R<  c	   
         sv   t  d  d | d | d | d | d t d | d |  t t  d  d  d  d  d	    f d
    }	 t |	  |   S(   NRq  Rs  Rt  Ru  Rv  Rw  Rx  Ry  i    c            s    d k r" t  j t   |  n;  d k rD t  j t   |  n t  j t   | d  | d  k rr t } n  | d  k r |  j } n  | d  k	 r |  j  d | d | d | d | S|  j	    d | d | d | d | S(	   NRS  R   t   fnameRr   R   Rl  Rw  R  (
   R   t   validate_sumR   t   validate_prodt   validate_stat_funcRs   R   R   Ro  t   _reduce(   RZ   Rr   Rl  R   R  Rw  R   (   R  R   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  *  s    	(   R   t   _min_count_stubR   R  Rs   R
   (
   R   R   Rt  Ru  Rv  Rs  R  Rx  Ry  R  (    (   R  R   s2   lib/python2.7/site-packages/pandas/core/generic.pyR  *  s    	c	   
         ss   t  d  d | d | d | d | d d d | d	 |  t t  d  d  d  d     f d
    }	 t |	  |   S(   NRq  Rs  Rt  Ru  Rv  Rw  R<  Rx  Ry  c      	      s    d k r" t  j t   |  n t  j t   | d  | d  k rP t } n  | d  k rh |  j } n  | d  k	 r |  j  d | d | d | S|  j    d | d | d | S(   NR  R  Rr   R   Rl  R  (	   R   t   validate_medianR   R  Rs   R   R   Ro  R  (   RZ   Rr   Rl  R   R  R   (   R  R   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  *  s    	(   R   R   R  Rs   R
   (
   R   R   Rt  Ru  Rv  Rs  R  Rx  Ry  R  (    (   R  R   s2   lib/python2.7/site-packages/pandas/core/generic.pyR  *  s    	$c            sd   t  d  d | d | d | d |  t t  d  d  d  d d     f d    } t |  |   S(   NRq  Rs  Rt  Ru  Rv  i   c            s   t  j t   | d  | d  k r. t } n  | d  k rF |  j } n  | d  k	 rw |  j  d | d | d | d | S|  j    d | d | d | d | S(   NR  Rr   R   Rl  t   ddofR  (   R   t   validate_stat_ddof_funcR   Rs   R   R   Ro  R  (   RZ   Rr   Rl  R   R  R  R   (   R  R   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyR  *  s    	(   R   R   t   _num_ddof_docRs   R
   (   R   R   Rt  Ru  Rv  Rs  R  R  (    (   R  R   s2   lib/python2.7/site-packages/pandas/core/generic.pyR  *  s    	c            sm   t  d  d | d | d | d | d | d |
  t t  d  t      f d    } t |  |   S(	   NRq  Rs  Rt  Ru  Rv  t   accum_func_nameRy  c   	         sV  t  j | | |   } | d  k r0 |  j } n |  j |  } t j |   j   } | r t | j	 j
 t j t j f  r   | |  } t |   } t j | | t  n{ | rt | j	 j
 t j t j f  rt |   } t j | |     | |  } t j | |   n   | |  } |  j   } t | d <|  j | |  j |   S(   NRQ   (   R   t   validate_cum_func_with_skipnaRs   R   R   R	  R  RQ   t
   issubclassRK   RO   R   t
   datetime64t   timedelta64R-   R   R   t   integerR*  R   R   R   RW   (	   RZ   Rr   Rl  R   R   R  R_   RI   R   (   t
   accum_funct   mask_at   mask_bR   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   cum_func*  s&    !(
(   R   R   t	   _cnum_docRs   R   R
   (   R   R   Rt  Ru  Rv  Rs  R  R  R  R  Ry  R  (    (   R  R  R  R   s2   lib/python2.7/site-packages/pandas/core/generic.pyR  *  s    	$c
            ss   t  d  d | d | d | d | d | d | d |	  t t  d	 d  t d     f d
    }
 t |
  |   S(   NRq  Rs  Rt  Ru  Rv  Rx  Ry  Rp  i    c            s   t  j t   | d  | d  k	 r_ | d  k	 r@ t d   n  |  j  d | d | d | S|  j    d | d | d | d d S(	   NR  s6   Option bool_only is not implemented with option level.Rr   R   Rl  R  t   filter_typeR)  (   R   t   validate_logical_funcR   Rs   R   Ro  R  (   RZ   Rr   t	   bool_onlyRl  R   R   (   R  R   (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   logical_func
+  s    (   R   R   t	   _bool_docRs   R   R
   (   R   R   Rt  Ru  Rv  Rs  R  Rx  Ry  Rp  R   (    (   R  R   s2   lib/python2.7/site-packages/pandas/core/generic.pyR  +  s    	$(   Ro  R  R    R  R  Rl  R  t   textwrapR   R   R  t   numpyR   t   pandas._libsR   R   R   t   pandas.compatR  R   R  R   R   R   R	   R
   R   R   R   t   pandas.compat.numpyR   R   t   pandas.errorsR   t   pandas.util._decoratorsR   R   R   t   pandas.util._validatorsR   R   t   pandas.core.dtypes.castR   R   t   pandas.core.dtypes.commonR   R   R   R   R   R   R   R   R   R    R!   R"   R#   R$   R%   R&   R'   R(   t   pandas.core.dtypes.genericR)   R*   R+   t   pandas.core.dtypes.inferenceR,   t   pandas.core.dtypes.missingR-   R.   R  RU   R  R/   R0   R1   t   pandas.core.algorithmst   coret
   algorithmsR  t   pandas.core.baseR2   R3   t   pandas.core.commont   commonR	  t   pandas.core.indexR4   R5   R6   R7   R8   t   pandas.core.indexes.datetimesR9   t   pandas.core.indexes.periodR:   R;   t   pandas.core.indexingt   indexingt   pandas.core.internalsR<   t   pandas.core.opsR=   t   pandas.io.formats.formatR>   R?   t   pandas.io.formats.printingR@   t   pandas.tseries.frequenciesRA   R   R  R  Rw   R   Ra   RD   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  RN   R  R  R  R  R  R  R  R  R  R  R  t   get_indexers_listRg   R  R  (    (    (    s2   lib/python2.7/site-packages/pandas/core/generic.pyt   <module>   s  @v(				                                       	"&."AAAA
F#
					#	