
x\c           @   s*  d  Z  d d l m Z d d l m Z d d l Z d d l Z d d l m	 Z	 m
 Z m Z m Z d d l j Z d d l m Z m Z m Z m Z m Z d d l m Z d d l m Z m Z m Z d d	 l m Z d d
 l m Z m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& m' Z' m( Z( m) Z) m* Z* m+ Z+ m, Z, m- Z- m. Z. d d l/ m0 Z0 m1 Z1 m2 Z2 m3 Z3 m4 Z4 m5 Z5 d d l6 m7 Z7 m8 Z8 m9 Z9 m: Z: d d l; m< Z< m= Z= m> Z> m? Z? m@ Z@ d d lA mB ZB d d lC mD ZD mE ZE d d lF mG ZG mH ZH d d lI mJ ZJ d d lK jL jM ZN d d lO mP ZP d d lQ mR ZR mS ZS mT ZT mU ZU mV ZV d d lW mX ZX d d lY jL jZ j= Z[ d d l\ m] Z] d d l^ m_ Z_ d d l` ma Za d d lb mc Zc md Zd d d le mf Zf d d lg mh Zh d d li mj Zj d d lk ml Zl d d lm jn jo jp Zq d d lr ms Zs d d lt ju jv Zw d g Zx ey d d  d! d d" d# d$ d% d& d' d( d) d* d d+ d, d- d, d. d, d/ d, d0 d1  Zz d2   Z{ d3   Z| d e= j} e> j~ f d4     YZ e j d  g d5 d6 d7 d6 d8 i d6 d9 6d: i d; d  6e j   e j   e j   e@ j e  e@ j e  d S(<   sG   
Data structure for 1-dimensional cross-sectional and time series data
i(   t   division(   t   dedentN(   t   iNaTt   indext   libt   tslibs(   t   PY36t   OrderedDictt   StringIOt   ut   zip(   t   function(   t   Appendert   Substitutiont	   deprecate(   t   validate_bool_kwarg(   t   _is_unorderable_exceptiont   ensure_platform_intt   is_boolt   is_categorical_dtypet   is_datetime64_dtypet   is_datetimeliket   is_dict_liket   is_extension_array_dtypet   is_extension_typet   is_hashablet
   is_integert   is_iteratort   is_list_liket	   is_scalart   is_string_liket   is_timedelta64_dtype(   t   ABCDataFramet   ABCDatetimeArrayt   ABCDatetimeIndext	   ABCSeriest   ABCSparseArrayt   ABCSparseSeries(   t   isnat   na_value_for_dtypet   notnat   remove_na_arraylike(   t
   algorithmst   baset   generict   nanopst   ops(   t   CachedAccessor(   t   ExtensionArrayt   SparseArray(   t   Categoricalt   CategoricalAccessor(   t   SparseAccessor(   t
   get_option(   t   Float64Indext   Indext   InvalidIndexErrort
   MultiIndext   ensure_index(   t   CombinedDatetimelikeProperties(   t   DatetimeIndex(   t   PeriodIndex(   t   TimedeltaIndex(   t   check_bool_indexert   maybe_convert_indices(   t   SingleBlockManager(   t   sanitize_array(   t   StringMethods(   t   to_datetime(   t   get_terminal_sizet   Seriest   axesR   t   klasst   axes_single_args   {0 or 'index'}t   axissP   axis : {0 or 'index'}
        Parameter needed for compatibility with DataFrame.t   inplaces^   inplace : boolean, default False
        If True, performs operation inplace and returns None.t   uniques
   np.ndarrayt
   duplicatedt   optional_byt    t   optional_mappert   optional_labelst   optional_axist   versionadded_to_excels   
    .. versionadded:: 0.20.0
c         C   s    t  j d t d d t |   S(   sw   
    Remove null values from array like structure.

    .. deprecated:: 0.21.0
        Use s[s.notnull()] instead.
    s>   remove_na is deprecated and is a private function. Do not use.t
   stackleveli   (   t   warningst   warnt   FutureWarningR)   (   t   arr(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt	   remove_naG   s    	c            s+     f d   } d j  d   j  | _ | S(   s.   
    Install the scalar coercion methods.
    c            sB   t  |   d k r#   |  j d  St d j t       d  S(   Ni   i    s    cannot convert the series to {0}(   t   lent   iloct	   TypeErrort   formatt   str(   t   self(   t	   converter(    s1   lib/python2.7/site-packages/pandas/core/series.pyt   wrapperY   s    	s
   __{name}__t   name(   R]   t   __name__(   R`   Ra   (    (   R`   s1   lib/python2.7/site-packages/pandas/core/series.pyt   _coerce_methodT   s    c           B   s	  e  Z d  Z d g Z d d d d h Z e j j e d d d d	 d
 d d g  BZ e	 e
 j j j d e
 j j j Z d d d d e e d  Z d d d  Z e d d d 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 j d    Z e	 d    Z e	 d    Z e	 d    Z e	 d    Z  e	 d    Z! e	 d    Z" d   Z# d    Z$ e	 d!    Z% d" d#  Z& d$   Z' d%   Z( d&   Z) d'   Z* d d(  Z+ d d)  Z, d d*  Z- d d+  Z. e	 d,    Z/ e/ j d-    Z/ e	 d.    Z0 e0 j d/    Z0 e1 e2  Z3 e1 e4  Z5 e1 e4  Z6 d0   Z7 e	 d1    Z8 d2 d3  Z9 e	 d4    Z: d2 d d5  Z; d6   Z< d7   Z= d8   Z> d9   Z? d:   Z@ d;   ZA d<   ZB d=   ZC d>   ZD d d?  ZE e d@  ZF e dA  ZG eF j eG _ e dB  ZH e dC  ZI eH j eI _ d e d e dD  ZJ dE   ZK d dF d eL eL e e e d dG 	 ZM dH   ZN eN ZO dI   ZP eQ dJ  ZR d dK  ZS dL d dM  ZT e dN  ZU d dO  ZV eL dP  ZW dQ   ZX dR e dS  ZY dR dT  ZZ d2 eL dU  Z[ d2 eL dV  Z\ e] dW e[ dX dY e^ dZ  Z_ e] d[ e\ dX dY e^ d\  Z` d2 d]  Za d^ d_ d`  Zb da d db  Zc d dc  Zd dd de  Ze dd df  Zf dg   Zg dh   Zh di   Zi ej dj dk  ek e
 jl dl  dm d dn    Zm e e do  Zn d d dp  Zo d dq  Zp dr   Zq ds   Zr d2 eL e dt du dv  Zs d2 d eL e dt du eL dw  Zt d2 dt d dx  Zu dy dR dz  Zv dy dR d{  Zw d| d} eL d~  Zx d   Zy d} d d  Zz d d  Z{ d d  Z| e^ d  Z} e^ d  Z~ ej d e} d e~ d d e  ek e jl d  d2 d    Z e Z ek e jl d e  d2 d   Z eL d d  Z d2 eL d d d  Z d   Z d   Z ek e jl d e  d d d eL d d d d2 d d 	  Z d d  Z ej e   ek e j j j  d d    Z d d2 d d d e d d  Z ej e   ek e j j j  d d d e d d d    Z ek e jl d e  d d e d e d d   Z ek e jl d e  dd d d2 d d   Z d2 d  Z eL e d  Z ek e j j j  d2 e d   Z d   Z eL d  Z e d eL d d2 d e d   Z ek e j j j  d    Z ek e jl d e  d    Z ek e jl d e  d    Z ek e jl d e  d    Z ek e jl d e  d    Z d2 e d  Z e d  Z d d eL d  Z d eL d  Z e d e  Z e d e  Z e d e  Z e d e j  Z e d e  Z e j Z RS(   s  
    One-dimensional ndarray with axis labels (including time series).

    Labels need not be unique but must be a hashable type. The object
    supports both integer- and label-based indexing and provides a host of
    methods for performing operations involving the index. Statistical
    methods from ndarray have been overridden to automatically exclude
    missing data (currently represented as NaN).

    Operations between Series (+, -, /, *, **) align values based on their
    associated index values-- they need not be the same length. The result
    index will be the sorted union of the two indexes.

    Parameters
    ----------
    data : array-like, Iterable, dict, or scalar value
        Contains data stored in Series.

        .. versionchanged :: 0.23.0
           If data is a dict, argument order is maintained for Python 3.6
           and later.

    index : array-like or Index (1d)
        Values must be hashable and have the same length as `data`.
        Non-unique index values are allowed. Will default to
        RangeIndex (0, 1, 2, ..., n) if not provided. If both a dict and index
        sequence are used, the index will override the keys found in the
        dict.
    dtype : str, numpy.dtype, or ExtensionDtype, optional
        dtype for the output Series. If not specified, this will be
        inferred from `data`.
        See the :ref:`user guide <basics.dtypes>` for more usages.
    copy : bool, default False
        Copy input data.
    Rb   t   dtt   catR^   t   sparset   asobjectt   reshapet	   get_valuet	   set_valuet   from_csvt   validt   tolistt   docc         C   s^  | r] t  | t  s- t | | d t } n  | rB | j   } n  | d  k r"| j } q"n| d  k	 rx t |  } n  | d  k r i  } n  | d  k	 r |  j |  } n  t  | t  r t	 d   n-t  | t
  r\| d  k r | j } n  | d  k	 r| j |  } nE | j j   } t  | t  rS| j d  k	 rS| j j d t  } n  t } nt  | t j  rqnt  | t t f  r| d  k r| j } n  | d  k r| j } n | j | d | } | j } nt  | t  r|  j | | |  \ } } d  } t } n t  | t  rb| d  k r7| j } q| j j |  sP| rt d   qn t |  rqn t  | t t f  rt d j | j  j!    nR t  | t" j#  rt  | t" j$  rt% |  } n t  | t&  r| j'   } n  | d  k r2t( |  s| g } n  t) j* t+ |   } nl t( |  ryI t+ |  t+ |  k rt, d j d t+ |  d	 t+ |     n  Wqt k
 rqXn  t  | t  r| d  k	 r| j d
 | d d d |  } q"| r"| j   } q"n0 t- | | | | d t } t | | d t } t. j/ j0 |  | d t | |  _ |  j1 d | d t d  S(   Nt   fastpaths8   initializing a Series from a MultiIndex is not supportedt   deept   copysl   Cannot pass both SingleBlockManager `data` argument and a different `index` argument.  `copy` must be False.s   {0!r} type is unordereds5   Length of passed values is {val}, index implies {ind}t   valt   indt   dtypet   errorst   ignoret   raise_cast_failurei    (2   t
   isinstanceRA   t   TrueRr   t   NoneR   R:   t   _validate_dtypeR9   t   NotImplementedErrorR7   Rb   t   astypet   _valuesR"   t   tzt   Falset   npt   ndarrayR#   R%   t   reindext   _datat   dictt
   _init_dictt   equalst   AssertionErrorR   t   sett	   frozensetR\   R]   t	   __class__Rc   t   compatt   Iterablet   Sizedt   listR$   t   to_denseR   t   ibaset   default_indexRZ   t
   ValueErrorRB   R,   t   NDFramet   __init__t	   _set_axis(   R_   t   dataR   Ru   Rb   Rr   Rp   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR      s    					%		c         C   s   | r0 t  t j |    \ } } t |  } n. | d k	 rQ t |  } | } n g  g  } } t | d | d | } | r | d k	 r | j | d t } nD t	 r t
 | t  r | r y | j   } Wq t k
 r q Xn  | j | j f S(   s1  
        Derive the "_data" and "index" attributes of a new Series from a
        dictionary input.

        Parameters
        ----------
        data : dict or dict-like
            Data used to populate the new Series
        index : Index or index-like, default None
            index for the new Series: if None, use dict keys
        dtype : dtype, default None
            dtype for the new Series: if None, infer from data

        Returns
        -------
        _data : BlockManager for the new Series
        index : index for the new Series
        R   Ru   Rr   N(   R
   R   t	   iteritemsR   R{   R'   RF   R   R   R   Ry   R   t
   sort_indexR\   R   R   (   R_   R   R   Ru   t   keyst   valuest   s(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s     	c         C   sf   t  j d t d d t | t  r> d d l m } | }  n  |  | d | d | d | d	 | d
 | S(   s   
        Construct Series from array.

        .. deprecated :: 0.23.0
            Use pd.Series(..) constructor instead.
        su   'from_array' is deprecated and will be removed in a future version. Please use the pd.Series(..) constructor instead.RT   i   i(   t   SparseSeriesR   Rb   Ru   Rr   Rp   (   RU   RV   RW   Ry   R$   t   pandas.core.sparse.seriesR   (   t   clsRX   R   Rb   Ru   Rr   Rp   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt
   from_array>  s    			c         C   s   t  S(   N(   RF   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _constructorR  s    c         C   s   d d l  m } | S(   Ni(   t	   DataFrame(   t   pandas.core.frameR   (   R_   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _constructor_expanddimV  s    c         C   s
   |  j  j S(   N(   R   t   _can_hold_na(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR   \  s    c         C   s   | s t  |  } n  | j } | r t | t t t f  s y, t |  } | rg |  j j | |  n  Wq t j	 t
 f k
 r q Xq n  |  j |  t j |  d |  | s |  j j | |  n  d S(   sA   
        Override generic, we want to set the _typ here.
        t   _indexN(   R:   t   is_all_datesRy   R<   R=   R>   R   t   set_axisR   t   OutOfBoundsDatetimeR   t   _set_subtypt   objectt   __setattr__(   R_   RJ   t   labelsRp   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR   b  s     	
c         C   s3   | r t  j |  d d  n t  j |  d d  d  S(   Nt   _subtypt   time_seriest   series(   R   R   (   R_   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR   ~  s    c         K   s   t  j j |  | |  S(   N(   R,   R   t   _update_inplace(   R_   t   resultt   kwargs(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    c         C   s   |  j  S(   s,   
        Return name of the Series.
        (   t   _name(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRb     s    c         C   s?   | d  k	 r( t |  r( t d   n  t j |  d |  d  S(   Ns#   Series.name must be a hashable typeR   (   R{   R   R\   R   R   (   R_   t   value(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRb     s    c         C   s
   |  j  j S(   sA   
        Return the dtype object of the underlying data.
        (   R   Ru   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRu     s    c         C   s
   |  j  j S(   sA   
        Return the dtype object of the underlying data.
        (   R   Ru   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   dtypes  s    c         C   s
   |  j  j S(   s5   
        Return if the data is sparse|dense.
        (   R   t   ftype(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    c         C   s
   |  j  j S(   s5   
        Return if the data is sparse|dense.
        (   R   R   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   ftypes  s    c         C   s   |  j  j   S(   s  
        Return Series as ndarray or ndarray-like depending on the dtype.

        .. warning::

           We recommend using :attr:`Series.array` or
           :meth:`Series.to_numpy`, depending on whether you need
           a reference to the underlying data or a NumPy array.

        Returns
        -------
        arr : numpy.ndarray or ndarray-like

        See Also
        --------
        Series.array : Reference to the underlying data.
        Series.to_numpy : A NumPy array representing the underlying data.

        Examples
        --------
        >>> pd.Series([1, 2, 3]).values
        array([1, 2, 3])

        >>> pd.Series(list('aabc')).values
        array(['a', 'a', 'b', 'c'], dtype=object)

        >>> pd.Series(list('aabc')).astype('category').values
        [a, a, b, c]
        Categories (3, object): [a, b, c]

        Timezone aware datetime data is converted to UTC:

        >>> pd.Series(pd.date_range('20130101', periods=3,
        ...                         tz='US/Eastern')).values
        array(['2013-01-01T05:00:00.000000000',
               '2013-01-02T05:00:00.000000000',
               '2013-01-03T05:00:00.000000000'], dtype='datetime64[ns]')
        (   R   t   external_values(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    (c         C   s   |  j  j   S(   s8   
        Return the internal repr of this data.
        (   R   t   internal_values(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    c         C   s   |  j  j   S(   ss   
        Return the values that can be formatted (used by SeriesFormatter
        and DataFrameFormatter).
        (   R   t   formatting_values(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _formatting_values  s    c         C   s   |  j  j   S(   sQ   
        Same as values (but handles sparseness conversions); is a view.
        (   R   t
   get_values(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    c         C   s&   t  j d t d d |  j t  j S(   s   
        Return object Series which contains boxed values.

        .. deprecated :: 0.23.0

           Use ``astype(object)`` instead.

        *this is an internal non-public method*
        s6   'asobject' is deprecated. Use 'astype(object)' insteadRT   i   (   RU   RV   RW   R~   R   R   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRh     s    	t   Cc         C   s   |  j  j d |  S(   s   
        Return the flattened underlying data as an ndarray.

        See Also
        --------
        numpy.ndarray.ravel
        t   order(   R   t   ravel(   R_   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR      s    c         O   s4   d } t  j | t d d t j | |  |  | S(   s   
        Return selected slices of an array along given axis as a Series.

        .. deprecated:: 0.24.0

        See Also
        --------
        numpy.ndarray.compress
        sv   Series.compress(condition) is deprecated. Use 'Series[condition]' or 'np.asarray(series).compress(condition)' instead.RT   i   (   RU   RV   RW   t   nvt   validate_compress(   R_   t	   conditiont   argsR   t   msg(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   compress
  s    
c         C   s)   d } t  j | t d d |  j j   S(   s  
        Return the *integer* indices of the elements that are non-zero.

        .. deprecated:: 0.24.0
           Please use .to_numpy().nonzero() as a replacement.

        This method is equivalent to calling `numpy.nonzero` on the
        series data. For compatibility with NumPy, the return value is
        the same (a tuple with an array of indices for each dimension),
        but it will always be a one-item tuple because series only have
        one dimension.

        See Also
        --------
        numpy.nonzero

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

        >>> s = pd.Series([0, 3, 0, 4], index=['a', 'b', 'c', 'd'])
        # same return although index of s is different
        >>> s.nonzero()
        (array([1, 3]),)
        >>> s.iloc[s.nonzero()[0]]
        b    3
        d    4
        dtype: int64
        sn   Series.nonzero() is deprecated and will be removed in a future version.Use Series.to_numpy().nonzero() insteadRT   i   (   RU   RV   RW   R   t   nonzero(   R_   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    $c         O   s   |  j  j | |   d S(   s   
        Applies the `put` method to its `values` attribute if it has one.

        See Also
        --------
        numpy.ndarray.put
        N(   R   t   put(   R_   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR   E  s    c         C   s   t  |  j  S(   s2   
        Return the length of the Series.
        (   RZ   R   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   __len__O  s    c         C   s+   |  j  |  j j |  d |  j j |   S(   s  
        Create a new view of the Series.

        This function will return a new Series with a view of the same
        underlying values in memory, optionally reinterpreted with a new data
        type. The new data type must preserve the same size in bytes as to not
        cause index misalignment.

        Parameters
        ----------
        dtype : data type
            Data type object or one of their string representations.

        Returns
        -------
        Series
            A new Series object as a view of the same data in memory.

        See Also
        --------
        numpy.ndarray.view : Equivalent numpy function to create a new view of
            the same data in memory.

        Notes
        -----
        Series are instantiated with ``dtype=float64`` by default. While
        ``numpy.ndarray.view()`` will return a view with the same data type as
        the original array, ``Series.view()`` (without specified dtype)
        will try using ``float64`` and may fail if the original data type size
        in bytes is not the same.

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

        The 8 bit signed integer representation of `-1` is `0b11111111`, but
        the same bytes represent 255 if read as an 8 bit unsigned integer:

        >>> us = s.view('uint8')
        >>> us
        0    254
        1    255
        2      0
        3      1
        4      2
        dtype: uint8

        The views share the same underlying values:

        >>> us[0] = 128
        >>> s
        0   -128
        1     -1
        2      0
        3      1
        4      2
        dtype: int8
        R   (   R   R   t   viewR   t   __finalize__(   R_   Ru   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR   U  s    Bc         C   sk   | d k rX t |  j t  rX t |  j d d  rX d } t j | t d d d } n  t	 j
 |  j |  S(   s(  
        Return the values as a NumPy array.

        Users should not call this directly. Rather, it is invoked by
        :func:`numpy.array` and :func:`numpy.asarray`.

        Parameters
        ----------
        dtype : str or numpy.dtype, optional
            The dtype to use for the resulting NumPy array. By default,
            the dtype is inferred from the data.

        Returns
        -------
        numpy.ndarray
            The values in the series converted to a :class:`numpy.ndarary`
            with the specified `dtype`.

        See Also
        --------
        pandas.array : Create a new array from data.
        Series.array : Zero-copy view to the array backing the Series.
        Series.to_numpy : Series method for similar behavior.

        Examples
        --------
        >>> ser = pd.Series([1, 2, 3])
        >>> np.asarray(ser)
        array([1, 2, 3])

        For timezone-aware data, the timezones may be retained with
        ``dtype='object'``

        >>> tzser = pd.Series(pd.date_range('2000', periods=2, tz="CET"))
        >>> np.asarray(tzser, dtype="object")
        array([Timestamp('2000-01-01 00:00:00+0100', tz='CET', freq='D'),
               Timestamp('2000-01-02 00:00:00+0100', tz='CET', freq='D')],
              dtype=object)

        Or the values may be localized to UTC and the tzinfo discared with
        ``dtype='datetime64[ns]'``

        >>> np.asarray(tzser, dtype="datetime64[ns]")  # doctest: +ELLIPSIS
        array(['1999-12-31T23:00:00.000000000', ...],
              dtype='datetime64[ns]')
        R   sN  Converting timezone-aware DatetimeArray to timezone-naive ndarray with 'datetime64[ns]' dtype. In the future, this will return an ndarray with 'object' dtype where each element is a 'pandas.Timestamp' with the correct 'tz'.
	To accept the future behavior, pass 'dtype=object'.
	To keep the old behavior, pass 'dtype="datetime64[ns]"'.RT   i   s   M8[ns]N(   R{   Ry   t   arrayR!   t   getattrRu   RU   RV   RW   R   t   asarray(   R_   Ru   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt	   __array__  s    /	c         C   s%   |  j  | d |  j d t j |   S(   s,   
        Gets called after a ufunc.
        R   Rr   (   R   R   R   R   (   R_   R   t   context(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   __array_wrap__  s    c      	   C   s   | d k	 r t |  j t j t f  s: t |  j t  r | d d } t d j d t	 |  j
 d t | d d  d | d j
    n  | S(   s/   
        Gets called prior to a ufunc.
        i   i    s9   {obj} with dtype {dtype} cannot perform the numpy op {op}t   objRu   t   opN(   R{   Ry   R   R   R   R0   R2   R\   R]   t   typeRc   R   (   R_   R   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   __array_prepare__  s    c         C   s
   |  j  j S(   s2   
        Return the real value of vector.
        (   R   t   real(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    c         C   s   | |  j  _ d  S(   N(   R   R   (   R_   t   v(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    c         C   s
   |  j  j S(   s.   
        Return imag value of vector.
        (   R   t   imag(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR      s    c         C   s   | |  j  _ d  S(   N(   R   R   (   R_   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    c         C   s   t  | t  r; | d |  _ | d |  _ |  j j |  _ n t  | t  r | \ } } t j | d d | d } t j j	 | |  | d d  } } t |  d k r | d } n  t | | d t |  _ | |  _ | |  _ n t d |   d  S(	   NR   Rb   i   Ru   i   i    Rp   s&   cannot unpickle legacy formats -> [%s](   Ry   R   R   Rb   R   t   tupleR   t   emptyR   t   __setstate__R{   RZ   RA   Rz   R   t	   Exception(   R_   t   statet   nd_statet	   own_stateR   R   Rb   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _unpickle_series_compat  s    	c         C   s
   |  j  g S(   s7   
        Return a list of the row axis labels.
        (   R   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRG   0  s    i    c         C   s   y7 |  j  } t | t j  r. t j | |  S| | SWn t k
 rM   n t k
 r t | t  r |  j	 j
 | d d } |  j |  S|  j	 | } t | t  r |  j | d | d t St j |  |  Sn Xd S(   s   
        Return the i-th value or values in the Series by location.

        Parameters
        ----------
        i : int, slice, or sequence of integers

        Returns
        -------
        value : scalar (int) or Series (slice, sequence)
        t   kindR[   RJ   t   convertN(   R   Ry   R   R   t   libindext   get_value_att
   IndexErrorR   t   sliceR   t   _convert_slice_indexert   _get_valuesR7   t   takeRz   (   R_   t   iRJ   R   t   indexert   label(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _ixs7  s    	c         C   s   t  S(   N(   R   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _is_mixed_typeX  s    c         C   s+   |  j  j | d | p d } |  j |  S(   NR   t   getitem(   R   R   R   (   R_   t   slobjRJ   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _slice\  s    c         C   s  t  j | |   } y |  j j |  |  } t |  s t |  r t | t  r yS t |  j j |   s |  j	 | d | g t
 |  d |  j j |   } n  Wq t k
 r q Xq n  | SWn t k
 r n t t f k
 rst | t  rt |  j t  rq| t k r|  St  j |  r0q|  j j | d d } t |  t |  k rm|  j |  S  n t k
 r  n Xt |  rt |  } n  t  j |  rt |  j |  } n  |  j |  S(   NR   Ru   R   R   (   t   comt   apply_if_callableR   Rj   R   R   Ry   RF   t   get_locR   RZ   Ru   R   t   KeyErrorR8   R   R   R9   t   Ellipsist   is_bool_indexert   _convert_scalar_indexerR   t   __getitem__R   R   R   R?   t	   _get_with(   R_   t   keyR   t   new_key(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR   a  sD    
!	c         C   s  t  | t  r4 |  j j | d d } |  j |  St  | t  rR t d   nu t  | t  r y |  j |  SWq t	 k
 r t
 |  d k r | d } t  | t  r |  j |  Sn    q Xn  t  | t t j t t f  s t |  } n  t  | t  r| j } n t j | d t } | d k ri|  j j   sN|  j j   rY|  j | S|  j |  Sn | d k r|  j |  Sy1 t  | t t f  r|  j | S|  j |  SWn4 t	 k
 rt  | d t  r|  j |  S  n Xd  S(	   NR   R   sW   Indexing a Series with DataFrame is not supported, use the appropriate DataFrame columni   i    t   skipnat   integert   boolean(   Ry   R   R   R   R   R    R\   R   t   _get_values_tupleR   RZ   R   R   R   RF   R7   t   inferred_typeR   t   infer_dtypeR   R   t   is_floatingt   locR   (   R_   R   R   t   key_type(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     sB    

c         C   sx   t  j |   r |  j |  St |  j t  s= t d   n  |  j j |  \ } } |  j |  j	 | d | j
 |   S(   Ns&   Can only tuple-index with a MultiIndexR   (   R   t	   _any_noneR   Ry   R   R9   R   t   get_loc_levelR   R   R   (   R_   R   R   t	   new_index(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    c         C   sL   y, |  j  |  j j |  d t j |   SWn t k
 rG |  j | SXd  S(   NRp   (   R   R   t	   get_sliceRz   R   R   R   (   R_   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s
    c            sQ   t  j |    }   f d   }   j   } | | |  | rM   j   n  d  S(   Nc            s  y   j  |  |  d  SWnWt j k
 r1   nAt t f k
 r  j } t |   rz   j j d k rz | | |  <d  S|  t	 k r |   (d  St j
 |   r n_ t   j  rt |  rt } y$   j j j   j |  |  d  SWq t k
 r q Xqn  |   j |  <d  St k
 rq} t |  t  rSt   j t  rSt d   n  t |  rrt |    qrn Xt j
 |   rt   j |   }  y   j |  | d t d  SWqt k
 rqXn    j |  |  d  S(   NR   s&   Can only tuple-index with a MultiIndexRK   (   t   _set_with_engineR   t   SettingWithCopyErrorR   R   R   R   R   R  R   R   R   Ru   R&   R   t   _engineRk   R\   R  Ry   R   R9   R   R   R?   t   _whereRz   R8   t	   _set_with(   R   R   R   t   e(   R_   (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   setitem  sR    	

(   R   R   t%   _check_is_chained_assignment_possiblet   _maybe_update_cacher(   R_   R   R   R  t   cacher_needs_updating(    (   R_   s1   lib/python2.7/site-packages/pandas/core/series.pyt   __setitem__  s    5c         C   sY   |  j  } y! |  j j j | | |  d  SWn( t k
 rT | | |  j j |  <d  SXd  S(   N(   R   R   R  Rk   R   R   (   R_   R   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    	c         C   s  t  | t  r7 |  j j | d d } |  j | |  St  | t  rq y |  j | |  Wqq t k
 rm qq Xn  t |  r | g } nK t  | t t	 t
 j f  s y t |  } Wq t k
 r | g } q Xn  t  | t  r | j } n t j | d t } | d k rH|  j j d k r5|  j | |  q|  j | |  Sn; | d k rs|  j | j t
 j  |  n |  j | |  d  S(   NR   R   R   R   R   (   Ry   R   R   R   t   _set_valuesR   R   R   R   RF   R   R   R7   R  R   R  R   t   _set_labelsR~   t   bool_(   R_   R   R   R   R  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s2    c         C   s   t  | t  r | j } n t j |  } |  j j |  } | d k } | j   rq t d t	 | |    n  |  j
 | |  d  S(   Nis   %s not contained in the index(   Ry   R7   R   R   t   asarray_tuplesafeR   t   get_indexert   anyR   R^   R  (   R_   R   R   R   t   mask(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR  ?  s    c         C   sG   t  | t  r | j } n  |  j j d | d |  |  _ |  j   d  S(   NR   R   (   Ry   RF   R   R   R  R  (   R_   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR  J  s    c         C   s\   t  j t   t d |   |  j j |  } |  j j |  } |  j | d | j |   S(   s  
        Repeat elements of a Series.

        Returns a new Series where each element of the current Series
        is repeated consecutively a given number of times.

        Parameters
        ----------
        repeats : int or array of ints
            The number of repetitions for each element. This should be a
            non-negative integer. Repeating 0 times will return an empty
            Series.
        axis : None
            Must be ``None``. Has no effect but is accepted for compatibility
            with numpy.

        Returns
        -------
        repeated_series : Series
            Newly created Series with repeated elements.

        See Also
        --------
        Index.repeat : Equivalent function for Index.
        numpy.repeat : Similar method for :class:`numpy.ndarray`.

        Examples
        --------
        >>> s = pd.Series(['a', 'b', 'c'])
        >>> s
        0    a
        1    b
        2    c
        dtype: object
        >>> s.repeat(2)
        0    a
        0    a
        1    b
        1    b
        2    c
        2    c
        dtype: object
        >>> s.repeat([1, 2, 3])
        0    a
        1    b
        1    b
        2    c
        2    c
        2    c
        dtype: object
        RJ   R   (	   R   t   validate_repeatR   R   R   t   repeatR   R   R   (   R_   t   repeatsRJ   R	  t
   new_values(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR  P  s
    4c         C   s)   t  j d t d d |  j | d | S(   sV  
        Quickly retrieve single value at passed index label.

        .. deprecated:: 0.21.0
            Please use .at[] or .iat[] accessors.

        Parameters
        ----------
        label : object
        takeable : interpret the index as indexers, default False

        Returns
        -------
        value : scalar value
        sm   get_value is deprecated and will be removed in a future release. Please use .at[] or .iat[] accessors insteadRT   i   t   takeable(   RU   RV   RW   t
   _get_value(   R_   R   R!  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRj     s    	c         C   s6   | t  k r  t j |  j |  S|  j j |  j |  S(   N(   Rz   R   t   maybe_box_datetimelikeR   R   Rj   (   R_   R   R!  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR"    s    c         C   s,   t  j d t d d |  j | | d | S(   s  
        Quickly set single value at passed label.

        .. deprecated:: 0.21.0
            Please use .at[] or .iat[] accessors.

        If label is not contained, a new object is created with the label
        placed at the end of the result index.

        Parameters
        ----------
        label : object
            Partial indexing with MultiIndex not allowed
        value : object
            Scalar value
        takeable : interpret the index as indexers, default False

        Returns
        -------
        series : Series
            If label is contained, will be reference to calling Series,
            otherwise a new object
        sm   set_value is deprecated and will be removed in a future release. Please use .at[] or .iat[] accessors insteadRT   i   R!  (   RU   RV   RW   t
   _set_value(   R_   R   R   R!  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRk     s    	c         C   s[   y6 | r | |  j  | <n |  j j j |  j  | |  Wn t k
 rV | |  j | <n X|  S(   N(   R   R   R  Rk   R   R  (   R_   R   R   R!  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR$    s     c         C   s6  t  | d  } | r t j t |    } | d k	 r t | t t f  sW | g } n  g  | D] } |  j j	 |  ^ q^ } t |  |  j j
 k  r |  j j |  } q n  | r | |  _ | p |  j |  _ q2|  j |  j j   d | j |   Sn: | rt d   n% |  j |  } | j d | d |  Sd S(   s  
        Generate a new DataFrame or Series with the index reset.

        This is useful when the index needs to be treated as a column, or
        when the index is meaningless and needs to be reset to the default
        before another operation.

        Parameters
        ----------
        level : int, str, tuple, or list, default optional
            For a Series with a MultiIndex, only remove the specified levels
            from the index. Removes all levels by default.
        drop : bool, default False
            Just reset the index, without inserting it as a column in
            the new DataFrame.
        name : object, optional
            The name to use for the column containing the original Series
            values. Uses ``self.name`` by default. This argument is ignored
            when `drop` is True.
        inplace : bool, default False
            Modify the Series in place (do not create a new object).

        Returns
        -------
        Series or DataFrame
            When `drop` is False (the default), a DataFrame is returned.
            The newly created columns will come first in the DataFrame,
            followed by the original Series values.
            When `drop` is True, a `Series` is returned.
            In either case, if ``inplace=True``, no value is returned.

        See Also
        --------
        DataFrame.reset_index: Analogous function for DataFrame.

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4], name='foo',
        ...               index=pd.Index(['a', 'b', 'c', 'd'], name='idx'))

        Generate a DataFrame with default index.

        >>> s.reset_index()
          idx  foo
        0   a    1
        1   b    2
        2   c    3
        3   d    4

        To specify the name of the new column use `name`.

        >>> s.reset_index(name='values')
          idx  values
        0   a       1
        1   b       2
        2   c       3
        3   d       4

        To generate a new Series with the default set `drop` to True.

        >>> s.reset_index(drop=True)
        0    1
        1    2
        2    3
        3    4
        Name: foo, dtype: int64

        To update the Series in place, without generating a new one
        set `inplace` to True. Note that it also requires ``drop=True``.

        >>> s.reset_index(inplace=True, drop=True)
        >>> s
        0    1
        1    2
        2    3
        3    4
        Name: foo, dtype: int64

        The `level` parameter is interesting for Series with a multi-level
        index.

        >>> arrays = [np.array(['bar', 'bar', 'baz', 'baz']),
        ...           np.array(['one', 'two', 'one', 'two'])]
        >>> s2 = pd.Series(
        ...     range(4), name='foo',
        ...     index=pd.MultiIndex.from_arrays(arrays,
        ...                                     names=['a', 'b']))

        To remove a specific level from the Index, use `level`.

        >>> s2.reset_index(level='a')
               a  foo
        b
        one  bar    0
        two  bar    1
        one  baz    2
        two  baz    3

        If `level` is not set, all levels are removed from the Index.

        >>> s2.reset_index()
             a    b  foo
        0  bar  one    0
        1  bar  two    1
        2  baz  one    2
        3  baz  two    3
        RK   R   s<   Cannot reset_index inplace on a Series to create a DataFramet   levelt   dropN(   R   R   R   RZ   R{   Ry   R   R   R   t   _get_level_numbert   nlevelst	   droplevelRb   R   R   Rr   R   R\   t   to_framet   reset_index(   R_   R%  R&  Rb   RK   R	  t   levt   df(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR+    s$    l%	c         C   s   t  t d   } t   \ } } t d  d k r9 | n	 t d  } t d  } |  j d | d |  j d |  j d | d	 |  | j   } | S(
   s   
        Return a string representation for a particular DataFrame.

        Invoked by unicode(df) in py2 only. Yields a Unicode String in both
        py2/py3.
        RO   s   display.max_rowsi    s   display.show_dimensionst   bufRb   Ru   t   max_rowst   length(   R   R	   RE   R5   t	   to_stringRb   Ru   t   getvalue(   R_   R.  t   widtht   heightR/  t   show_dimensionsR   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   __unicode__Y  s    !t   NaNc
         C   s   t  j |  d | d | d | d | d | d | d | d |	 }
 |
 j   } t | t j  s{ t d	 j | j j	    n  | d k r | Sy | j |  Wn6 t k
 r t | d
   } | j |  Wd QXn Xd S(   s  
        Render a string representation of the Series.

        Parameters
        ----------
        buf : StringIO-like, optional
            buffer to write to
        na_rep : string, optional
            string representation of NAN to use, default 'NaN'
        float_format : one-parameter function, optional
            formatter function to apply to columns' elements if they are floats
            default None
        header : boolean, default True
            Add the Series header (index name)
        index : bool, optional
            Add index (row) labels, default True
        length : boolean, default False
            Add the Series length
        dtype : boolean, default False
            Add the Series dtype
        name : boolean, default False
            Add the Series name if not None
        max_rows : int, optional
            Maximum number of rows to show before truncating. If None, show
            all.

        Returns
        -------
        formatted : string (if not buffer passed)
        Rb   R0  t   headerR   Ru   t   na_rept   float_formatR/  s7   result must be of type unicode, type of result is {0!r}t   wN(   t   fmtt   SeriesFormatterR1  Ry   R   t	   text_typeR   R]   R   Rc   R{   t   writet   AttributeErrort   open(   R_   R.  R9  R:  R8  R   R0  Ru   Rb   R/  t	   formatterR   t   f(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR1  l  s     "		c         C   s   t  t |  j  t |    S(   s<   
        Lazily iterate over (index, value) tuples.
        (   R
   t   iterR   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    c         C   s   |  j  S(   s"   
        Alias for index.
        (   R   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    c         C   s"   t  j |  } | t j |    S(   s  
        Convert Series to {label -> value} dict or dict-like object.

        Parameters
        ----------
        into : class, default dict
            The collections.Mapping subclass to use as the return
            object. Can be the actual class or an empty
            instance of the mapping type you want.  If you want a
            collections.defaultdict, you must pass it initialized.

            .. versionadded:: 0.21.0

        Returns
        -------
        value_dict : collections.Mapping

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4])
        >>> s.to_dict()
        {0: 1, 1: 2, 2: 3, 3: 4}
        >>> from collections import OrderedDict, defaultdict
        >>> s.to_dict(OrderedDict)
        OrderedDict([(0, 1), (1, 2), (2, 3), (3, 4)])
        >>> dd = defaultdict(list)
        >>> s.to_dict(dd)
        defaultdict(<type 'list'>, {0: 1, 1: 2, 2: 3, 3: 4})
        (   R   t   standardize_mappingR   R   (   R_   t   intot   into_c(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   to_dict  s    c         C   s8   | d k r |  j |   } n |  j i |  | 6 } | S(   s  
        Convert Series to DataFrame.

        Parameters
        ----------
        name : object, default None
            The passed name should substitute for the series name (if it has
            one).

        Returns
        -------
        data_frame : DataFrame
        N(   R{   R   (   R_   Rb   R-  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR*    s    t   blockc         C   sM   d d l  m } t |  d | d | } | | d |  j d |  j j |   S(   s   
        Convert Series to SparseSeries.

        Parameters
        ----------
        kind : {'block', 'integer'}
        fill_value : float, defaults to NaN (missing)

        Returns
        -------
        sp : SparseSeries
        i(   R   R   t
   fill_valueR   Rb   (   R   R   R1   R   Rb   R   (   R_   R   RJ  R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt	   to_sparse  s
    c         C   s4   t  | d  } | r |  n	 |  j   } | | _ | S(   s   
        Set the Series name.

        Parameters
        ----------
        name : str
        inplace : bool
            whether to modify `self` directly or return a copy
        RK   (   R   Rr   Rb   (   R_   Rb   RK   t   ser(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt	   _set_name  s    
	c         C   s  | d k r% t t j |    j   St | t j  rL |  j j	 |  } n  |  j j
 | } t j |  j j | d t d t } | d k } | j   r t |  | | <} | j | | j  } n  | t |  j  } t j | d t |  p d } |  j | d | d d j |   S(	   sy  
        Return number of non-NA/null observations in the Series.

        Parameters
        ----------
        level : int or level name, default None
            If the axis is a MultiIndex (hierarchical), count along a
            particular level, collapsing into a smaller Series

        Returns
        -------
        nobs : int or Series (if level specified)
        t   subokRr   it	   minlengthR   Ru   t   int64N(   R{   R(   R   t   values_from_objectt   sumRy   R   t   string_typesR   R'  t   levelsR   R   t   codesR   Rz   R  RZ   t   insertt	   _na_valueR   t   bincountR   R   (   R_   R%  R,  t   level_codesR  t   cntt   obst   out(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   count  s    %!c         C   s   t  j |  d | S(   sZ  
        Return the mode(s) of the dataset.

        Always returns Series even if only one value is returned.

        Parameters
        ----------
        dropna : boolean, default True
            Don't consider counts of NaN/NaT.

            .. versionadded:: 0.24.0

        Returns
        -------
        modes : Series (sorted)
        t   dropna(   R*   t   mode(   R_   R^  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR_  8  s    c         C   s   t  t |   j   } | S(   s  
        Return unique values of Series object.

        Uniques are returned in order of appearance. Hash table-based unique,
        therefore does NOT sort.

        Returns
        -------
        ndarray or ExtensionArray
            The unique values returned as a NumPy array. In case of an
            extension-array backed Series, a new
            :class:`~api.extensions.ExtensionArray` of that type with just
            the unique values is returned. This includes

            * Categorical
            * Period
            * Datetime with Timezone
            * Interval
            * Sparse
            * IntegerNA

        See Also
        --------
        unique : Top-level unique method for any 1-d array-like object.
        Index.unique : Return Index with unique values from an Index object.

        Examples
        --------
        >>> pd.Series([2, 1, 3, 3], name='A').unique()
        array([2, 1, 3])

        >>> pd.Series([pd.Timestamp('2016-01-01') for _ in range(3)]).unique()
        array(['2016-01-01T00:00:00.000000000'], dtype='datetime64[ns]')

        >>> pd.Series([pd.Timestamp('2016-01-01', tz='US/Eastern')
        ...            for _ in range(3)]).unique()
        <DatetimeArray>
        ['2016-01-01 00:00:00-05:00']
        Length: 1, dtype: datetime64[ns, US/Eastern]

        An unordered Categorical will return categories in the order of
        appearance.

        >>> pd.Series(pd.Categorical(list('baabc'))).unique()
        [b, a, c]
        Categories (3, object): [b, a, c]

        An ordered Categorical preserves the category ordering.

        >>> pd.Series(pd.Categorical(list('baabc'), categories=list('abc'),
        ...                          ordered=True)).unique()
        [b, a, c]
        Categories (3, object): [a < b < c]
        (   t   superRF   RL   (   R_   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRL   L  s    7t   firstc         C   s   t  t |   j d | d |  S(   s  
        Return Series with duplicate values removed.

        Parameters
        ----------
        keep : {'first', 'last', ``False``}, default 'first'
            - 'first' : Drop duplicates except for the first occurrence.
            - 'last' : Drop duplicates except for the last occurrence.
            - ``False`` : Drop all duplicates.
        inplace : boolean, default ``False``
            If ``True``, performs operation inplace and returns None.

        Returns
        -------
        deduplicated : Series

        See Also
        --------
        Index.drop_duplicates : Equivalent method on Index.
        DataFrame.drop_duplicates : Equivalent method on DataFrame.
        Series.duplicated : Related method on Series, indicating duplicate
            Series values.

        Examples
        --------
        Generate an Series with duplicated entries.

        >>> s = pd.Series(['lama', 'cow', 'lama', 'beetle', 'lama', 'hippo'],
        ...               name='animal')
        >>> s
        0      lama
        1       cow
        2      lama
        3    beetle
        4      lama
        5     hippo
        Name: animal, dtype: object

        With the 'keep' parameter, the selection behaviour of duplicated values
        can be changed. The value 'first' keeps the first occurrence for each
        set of duplicated entries. The default value of keep is 'first'.

        >>> s.drop_duplicates()
        0      lama
        1       cow
        3    beetle
        5     hippo
        Name: animal, dtype: object

        The value 'last' for parameter 'keep' keeps the last occurrence for
        each set of duplicated entries.

        >>> s.drop_duplicates(keep='last')
        1       cow
        3    beetle
        4      lama
        5     hippo
        Name: animal, dtype: object

        The value ``False`` for parameter 'keep' discards all sets of
        duplicated entries. Setting the value of 'inplace' to ``True`` performs
        the operation inplace and returns ``None``.

        >>> s.drop_duplicates(keep=False, inplace=True)
        >>> s
        1       cow
        3    beetle
        5     hippo
        Name: animal, dtype: object
        t   keepRK   (   R`  RF   t   drop_duplicates(   R_   Rb  RK   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRc    s    Gc         C   s   t  t |   j d |  S(   s  
        Indicate duplicate Series values.

        Duplicated values are indicated as ``True`` values in the resulting
        Series. Either all duplicates, all except the first or all except the
        last occurrence of duplicates can be indicated.

        Parameters
        ----------
        keep : {'first', 'last', False}, default 'first'
            - 'first' : Mark duplicates as ``True`` except for the first
              occurrence.
            - 'last' : Mark duplicates as ``True`` except for the last
              occurrence.
            - ``False`` : Mark all duplicates as ``True``.

        Returns
        -------
        pandas.core.series.Series

        See Also
        --------
        Index.duplicated : Equivalent method on pandas.Index.
        DataFrame.duplicated : Equivalent method on pandas.DataFrame.
        Series.drop_duplicates : Remove duplicate values from Series.

        Examples
        --------
        By default, for each set of duplicated values, the first occurrence is
        set on False and all others on True:

        >>> animals = pd.Series(['lama', 'cow', 'lama', 'beetle', 'lama'])
        >>> animals.duplicated()
        0    False
        1    False
        2     True
        3    False
        4     True
        dtype: bool

        which is equivalent to

        >>> animals.duplicated(keep='first')
        0    False
        1    False
        2     True
        3    False
        4     True
        dtype: bool

        By using 'last', the last occurrence of each set of duplicated values
        is set on False and all others on True:

        >>> animals.duplicated(keep='last')
        0     True
        1    False
        2     True
        3    False
        4    False
        dtype: bool

        By setting keep on ``False``, all duplicates are True:

        >>> animals.duplicated(keep=False)
        0     True
        1    False
        2     True
        3    False
        4     True
        dtype: bool
        Rb  (   R`  RF   RM   (   R_   Rb  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRM     s    Hc         O   sQ   t  j | | |  } t j t j |   d | } | d k rF t j S|  j | S(   s  
        Return the row label of the minimum value.

        If multiple values equal the minimum, the first row label with that
        value is returned.

        Parameters
        ----------
        skipna : boolean, default True
            Exclude NA/null values. If the entire Series is NA, the result
            will be NA.
        axis : int, default 0
            For compatibility with DataFrame.idxmin. Redundant for application
            on Series.
        *args, **kwargs
            Additional keywords have no effect but might be accepted
            for compatibility with NumPy.

        Returns
        -------
        idxmin : Index of minimum of values.

        Raises
        ------
        ValueError
            If the Series is empty.

        See Also
        --------
        numpy.argmin : Return indices of the minimum values
            along the given axis.
        DataFrame.idxmin : Return index of first occurrence of minimum
            over requested axis.
        Series.idxmax : Return index *label* of the first occurrence
            of maximum of values.

        Notes
        -----
        This method is the Series version of ``ndarray.argmin``. This method
        returns the label of the minimum, while ``ndarray.argmin`` returns
        the position. To get the position, use ``series.values.argmin()``.

        Examples
        --------
        >>> s = pd.Series(data=[1, None, 4, 1],
        ...               index=['A' ,'B' ,'C' ,'D'])
        >>> s
        A    1.0
        B    NaN
        C    4.0
        D    1.0
        dtype: float64

        >>> s.idxmin()
        'A'

        If `skipna` is False and there is an NA value in the data,
        the function returns ``nan``.

        >>> s.idxmin(skipna=False)
        nan
        R   i(	   R   t   validate_argmin_with_skipnaR-   t	   nanargminR   RQ  R   t   nanR   (   R_   RJ   R   R   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   idxmin  s
    ?c         O   sQ   t  j | | |  } t j t j |   d | } | d k rF t j S|  j | S(   s  
        Return the row label of the maximum value.

        If multiple values equal the maximum, the first row label with that
        value is returned.

        Parameters
        ----------
        skipna : boolean, default True
            Exclude NA/null values. If the entire Series is NA, the result
            will be NA.
        axis : int, default 0
            For compatibility with DataFrame.idxmax. Redundant for application
            on Series.
        *args, **kwargs
            Additional keywords have no effect but might be accepted
            for compatibility with NumPy.

        Returns
        -------
        idxmax : Index of maximum of values.

        Raises
        ------
        ValueError
            If the Series is empty.

        See Also
        --------
        numpy.argmax : Return indices of the maximum values
            along the given axis.
        DataFrame.idxmax : Return index of first occurrence of maximum
            over requested axis.
        Series.idxmin : Return index *label* of the first occurrence
            of minimum of values.

        Notes
        -----
        This method is the Series version of ``ndarray.argmax``. This method
        returns the label of the maximum, while ``ndarray.argmax`` returns
        the position. To get the position, use ``series.values.argmax()``.

        Examples
        --------
        >>> s = pd.Series(data=[1, None, 4, 3, 4],
        ...               index=['A', 'B', 'C', 'D', 'E'])
        >>> s
        A    1.0
        B    NaN
        C    4.0
        D    3.0
        E    4.0
        dtype: float64

        >>> s.idxmax()
        'C'

        If `skipna` is False and there is an NA value in the data,
        the function returns ``nan``.

        >>> s.idxmax(skipna=False)
        nan
        R   i(	   R   t   validate_argmax_with_skipnaR-   t	   nanargmaxR   RQ  R   Rf  R   (   R_   RJ   R   R   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   idxmax^  s
    @t   argmins   0.21.0R   sF  
        The current behaviour of 'Series.argmin' is deprecated, use 'idxmin'
        instead.
        The behavior of 'argmin' will be corrected to return the positional
        minimum in the future. For now, use 'series.values.argmin' or
        'np.argmin(np.array(values))' to get the position of the minimum
        row.t   argmaxsF  
        The current behaviour of 'Series.argmax' is deprecated, use 'idxmax'
        instead.
        The behavior of 'argmax' will be corrected to return the positional
        maximum in the future. For now, use 'series.values.argmax' or
        'np.argmax(np.array(values))' to get the position of the maximum
        row.c         O   sM   t  j | |  t j |   j |  } |  j | d |  j j |   } | S(   s  
        Round each value in a Series to the given number of decimals.

        Parameters
        ----------
        decimals : int
            Number of decimal places to round to (default: 0).
            If decimals is negative, it specifies the number of
            positions to the left of the decimal point.

        Returns
        -------
        Series object

        See Also
        --------
        numpy.around
        DataFrame.round
        R   (   R   t   validate_roundR   RQ  t   roundR   R   R   (   R_   t   decimalsR   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRn    s    !g      ?t   linearc         C   s   |  j  |  |  j   } | j d | d | d t  } | j d k rb | j d d  d f } n  t |  r |  j | _ |  j | d t	 |  d |  j S| j d Sd S(	   s2  
        Return value at the given quantile.

        Parameters
        ----------
        q : float or array-like, default 0.5 (50% quantile)
            0 <= q <= 1, the quantile(s) to compute
        interpolation : {'linear', 'lower', 'higher', 'midpoint', 'nearest'}
            .. versionadded:: 0.18.0

            This optional parameter specifies the interpolation method to use,
            when the desired quantile lies between two data points `i` and `j`:

                * linear: `i + (j - i) * fraction`, where `fraction` is the
                  fractional part of the index surrounded by `i` and `j`.
                * lower: `i`.
                * higher: `j`.
                * nearest: `i` or `j` whichever is nearest.
                * midpoint: (`i` + `j`) / 2.

        Returns
        -------
        quantile : float or Series
            if ``q`` is an array, a Series will be returned where the
            index is ``q`` and the values are the quantiles.

        See Also
        --------
        core.window.Rolling.quantile
        numpy.percentile

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4])
        >>> s.quantile(.5)
        2.5
        >>> s.quantile([.25, .5, .75])
        0.25    1.75
        0.50    2.50
        0.75    3.25
        dtype: float64
        t   qt   interpolationt   numeric_onlyi   Ni    R   Rb   (
   t   _check_percentileR*  t   quantileR   t   ndimR[   R   Rb   R   R6   (   R_   Rq  Rr  R-  R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRu    s    ,	
t   pearsonc         C   s   |  j  | d d d t \ } } t |  d k r: t j S| d k sR t |  rt t j | j | j d | d	 | St	 d
 j
 d |    d S(   s  
        Compute correlation with `other` Series, excluding missing values.

        Parameters
        ----------
        other : Series
        method : {'pearson', 'kendall', 'spearman'} or callable
            * pearson : standard correlation coefficient
            * kendall : Kendall Tau correlation coefficient
            * spearman : Spearman rank correlation
            * callable: callable with input two 1d ndarray
                and returning a float
                .. versionadded:: 0.24.0

        min_periods : int, optional
            Minimum number of observations needed to have a valid result

        Returns
        -------
        correlation : float

        Examples
        --------
        >>> histogram_intersection = lambda a, b: np.minimum(a, b
        ... ).sum().round(decimals=1)
        >>> s1 = pd.Series([.2, .0, .6, .2])
        >>> s2 = pd.Series([.3, .6, .0, .1])
        >>> s1.corr(s2, method=histogram_intersection)
        0.3
        t   joint   innerRr   i    Rw  t   spearmant   kendallt   methodt   min_periodssR   method must be either 'pearson', 'spearman', or 'kendall', '{method}' was suppliedN(   Rw  Rz  R{  (   t   alignR   RZ   R   Rf  t   callableR-   t   nancorrR   R   R]   (   R_   t   otherR|  R}  t   this(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   corr  s    !c         C   sV   |  j  | d d d t \ } } t |  d k r: t j St j | j | j d | S(   sc  
        Compute covariance with Series, excluding missing values.

        Parameters
        ----------
        other : Series
        min_periods : int, optional
            Minimum number of observations needed to have a valid result

        Returns
        -------
        covariance : float

        Normalized by N-1 (unbiased estimator).
        Rx  Ry  Rr   i    R}  (   R~  R   RZ   R   Rf  R-   t   nancovR   (   R_   R  R}  R  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   cov?  s
    !i   c         C   s:   t  j t j |   |  } |  j | d |  j j |   S(   sI  
        First discrete difference of element.

        Calculates the difference of a Series element compared with another
        element in the Series (default is element in previous row).

        Parameters
        ----------
        periods : int, default 1
            Periods to shift for calculating difference, accepts negative
            values.

        Returns
        -------
        diffed : Series

        See Also
        --------
        Series.pct_change: Percent change over given number of periods.
        Series.shift: Shift index by desired number of periods with an
            optional time freq.
        DataFrame.diff: First discrete difference of object.

        Examples
        --------
        Difference with previous row

        >>> s = pd.Series([1, 1, 2, 3, 5, 8])
        >>> s.diff()
        0    NaN
        1    0.0
        2    1.0
        3    1.0
        4    2.0
        5    3.0
        dtype: float64

        Difference with 3rd previous row

        >>> s.diff(periods=3)
        0    NaN
        1    NaN
        2    NaN
        3    2.0
        4    4.0
        5    6.0
        dtype: float64

        Difference with following row

        >>> s.diff(periods=-1)
        0    0.0
        1   -1.0
        2   -1.0
        3   -2.0
        4   -3.0
        5    NaN
        dtype: float64
        R   (   R*   t   diffR   RQ  R   R   R   (   R_   t   periodsR   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR  U  s    <c         C   s   |  j  |  j |   S(   s  
        Compute the lag-N autocorrelation.

        This method computes the Pearson correlation between
        the Series and its shifted self.

        Parameters
        ----------
        lag : int, default 1
            Number of lags to apply before performing autocorrelation.

        Returns
        -------
        float
            The Pearson correlation between self and self.shift(lag).

        See Also
        --------
        Series.corr : Compute the correlation between two Series.
        Series.shift : Shift index by desired number of periods.
        DataFrame.corr : Compute pairwise correlation of columns.
        DataFrame.corrwith : Compute pairwise correlation between rows or
            columns of two DataFrame objects.

        Notes
        -----
        If the Pearson correlation is not well defined return 'NaN'.

        Examples
        --------
        >>> s = pd.Series([0.25, 0.5, 0.2, -0.05])
        >>> s.autocorr()  # doctest: +ELLIPSIS
        0.10355...
        >>> s.autocorr(lag=2)  # doctest: +ELLIPSIS
        -0.99999...

        If the Pearson correlation is not well defined, then 'NaN' is returned.

        >>> s = pd.Series([1, 0, 0, 0])
        >>> s.autocorr()
        nan
        (   R  t   shift(   R_   t   lag(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   autocorr  s    +c         C   s  d d l  m } t | t | f  r |  j j | j  } t |  t |  j  k sp t |  t | j  k r t d   n  |  j d | d t	  } | j d | d t	  } | j
 } | j
 } nQ |  j
 } t j |  } | j d | j d k rt d | j | j f   n  t | |  rO|  j t j | |  d | j j |   St | t  rnt j | |  St | t j  rt j | |  St d t |    d	 S(
   sC  
        Compute the dot product between the Series and the columns of other.

        This method computes the dot product between the Series and another
        one, or the Series and each columns of a DataFrame, or the Series and
        each columns of an array.

        It can also be called using `self @ other` in Python >= 3.5.

        Parameters
        ----------
        other : Series, DataFrame or array-like
            The other object to compute the dot product with its columns.

        Returns
        -------
        scalar, Series or numpy.ndarray
            Return the dot product of the Series and other if other is a
            Series, the Series of the dot product of Series and each rows of
            other if other is a DataFrame or a numpy.ndarray between the Series
            and each columns of the numpy array.

        See Also
        --------
        DataFrame.dot: Compute the matrix product with the DataFrame.
        Series.mul: Multiplication of series and other, element-wise.

        Notes
        -----
        The Series and other has to share the same index if other is a Series
        or a DataFrame.

        Examples
        --------
        >>> s = pd.Series([0, 1, 2, 3])
        >>> other = pd.Series([-1, 2, -3, 4])
        >>> s.dot(other)
        8
        >>> s @ other
        8
        >>> df = pd.DataFrame([[0 ,1], [-2, 3], [4, -5], [6, 7]])
        >>> s.dot(df)
        0    24
        1    14
        dtype: int64
        >>> arr = np.array([[0, 1], [-2, 3], [4, -5], [6, 7]])
        >>> s.dot(arr)
        array([24, 14])
        i(   R   s   matrices are not alignedR   Rr   i    s$   Dot product shape mismatch, %s vs %ss   unsupported type: %sN(   R   R   Ry   RF   R   t   unionRZ   R   R   R   R   R   R   t   shapeR   R   t   dott   columnsR   R   R\   R   (   R_   R  R   t   commont   leftt   rightt   lvalst   rvals(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s.    2		c         C   s   |  j  |  S(   sQ   
        Matrix multiplication using binary `@` operator in Python>=3.5.
        (   R  (   R_   R  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt
   __matmul__	  s    c         C   s   |  j  t j |   S(   sQ   
        Matrix multiplication using binary `@` operator in Python>=3.5.
        (   R  R   t	   transpose(   R_   R  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   __rmatmul__	  s    RH   RF   t   searchsortedR  c         C   sZ   | d  k	 r t |  } n  |  j j t |  j d | d | } t |  rV | d S| S(   Nt   sidet   sorteri    (   R{   R   R   R  RF   R   (   R_   R   R  R  R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR  	  s
    c         C   sW   d d l  m } t | t t f  r5 |  g | } n |  | g } | | d | d | S(   s  
        Concatenate two or more Series.

        Parameters
        ----------
        to_append : Series or list/tuple of Series
        ignore_index : boolean, default False
            If True, do not use the index labels.

            .. versionadded:: 0.19.0

        verify_integrity : boolean, default False
            If True, raise Exception on creating index with duplicates

        Returns
        -------
        appended : Series

        See Also
        --------
        concat : General function to concatenate DataFrame, Series
            or Panel objects.

        Notes
        -----
        Iteratively appending to a Series can be more computationally intensive
        than a single concatenate. A better solution is to append values to a
        list and then concatenate the list with the original Series all at
        once.

        Examples
        --------
        >>> s1 = pd.Series([1, 2, 3])
        >>> s2 = pd.Series([4, 5, 6])
        >>> s3 = pd.Series([4, 5, 6], index=[3,4,5])
        >>> s1.append(s2)
        0    1
        1    2
        2    3
        0    4
        1    5
        2    6
        dtype: int64

        >>> s1.append(s3)
        0    1
        1    2
        2    3
        3    4
        4    5
        5    6
        dtype: int64

        With `ignore_index` set to True:

        >>> s1.append(s2, ignore_index=True)
        0    1
        1    2
        2    3
        3    4
        4    5
        5    6
        dtype: int64

        With `verify_integrity` set to True:

        >>> s1.append(s2, verify_integrity=True)
        Traceback (most recent call last):
        ...
        ValueError: Indexes have overlapping values: [0, 1, 2]
        i(   t   concatt   ignore_indext   verify_integrity(   t   pandas.core.reshape.concatR  Ry   R   R   (   R_   t	   to_appendR  R  R  t	   to_concat(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   append(	  s    Hc         C   s  t  | t  s t d   n  |  j } |  } |  j j | j  su |  j | d | d d d t \ } } | j } n  t j | j	 | j	 |  \ } } t
 j d d   | | |  }	 Wd QXt j |  |  }
 |  j |	 d	 | d
 |
 }	 |	 j |   }	 |
 d k rd |	 _ n  |	 S(   s?  
        Perform generic binary operation with optional fill value.

        Parameters
        ----------
        other : Series
        func : binary operator
        fill_value : float or object
            Value to substitute for NA/null values. If both Series are NA in a
            location, the result will be NA regardless of the passed fill value
        level : int or level name, default None
            Broadcast across a level, matching Index values on the
            passed MultiIndex level

        Returns
        -------
        combined : Series
        s   Other operand must be SeriesR%  Rx  t   outerRr   t   allRw   NR   Rb   (   Ry   RF   R   R   R   R~  R   R.   t
   fill_binopR   R   t   errstatet   get_op_result_nameR   R   R{   Rb   (   R_   R  t   funcR%  RJ  R	  R  t	   this_valst
   other_valsR   Rb   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _binopy	  s$    	c   
   	   C   s~  | d k r$ t |  j d t } n  t | t  r |  j j | j  } t j	 |  |  } g  } x | D]Y } |  j
 | |  } | j
 | |  }	 t j d d   | j | | |	   Wd QXqg WnP |  j } t j d d  * g  |  j D] } | | |  ^ q } Wd QX|  j } t |  j  r)n< t |  j  rey |  j j |  } Wqet k
 raqeXn  |  j | d | d | S(   s  
        Combine the Series with a Series or scalar according to `func`.

        Combine the Series and `other` using `func` to perform elementwise
        selection for combined Series.
        `fill_value` is assumed when value is missing at some index
        from one of the two objects being combined.

        Parameters
        ----------
        other : Series or scalar
            The value(s) to be combined with the `Series`.
        func : function
            Function that takes two scalars as inputs and returns an element.
        fill_value : scalar, optional
            The value to assume when an index is missing from
            one Series or the other. The default specifies to use the
            appropriate NaN value for the underlying dtype of the Series.

        Returns
        -------
        Series
            The result of combining the Series with the other object.

        See Also
        --------
        Series.combine_first : Combine Series values, choosing the calling
            Series' values first.

        Examples
        --------
        Consider 2 Datasets ``s1`` and ``s2`` containing
        highest clocked speeds of different birds.

        >>> s1 = pd.Series({'falcon': 330.0, 'eagle': 160.0})
        >>> s1
        falcon    330.0
        eagle     160.0
        dtype: float64
        >>> s2 = pd.Series({'falcon': 345.0, 'eagle': 200.0, 'duck': 30.0})
        >>> s2
        falcon    345.0
        eagle     200.0
        duck       30.0
        dtype: float64

        Now, to combine the two datasets and view the highest speeds
        of the birds across the two datasets

        >>> s1.combine(s2, max)
        duck        NaN
        eagle     200.0
        falcon    345.0
        dtype: float64

        In the previous example, the resulting value for duck is missing,
        because the maximum of a NaN and a float is a NaN.
        So, in the example, we set ``fill_value=0``,
        so the maximum value returned will be the value from some dataset.

        >>> s1.combine(s2, max, fill_value=0)
        duck       30.0
        eagle     200.0
        falcon    345.0
        dtype: float64
        R   R  Rw   NR   Rb   (   R{   R'   Ru   R   Ry   RF   R   R  R.   R  t   getR   R  R  R   Rb   R   R   R   t   _from_sequenceR   R   (
   R_   R  R  RJ  R	  t   new_nameR   t   idxt   lvt   rv(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   combine	  s.    C#	+	c         C   s}   |  j  j | j   } |  j | d t } | j | d t } t |  rg t |  rg t |  } n  | j t |  |  S(   s  
        Combine Series values, choosing the calling Series's values first.

        Parameters
        ----------
        other : Series
            The value(s) to be combined with the `Series`.

        Returns
        -------
        Series
            The result of combining the Series with the other object.

        See Also
        --------
        Series.combine : Perform elementwise operation on two Series
            using a given function.

        Notes
        -----
        Result index will be the union of the two indexes.

        Examples
        --------
        >>> s1 = pd.Series([1, np.nan])
        >>> s2 = pd.Series([3, 4])
        >>> s1.combine_first(s2)
        0    1.0
        1    4.0
        dtype: float64
        Rr   (   R   R  R   R   R   RD   t   whereR(   (   R_   R  R	  R  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   combine_first
  s     c         C   sM   | j  |   } t |  } |  j j d | d | d t  |  _ |  j   d S(   s  
        Modify Series in place using non-NA values from passed
        Series. Aligns on index.

        Parameters
        ----------
        other : Series

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

        >>> s = pd.Series(['a', 'b', 'c'])
        >>> s.update(pd.Series(['d', 'e'], index=[0, 2]))
        >>> s
        0    d
        1    b
        2    e
        dtype: object

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

        If ``other`` contains NaNs the corresponding values are not updated
        in the original Series.

        >>> s = pd.Series([1, 2, 3])
        >>> s.update(pd.Series([4, np.nan, 6]))
        >>> s
        0    4
        1    2
        2    6
        dtype: int64
        R  t   newRK   N(   t   reindex_likeR(   R   t   putmaskRz   R  (   R_   R  R  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   update5
  s    .$t	   quicksortt   lastc            s  t  | d  } |  j |  | r: |  j r: t d   n    f d   } |  j } t j t |   d t j } t	 |  }	 |	 }
 t
 j t |    } | | |
  } t |  r t |  d k r t d t |    n  | d } n  t |  st d   n  | s#| d	 d	 d
  } n  | d k r^|
 j   } | |
 | | | *| |	 | | )nP | d k r|	 j   } | |
 | | | )| |	 | | *n t d j |    |  j | | d |  j | } | r|  j |  n | j |   Sd	 S(   s
  
        Sort by the values.

        Sort a Series in ascending or descending order by some
        criterion.

        Parameters
        ----------
        axis : {0 or 'index'}, default 0
            Axis to direct sorting. The value 'index' is accepted for
            compatibility with DataFrame.sort_values.
        ascending : bool, default True
            If True, sort values in ascending order, otherwise descending.
        inplace : bool, default False
            If True, perform operation in-place.
        kind : {'quicksort', 'mergesort' or 'heapsort'}, default 'quicksort'
            Choice of sorting algorithm. See also :func:`numpy.sort` for more
            information. 'mergesort' is the only stable  algorithm.
        na_position : {'first' or 'last'}, default 'last'
            Argument 'first' puts NaNs at the beginning, 'last' puts NaNs at
            the end.

        Returns
        -------
        Series
            Series ordered by values.

        See Also
        --------
        Series.sort_index : Sort by the Series indices.
        DataFrame.sort_values : Sort DataFrame by the values along either axis.
        DataFrame.sort_index : Sort DataFrame by indices.

        Examples
        --------
        >>> s = pd.Series([np.nan, 1, 3, 10, 5])
        >>> s
        0     NaN
        1     1.0
        2     3.0
        3     10.0
        4     5.0
        dtype: float64

        Sort values ascending order (default behaviour)

        >>> s.sort_values(ascending=True)
        1     1.0
        2     3.0
        4     5.0
        3    10.0
        0     NaN
        dtype: float64

        Sort values descending order

        >>> s.sort_values(ascending=False)
        3    10.0
        4     5.0
        2     3.0
        1     1.0
        0     NaN
        dtype: float64

        Sort values inplace

        >>> s.sort_values(ascending=False, inplace=True)
        >>> s
        3    10.0
        4     5.0
        2     3.0
        1     1.0
        0     NaN
        dtype: float64

        Sort values putting NAs first

        >>> s.sort_values(na_position='first')
        0     NaN
        1     1.0
        2     3.0
        4     5.0
        3    10.0
        dtype: float64

        Sort a series of strings

        >>> s = pd.Series(['z', 'b', 'd', 'a', 'c'])
        >>> s
        0    z
        1    b
        2    d
        3    a
        4    c
        dtype: object

        >>> s.sort_values()
        3    a
        1    b
        4    c
        2    d
        0    z
        dtype: object
        RK   sR   This Series is a view of some other array, to sort in-place you must create a copyc            s9   y |  j  d    SWn t k
 r4 |  j  d d  SXd  S(   NR   R  (   t   argsortR\   (   RX   (   R   (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _try_kind_sort
  s    Ru   i   s-   Length of ascending (%d) must be 1 for Seriesi    s   ascending must be booleanNiR  Ra  s   invalid na_position: {!r}R   (   R   t   _get_axis_numbert
   _is_cachedR   R   R   R   RZ   t   int32R&   R   R   R   R   RR  R]   R   R   R   R   (   R_   RJ   t	   ascendingRK   R   t   na_positionR  RX   t	   sortedIdxt   badt   goodR  t	   argsortedt   nR   (    (   R   s1   lib/python2.7/site-packages/pandas/core/series.pyt   sort_valuesl
  sB    j
	 c         C   sz  t  | d  } |  j |  |  j } | d	 k	 rU | j | d | d | \ }	 }
 n t | t  r d d l m } | j	   } | | j
   d | d | }
 nd d d l m } | r | j s | r | j r | r d	 S|  j   Sn  | | d
 | d | d | }
 t |
  }
 | j |
  }	 |	 j	   }	 |  j j |
  } |  j | d |	 } | ri|  j |  n | j |   Sd	 S(   s  
        Sort Series by index labels.

        Returns a new Series sorted by label if `inplace` argument is
        ``False``, otherwise updates the original series and returns None.

        Parameters
        ----------
        axis : int, default 0
            Axis to direct sorting. This can only be 0 for Series.
        level : int, optional
            If not None, sort on values in specified index level(s).
        ascending : bool, 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 :func:`numpy.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'
            If '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
        -------
        pandas.Series
            The original Series sorted by the labels

        See Also
        --------
        DataFrame.sort_index: Sort DataFrame by the index.
        DataFrame.sort_values: Sort DataFrame by the value.
        Series.sort_values : Sort Series by the value.

        Examples
        --------
        >>> s = pd.Series(['a', 'b', 'c', 'd'], index=[3, 2, 1, 4])
        >>> s.sort_index()
        1    c
        2    b
        3    a
        4    d
        dtype: object

        Sort Descending

        >>> s.sort_index(ascending=False)
        4    d
        3    a
        2    b
        1    c
        dtype: object

        Sort Inplace

        >>> s.sort_index(inplace=True)
        >>> s
        1    c
        2    b
        3    a
        4    d
        dtype: object

        By default NaNs are put at the end, but use `na_position` to place
        them at the beginning

        >>> s = pd.Series(['a', 'b', 'c', 'd'], index=[3, 2, 1, np.nan])
        >>> s.sort_index(na_position='first')
        NaN     d
         1.0    c
         2.0    b
         3.0    a
        dtype: object

        Specify index level to sort

        >>> arrays = [np.array(['qux', 'qux', 'foo', 'foo',
        ...                     'baz', 'baz', 'bar', 'bar']),
        ...           np.array(['two', 'one', 'two', 'one',
        ...                     'two', 'one', 'two', 'one'])]
        >>> s = pd.Series([1, 2, 3, 4, 5, 6, 7, 8], index=arrays)
        >>> s.sort_index(level=1)
        bar  one    8
        baz  one    6
        foo  one    4
        qux  one    2
        bar  two    7
        baz  two    5
        foo  two    3
        qux  two    1
        dtype: int64

        Does not sort by remaining levels when sorting by levels

        >>> s.sort_index(level=1, sort_remaining=False)
        qux  one    2
        foo  one    4
        baz  one    6
        bar  one    8
        qux  two    1
        foo  two    3
        baz  two    5
        bar  two    7
        dtype: int64
        RK   R  t   sort_remainingi(   t   lexsort_indexert   ordersR  (   t   nargsortNR   R   (   R   R  R   R{   t	   sortlevelRy   R9   t   pandas.core.sortingR  t   _sort_levels_monotonict   _get_codes_for_sortingR  t   is_monotonic_increasingt   is_monotonic_decreasingRr   R   R   R   R   R   R   (   R_   RJ   R%  R  RK   R   R  R  R   R	  R   R  R   R  R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s8    r		c         C   s   |  j  } t |  } | j   r t d d |  j d |  j d d } | } t j | | d | | | <|  j | d |  j j	 |   S|  j t j | d | d |  j d d j	 |   Sd S(   s  
        Overrides ndarray.argsort. Argsorts the value, omitting NA/null values,
        and places the result in the same locations as the non-NA values.

        Parameters
        ----------
        axis : int
            Has no effect but is accepted for compatibility with numpy.
        kind : {'mergesort', 'quicksort', 'heapsort'}, default 'quicksort'
            Choice of sorting algorithm. See np.sort for more
            information. 'mergesort' is the only stable algorithm
        order : None
            Has no effect but is accepted for compatibility with numpy.

        Returns
        -------
        argsorted : Series, with -1 indicated where nan values are present

        See Also
        --------
        numpy.ndarray.argsort
        iR   Rb   Ru   RP  R   N(
   R   R&   R  RF   R   Rb   R   R  R   R   (   R_   RJ   R   R   R   R  R   t   notmask(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    		i   c         C   s   t  j |  d | d | j   S(   s  
        Return the largest `n` elements.

        Parameters
        ----------
        n : int, default 5
            Return this many descending sorted values.
        keep : {'first', 'last', 'all'}, default 'first'
            When there are duplicate values that cannot all fit in a
            Series of `n` elements:

            - ``first`` : take the first occurrences based on the index order
            - ``last`` : take the last occurrences based on the index order
            - ``all`` : keep all occurrences. This can result in a Series of
                size larger than `n`.

        Returns
        -------
        Series
            The `n` largest values in the Series, sorted in decreasing order.

        See Also
        --------
        Series.nsmallest: Get the `n` smallest elements.
        Series.sort_values: Sort Series by values.
        Series.head: Return the first `n` rows.

        Notes
        -----
        Faster than ``.sort_values(ascending=False).head(n)`` for small `n`
        relative to the size of the ``Series`` object.

        Examples
        --------
        >>> countries_population = {"Italy": 59000000, "France": 65000000,
        ...                         "Malta": 434000, "Maldives": 434000,
        ...                         "Brunei": 434000, "Iceland": 337000,
        ...                         "Nauru": 11300, "Tuvalu": 11300,
        ...                         "Anguilla": 11300, "Monserat": 5200}
        >>> s = pd.Series(countries_population)
        >>> s
        Italy       59000000
        France      65000000
        Malta         434000
        Maldives      434000
        Brunei        434000
        Iceland       337000
        Nauru          11300
        Tuvalu         11300
        Anguilla       11300
        Monserat        5200
        dtype: int64

        The `n` largest elements where ``n=5`` by default.

        >>> s.nlargest()
        France      65000000
        Italy       59000000
        Malta         434000
        Maldives      434000
        Brunei        434000
        dtype: int64

        The `n` largest elements where ``n=3``. Default `keep` value is 'first'
        so Malta will be kept.

        >>> s.nlargest(3)
        France    65000000
        Italy     59000000
        Malta       434000
        dtype: int64

        The `n` largest elements where ``n=3`` and keeping the last duplicates.
        Brunei will be kept since it is the last with value 434000 based on
        the index order.

        >>> s.nlargest(3, keep='last')
        France      65000000
        Italy       59000000
        Brunei        434000
        dtype: int64

        The `n` largest elements where ``n=3`` with all duplicates kept. Note
        that the returned Series has five elements due to the three duplicates.

        >>> s.nlargest(3, keep='all')
        France      65000000
        Italy       59000000
        Malta         434000
        Maldives      434000
        Brunei        434000
        dtype: int64
        R  Rb  (   R*   t   SelectNSeriest   nlargest(   R_   R  Rb  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    ^c         C   s   t  j |  d | d | j   S(   s  
        Return the smallest `n` elements.

        Parameters
        ----------
        n : int, default 5
            Return this many ascending sorted values.
        keep : {'first', 'last', 'all'}, default 'first'
            When there are duplicate values that cannot all fit in a
            Series of `n` elements:

            - ``first`` : take the first occurrences based on the index order
            - ``last`` : take the last occurrences based on the index order
            - ``all`` : keep all occurrences. This can result in a Series of
                size larger than `n`.

        Returns
        -------
        Series
            The `n` smallest values in the Series, sorted in increasing order.

        See Also
        --------
        Series.nlargest: Get the `n` largest elements.
        Series.sort_values: Sort Series by values.
        Series.head: Return the first `n` rows.

        Notes
        -----
        Faster than ``.sort_values().head(n)`` for small `n` relative to
        the size of the ``Series`` object.

        Examples
        --------
        >>> countries_population = {"Italy": 59000000, "France": 65000000,
        ...                         "Brunei": 434000, "Malta": 434000,
        ...                         "Maldives": 434000, "Iceland": 337000,
        ...                         "Nauru": 11300, "Tuvalu": 11300,
        ...                         "Anguilla": 11300, "Monserat": 5200}
        >>> s = pd.Series(countries_population)
        >>> s
        Italy       59000000
        France      65000000
        Brunei        434000
        Malta         434000
        Maldives      434000
        Iceland       337000
        Nauru          11300
        Tuvalu         11300
        Anguilla       11300
        Monserat        5200
        dtype: int64

        The `n` largest elements where ``n=5`` by default.

        >>> s.nsmallest()
        Monserat      5200
        Nauru        11300
        Tuvalu       11300
        Anguilla     11300
        Iceland     337000
        dtype: int64

        The `n` smallest elements where ``n=3``. Default `keep` value is
        'first' so Nauru and Tuvalu will be kept.

        >>> s.nsmallest(3)
        Monserat     5200
        Nauru       11300
        Tuvalu      11300
        dtype: int64

        The `n` smallest elements where ``n=3`` and keeping the last
        duplicates. Anguilla and Tuvalu will be kept since they are the last
        with value 11300 based on the index order.

        >>> s.nsmallest(3, keep='last')
        Monserat     5200
        Anguilla    11300
        Tuvalu      11300
        dtype: int64

        The `n` smallest elements where ``n=3`` with all duplicates kept. Note
        that the returned Series has four elements due to the three duplicates.

        >>> s.nsmallest(3, keep='all')
        Monserat     5200
        Nauru       11300
        Tuvalu      11300
        Anguilla    11300
        dtype: int64
        R  Rb  (   R*   R  t	   nsmallest(   R_   R  Rb  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR  2  s    ]iic         C   s:   |  j  j | |  } |  j |  j d | d | j |   S(   s  
        Swap levels i and j in a MultiIndex.

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

        Returns
        -------
        swapped : Series

        .. versionchanged:: 0.18.1

           The indexes ``i`` and ``j`` are now optional, and default to
           the two innermost levels of the index.
        R   Rr   (   R   t	   swaplevelR   R   R   (   R_   R   t   jRr   R	  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    c         C   sF   t  |  j t  s! t d   n  |  j   } | j j |  | _ | S(   s=  
        Rearrange index levels using input order.

        May not drop or duplicate levels.

        Parameters
        ----------
        order : list of int representing new level order
               (reference level by number or key)

        Returns
        -------
        type of caller (new object)
        s/   Can only reorder levels on a hierarchical axis.(   Ry   R   R9   R   Rr   t   reorder_levels(   R_   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s
    c         C   s    d d l  m } | |  | |  S(   s  
        Unstack, a.k.a. pivot, Series with MultiIndex to produce DataFrame.
        The level involved will automatically get sorted.

        Parameters
        ----------
        level : int, string, or list of these, default last level
            Level(s) to unstack, can pass level name
        fill_value : replace NaN with this value if the unstack produces
            missing values

            .. versionadded:: 0.18.0

        Returns
        -------
        unstacked : DataFrame

        Examples
        --------
        >>> s = pd.Series([1, 2, 3, 4],
        ...     index=pd.MultiIndex.from_product([['one', 'two'], ['a', 'b']]))
        >>> s
        one  a    1
             b    2
        two  a    3
             b    4
        dtype: int64

        >>> s.unstack(level=-1)
             a  b
        one  1  2
        two  3  4

        >>> s.unstack(level=0)
           one  two
        a    1    3
        b    2    4
        i(   t   unstack(   t   pandas.core.reshape.reshapeR  (   R_   R%  RJ  R  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    'c         C   s=   t  t |   j | d | } |  j | d |  j j |   S(   s  
        Map values of Series according to input correspondence.

        Used for substituting each value in a Series with another value,
        that may be derived from a function, a ``dict`` or
        a :class:`Series`.

        Parameters
        ----------
        arg : function, dict, or Series
            Mapping correspondence.
        na_action : {None, 'ignore'}, default None
            If 'ignore', propagate NaN values, without passing them to the
            mapping correspondence.

        Returns
        -------
        Series
            Same index as caller.

        See Also
        --------
        Series.apply : For applying more complex functions on a Series.
        DataFrame.apply : Apply a function row-/column-wise.
        DataFrame.applymap : Apply a function elementwise on a whole DataFrame.

        Notes
        -----
        When ``arg`` is a dictionary, values in Series that are not in the
        dictionary (as keys) are converted to ``NaN``. However, if the
        dictionary is a ``dict`` subclass that defines ``__missing__`` (i.e.
        provides a method for default values), then this default is used
        rather than ``NaN``.

        Examples
        --------
        >>> s = pd.Series(['cat', 'dog', np.nan, 'rabbit'])
        >>> s
        0      cat
        1      dog
        2      NaN
        3   rabbit
        dtype: object

        ``map`` accepts a ``dict`` or a ``Series``. Values that are not found
        in the ``dict`` are converted to ``NaN``, unless the dict has a default
        value (e.g. ``defaultdict``):

        >>> s.map({'cat': 'kitten', 'dog': 'puppy'})
        0   kitten
        1    puppy
        2      NaN
        3      NaN
        dtype: object

        It also accepts a function:

        >>> s.map('I am a {}'.format)
        0       I am a cat
        1       I am a dog
        2       I am a nan
        3    I am a rabbit
        dtype: object

        To avoid applying the function to missing values (and keep them as
        ``NaN``) ``na_action='ignore'`` can be used:

        >>> s.map('I am a {}'.format, na_action='ignore')
        0     I am a cat
        1     I am a dog
        2            NaN
        3  I am a rabbit
        dtype: object
        t	   na_actionR   (   R`  RF   t   _map_valuesR   R   R   (   R_   t   argR  R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   map  s    Kc         C   s   |  S(   s  
        Sub-classes to define. Return a sliced object.

        Parameters
        ----------
        key : string / list of selections
        ndim : 1,2
            requested ndim of result
        subset : object, default None
            subset to act on
        (    (   R_   R   Rv  t   subset(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _gotitem:  s    s   
    See Also
    --------
    Series.apply : Invoke function on a Series.
    Series.transform : Transform function producing a Series with like indexes.
    s   
    Examples
    --------
    >>> s = pd.Series([1, 2, 3, 4])
    >>> s
    0    1
    1    2
    2    3
    3    4
    dtype: int64

    >>> s.agg('min')
    1

    >>> s.agg(['min', 'max'])
    min   1
    max   4
    dtype: int64
    t   see_alsot   examplest   versionaddeds   .. versionadded:: 0.20.0t	   aggregatec         O   s   |  j  |  |  j | | |  \ } } | d  k r | j d d   | j d d   y |  j | | |  } Wq t t t f k
 r | |  | |  } q Xn  | S(   Nt   _axist   _level(   R  t
   _aggregateR{   t   popt   applyR   R@  R\   (   R_   R  RJ   R   R   R   t   how(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR  c  s    
t	   transformc         O   s)   |  j  |  t t |   j | | |  S(   N(   R  R`  RF   R  (   R_   R  RJ   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    c   	   	      s  t  |   d k r7 |  j d |  j d |  j  j |   St  t t f  r_ |  j      St  t	 j
  r |  j      S s   r t  t j  r     f d   } n  } t j d d  o t | t j  r | |   St |  j  r|  j j |  } n* |  j t  j } t j | | d | } Wd QXt  |  rt | d t  rd	 d
 l m } | | j   d |  j S|  j | d |  j j |   Sd S(   s  
        Invoke function on values of Series.

        Can be ufunc (a NumPy function that applies to the entire Series)
        or a Python function that only works on single values.

        Parameters
        ----------
        func : function
            Python function or NumPy ufunc to apply.
        convert_dtype : bool, default True
            Try to find better dtype for elementwise function results. If
            False, leave as dtype=object.
        args : tuple
            Positional arguments passed to func after the series value.
        **kwds
            Additional keyword arguments passed to func.

        Returns
        -------
        Series or DataFrame
            If func returns a Series object the result will be a DataFrame.

        See Also
        --------
        Series.map: For element-wise operations.
        Series.agg: Only perform aggregating type operations.
        Series.transform: Only perform transforming type operations.

        Examples
        --------
        Create a series with typical summer temperatures for each city.

        >>> s = pd.Series([20, 21, 12],
        ...               index=['London', 'New York', 'Helsinki'])
        >>> s
        London      20
        New York    21
        Helsinki    12
        dtype: int64

        Square the values by defining a function and passing it as an
        argument to ``apply()``.

        >>> def square(x):
        ...     return x ** 2
        >>> s.apply(square)
        London      400
        New York    441
        Helsinki    144
        dtype: int64

        Square the values by passing an anonymous function as an
        argument to ``apply()``.

        >>> s.apply(lambda x: x ** 2)
        London      400
        New York    441
        Helsinki    144
        dtype: int64

        Define a custom function that needs additional positional
        arguments and pass these additional arguments using the
        ``args`` keyword.

        >>> def subtract_custom_value(x, custom_value):
        ...     return x - custom_value

        >>> s.apply(subtract_custom_value, args=(5,))
        London      15
        New York    16
        Helsinki     7
        dtype: int64

        Define a custom function that takes keyword arguments
        and pass these arguments to ``apply``.

        >>> def add_custom_values(x, **kwargs):
        ...     for month in kwargs:
        ...         x += kwargs[month]
        ...     return x

        >>> s.apply(add_custom_values, june=30, july=20, august=25)
        London      95
        New York    96
        Helsinki    87
        dtype: int64

        Use a function from the Numpy library.

        >>> s.apply(np.log)
        London      2.995732
        New York    3.044522
        Helsinki    2.484907
        dtype: float64
        i    Ru   R   c            s    |      S(   N(    (   t   x(   R   R  t   kwds(    s1   lib/python2.7/site-packages/pandas/core/series.pyRC    s    R  Rw   R   Ni(   R   (   RZ   R   Ru   R   R   Ry   R   R   R  R   RS  t   _try_aggregate_string_functionR   t   ufuncR  R   R   R  R~   R   R   R   t	   map_inferRF   R   R   Rn   (	   R_   R  t   convert_dtypeR   R  RC  t   mappedR   R   (    (   R   R  R  s1   lib/python2.7/site-packages/pandas/core/series.pyR    s,    a
c   	      K   s  |  j  } | d k	 r% |  j |  n  t | t  rJ | j | d | | St | t  ro | j | d | | St |  r t |  } n_ t | t	 j
  r | r t d j |    n  t	 j d d   | | d | | SWd QXn  | j d | d | d	 | d | d | d
 | |  S(   s   
        Perform a reduction operation.

        If we have an ndarray as a value, then simply perform the operation,
        otherwise delegate to the object.
        Rs  R   s+   Series.{0} does not implement numeric_only.R  Rw   NR   Rb   RJ   t   filter_type(   R   R{   R  Ry   R2   t   _reduceR0   R   R<   R   R   R}   R]   R  (	   R_   R   Rb   RJ   R   Rs  R  R  t   delegate(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s$    		!c         C   sT   | d  k r  | r |  j   S|  St j |  j | d t d d  } |  j | d | S(   Nt
   allow_fillRJ  R   (   R{   Rr   R*   t   take_1dR   Rz   R   (   R_   R	  R   Rr   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _reindex_indexer7  s    
c         C   s   t  S(   sc   
        Check if we do need a multi reindex; this is for compat with
        higher dims.
        (   R   (   R_   RG   R|  R%  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _needs_reindex_multiA  s    R~  R  c         C   sL   t  t |   j | d | d | d | d | d | d | d | d |	 d	 |
 	S(
   NRx  RJ   R%  Rr   RJ  R|  t   limitt	   fill_axist   broadcast_axis(   R`  RF   R~  (   R_   R  Rx  RJ   R%  Rr   RJ  R|  R  R  R  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR~  H  s
    !c         K   s   t  | j d t  d  | d <t |  pA t |  oA t |  } | rf |  j | d | j d  St t |   j	 d | |  S(   s  
        Alter Series index labels or name.

        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.

        See the :ref:`user guide <basics.rename>` for more.

        Parameters
        ----------
        index : scalar, hashable sequence, dict-like or function, optional
            dict-like or functions are transformations to apply to
            the index.
            Scalar or hashable sequence-like will alter the ``Series.name``
            attribute.
        copy : bool, default True
            Also copy underlying data
        inplace : bool, default False
            Whether to return a new Series. 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 : Series (new object)

        See Also
        --------
        Series.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
        RK   R   (
   R   R  R   R   R   R   RM  R`  RF   t   rename(   R_   R   R   t   non_mapping(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR  R  s    <c         K   s   t  t |   j d | |  S(   NR   (   R`  RF   R   (   R_   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR     s    t   raisec         C   s=   t  t |   j d | d | d | d | d | d | d |  S(   s
  
        Return Series with specified index labels removed.

        Remove elements of a Series based on specifying the index labels.
        When using a multi-index, labels on different levels can be removed
        by specifying the level.

        Parameters
        ----------
        labels : single label or list-like
            Index labels to drop.
        axis : 0, default 0
            Redundant for application on Series.
        index, columns : None
            Redundant for application on Series, but index can be used instead
            of labels.

            .. versionadded:: 0.21.0
        level : int or level name, optional
            For MultiIndex, level for which the labels will be removed.
        inplace : bool, default False
            If True, do operation inplace and return None.
        errors : {'ignore', 'raise'}, default 'raise'
            If 'ignore', suppress error and only existing labels are dropped.

        Returns
        -------
        dropped : pandas.Series

        Raises
        ------
        KeyError
            If none of the labels are found in the index.

        See Also
        --------
        Series.reindex : Return only specified index labels of Series.
        Series.dropna : Return series without null values.
        Series.drop_duplicates : Return Series with duplicate values removed.
        DataFrame.drop : Drop specified labels from rows or columns.

        Examples
        --------
        >>> s = pd.Series(data=np.arange(3), index=['A','B','C'])
        >>> s
        A  0
        B  1
        C  2
        dtype: int64

        Drop labels B en C

        >>> s.drop(labels=['B','C'])
        A  0
        dtype: int64

        Drop 2nd level label in MultiIndex Series

        >>> midx = pd.MultiIndex(levels=[['lama', 'cow', 'falcon'],
        ...                              ['speed', 'weight', 'length']],
        ...                      codes=[[0, 0, 0, 1, 1, 1, 2, 2, 2],
        ...                             [0, 1, 2, 0, 1, 2, 0, 1, 2]])
        >>> s = pd.Series([45, 200, 1.2, 30, 250, 1.5, 320, 1, 0.3],
        ...               index=midx)
        >>> s
        lama    speed      45.0
                weight    200.0
                length      1.2
        cow     speed      30.0
                weight    250.0
                length      1.5
        falcon  speed     320.0
                weight      1.0
                length      0.3
        dtype: float64

        >>> s.drop(labels='weight', level=1)
        lama    speed      45.0
                length      1.2
        cow     speed      30.0
                length      1.5
        falcon  speed     320.0
                length      0.3
        dtype: float64
        R   RJ   R   R  R%  RK   Rv   (   R`  RF   R&  (   R_   R   RJ   R   R  R%  RK   Rv   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR&    s    W$c         K   s:   t  t |   j d | d | d | d | d | d | |  S(   NR   R|  RJ   RK   R  t   downcast(   R`  RF   t   fillna(   R_   R   R|  RJ   RK   R  R  R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    	t   replacet   padc         C   s7   t  t |   j d | d | d | d | d | d |  S(   Nt
   to_replaceR   RK   R  t   regexR|  (   R`  RF   R   (   R_   R  R   RK   R  R  R|  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR      s    R  c      	   C   s+   t  t |   j d | d | d | d |  S(   NR  t   freqRJ   RJ  (   R`  RF   R  (   R_   R  R  RJ   RJ  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    $c         K   sJ   | d k r t  d   n  d } t j | t d d |  j d | |  S(   s   
        Conform Series to new index with optional filling logic.

        .. deprecated:: 0.21.0
            Use ``Series.reindex`` instead.
        i    s'   cannot reindex series on non-zero axis!s^   '.reindex_axis' is deprecated and will be removed in a future version. Use '.reindex' instead.RT   i   R   (   R   RU   RV   RW   R   (   R_   R   RJ   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   reindex_axis  s
    c         C   sA   t  t |   j d |  } | r= | |  j j d |  7} n  | S(   sO  
        Return the memory usage of the Series.

        The memory usage can optionally include the contribution of
        the index and of elements of `object` dtype.

        Parameters
        ----------
        index : bool, default True
            Specifies whether to include the memory usage of the Series index.
        deep : bool, default False
            If True, introspect the data deeply by interrogating
            `object` dtypes for system-level memory consumption, and include
            it in the returned value.

        Returns
        -------
        int
            Bytes of memory consumed.

        See Also
        --------
        numpy.ndarray.nbytes : Total bytes consumed by the elements of the
            array.
        DataFrame.memory_usage : Bytes consumed by a DataFrame.

        Examples
        --------
        >>> s = pd.Series(range(3))
        >>> s.memory_usage()
        104

        Not including the index gives the size of the rest of the data, which
        is necessarily smaller:

        >>> s.memory_usage(index=False)
        24

        The memory footprint of `object` values is ignored by default:

        >>> s = pd.Series(["a", "b"])
        >>> s.values
        array(['a', 'b'], dtype=object)
        >>> s.memory_usage()
        96
        >>> s.memory_usage(deep=True)
        212
        Rq   (   R`  RF   t   memory_usageR   (   R_   R   Rq   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR    s    1c         C   s   t  |  } |  j j |  } t |   rX t | t |  j |    } i t d 6} n i  } |  j j | |  } |  j	 | d | d t
 j |   } | r | j |  j |  j |   s | j |   q n  | S(   NR  R   Rp   (   R   R   R   R   R@   RZ   t	   _get_axisR   R   R   Rz   R   R   t   _set_is_copy(   R_   t   indicesRJ   t   is_copyR	  R   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   _takeR  s    !c         C   s1   t  j |  |  } |  j | d |  j j |   S(   s  
        Check whether `values` are contained in Series.

        Return a boolean Series showing whether each element in the Series
        matches an element in the passed sequence of `values` exactly.

        Parameters
        ----------
        values : set or list-like
            The sequence of values to test. Passing in a single string will
            raise a ``TypeError``. Instead, turn a single string into a
            list of one element.

            .. versionadded:: 0.18.1

              Support for values as a set.

        Returns
        -------
        isin : Series (bool dtype)

        Raises
        ------
        TypeError
          * If `values` is a string

        See Also
        --------
        DataFrame.isin : Equivalent method on DataFrame.

        Examples
        --------
        >>> s = pd.Series(['lama', 'cow', 'lama', 'beetle', 'lama',
        ...                'hippo'], name='animal')
        >>> s.isin(['cow', 'lama'])
        0     True
        1     True
        2     True
        3    False
        4     True
        5    False
        Name: animal, dtype: bool

        Passing a single string as ``s.isin('lama')`` will raise an error. Use
        a list of one element instead:

        >>> s.isin(['lama'])
        0     True
        1    False
        2     True
        3    False
        4     True
        5    False
        Name: animal, dtype: bool
        R   (   R*   t   isinR   R   R   (   R_   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR  k  s    8c         C   sA   | r! |  | k } |  | k } n |  | k } |  | k  } | | @S(   s9  
        Return boolean Series equivalent to left <= series <= right.

        This function returns a boolean vector containing `True` wherever the
        corresponding Series element is between the boundary values `left` and
        `right`. NA values are treated as `False`.

        Parameters
        ----------
        left : scalar
            Left boundary.
        right : scalar
            Right boundary.
        inclusive : bool, default True
            Include boundaries.

        Returns
        -------
        Series
            Each element will be a boolean.

        See Also
        --------
        Series.gt : Greater than of series and other.
        Series.lt : Less than of series and other.

        Notes
        -----
        This function is equivalent to ``(left <= ser) & (ser <= right)``

        Examples
        --------
        >>> s = pd.Series([2, 0, 4, 8, np.nan])

        Boundary values are included by default:

        >>> s.between(1, 4)
        0     True
        1    False
        2     True
        3    False
        4    False
        dtype: bool

        With `inclusive` set to ``False`` boundary values are excluded:

        >>> s.between(1, 4, inclusive=False)
        0     True
        1    False
        2    False
        3    False
        4    False
        dtype: bool

        `left` and `right` can be any scalar value:

        >>> s = pd.Series(['Alice', 'Bob', 'Carol', 'Eve'])
        >>> s.between('Anna', 'Daniel')
        0    False
        1     True
        2     True
        3    False
        dtype: bool
        (    (   R_   R  R  t	   inclusivet   lmaskt   rmask(    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   between  s    At   ,c         C   s   d d l  m } | j | d | d | d | d | d | d | }	 |	 j d	 d	  d
 f }
 | d	 k r~ d	 |
 j _ |
 _ n  |
 S(   s  
        Read CSV file.

        .. deprecated:: 0.21.0
            Use :func:`pandas.read_csv` instead.

        It is preferable to use the more powerful :func:`pandas.read_csv`
        for most general purposes, but ``from_csv`` makes for an easy
        roundtrip to and from a file (the exact counterpart of
        ``to_csv``), especially with a time Series.

        This method only differs from :func:`pandas.read_csv` in some defaults:

        - `index_col` is ``0`` instead of ``None`` (take first column as index
          by default)
        - `header` is ``None`` instead of ``0`` (the first row is not used as
          the column names)
        - `parse_dates` is ``True`` instead of ``False`` (try parsing the index
          as datetime by default)

        With :func:`pandas.read_csv`, the option ``squeeze=True`` can be used
        to return a Series like ``from_csv``.

        Parameters
        ----------
        path : string file path or file handle / StringIO
        sep : string, default ','
            Field delimiter
        parse_dates : boolean, default True
            Parse dates. Different default from read_table
        header : int, default None
            Row to use as header (skip prior rows)
        index_col : int or sequence, default 0
            Column to use for index. If a sequence is given, a MultiIndex
            is used. Different default from read_table
        encoding : string, optional
            a string representing the encoding to use if the contents are
            non-ascii, for python versions prior to 3
        infer_datetime_format : boolean, default False
            If True and `parse_dates` is True for a column, try to infer the
            datetime format based on the first datetime string. If the format
            can be inferred, there often will be a large parsing speed-up.

        Returns
        -------
        y : Series

        See Also
        --------
        read_csv
        i(   R   R8  t	   index_colt   sept   parse_datest   encodingt   infer_datetime_formatNi    (   R   R   Rl   R[   R{   R   Rb   (   R   t   pathR  R  R8  R  R  R  R   R-  R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRl     s    9	c         O   s  d d d d d d d d d	 d
 d d d d d d d d d d g } d d d d d d d d	 d
 d d d g } d | k r t  j d t d d | j d  | d <n  t |  d k r	| d } t |  o t |  d k s	t  j d j |  t d d | } q	n  t t | t |   |   } xL | D]D } | | k ret	 d j | | j
 |     n  | | | | <q/W| j d d   d  k rt  j d t d d t | d <n  |  j   j |   S(   Nt   path_or_bufR  R9  R:  R  R8  R   t   index_labelR_  R  t   compressiont   quotingt	   quotechart   line_terminatort	   chunksizet   tupleize_colst   date_formatt   doublequotet
   escapechart   decimalR  s   The signature of `Series.to_csv` was aligned to that of `DataFrame.to_csv`, and argument 'path' will be renamed to 'path_or_buf'.RT   i   i   s^  The signature of `Series.to_csv` was aligned to that of `DataFrame.to_csv`. Note that the order of arguments changed, and the new one has 'sep' in first place, for which "{}" is not a valid value. The old order will cease to be supported in a future version. Please refer to the documentation for `DataFrame.to_csv` when updating your function calls.s/   Argument given by name ('{}') and position ({})s   The signature of `Series.to_csv` was aligned to that of `DataFrame.to_csv`, and argument 'header' will change its default value from False to True: please pass an explicit value to suppress this warning.(   RU   RV   RW   R  RZ   R   R]   R   R
   R   R   R  R{   R   R*  t   to_csv(   R_   R   R   t   namest	   old_namest	   maybe_sept   pos_argsR   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR$  4  s>    	
		R&   c         C   s   t  t |   j   S(   N(   R`  RF   R&   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR&   m  s    c         C   s   t  t |   j   S(   N(   R`  RF   t   isnull(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR)  q  s    R(   c         C   s   t  t |   j   S(   N(   R`  RF   R(   (   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR(   u  s    c         C   s   t  t |   j   S(   N(   R`  RF   t   notnull(   R_   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR*  y  s    c         K   s   t  | d  } | j d d  | rM t d j t | j    d    n  |  j | p\ d  |  j r t	 |   } | r |  j
 |  q | Sn | r n
 |  j   Sd S(   s  
        Return a new Series with missing values removed.

        See the :ref:`User Guide <missing_data>` for more on which values are
        considered missing, and how to work with missing data.

        Parameters
        ----------
        axis : {0 or 'index'}, default 0
            There is only one axis to drop values from.
        inplace : bool, default False
            If True, do operation inplace and return None.
        **kwargs
            Not in use.

        Returns
        -------
        Series
            Series with NA entries dropped from it.

        See Also
        --------
        Series.isna: Indicate missing values.
        Series.notna : Indicate existing (non-missing) values.
        Series.fillna : Replace missing values.
        DataFrame.dropna : Drop rows or columns which contain NA values.
        Index.dropna : Drop missing indices.

        Examples
        --------
        >>> ser = pd.Series([1., 2., np.nan])
        >>> ser
        0    1.0
        1    2.0
        2    NaN
        dtype: float64

        Drop NA values from a Series.

        >>> ser.dropna()
        0    1.0
        1    2.0
        dtype: float64

        Keep the Series with valid entries in the same variable.

        >>> ser.dropna(inplace=True)
        >>> ser
        0    1.0
        1    2.0
        dtype: float64

        Empty strings are not considered NA values. ``None`` is considered an
        NA value.

        >>> ser = pd.Series([np.NaN, 2, pd.NaT, '', None, 'I stay'])
        >>> ser
        0       NaN
        1         2
        2       NaT
        3
        4      None
        5    I stay
        dtype: object
        >>> ser.dropna()
        1         2
        3
        5    I stay
        dtype: object
        RK   R  s1   dropna() got an unexpected keyword argument "{0}"i    N(   R   R  R{   R\   R]   R   R   R  R   R)   R   Rr   (   R_   RJ   RK   R   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR^  }  s    G		c         K   s)   t  j d t d d |  j d | |  S(   s   
        Return Series without null values.

        .. deprecated:: 0.23.0
            Use :meth:`Series.dropna` instead.
        sG   Method .valid will be removed in a future version. Use .dropna instead.RT   i   RK   (   RU   RV   RW   R^  (   R_   RK   R   (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRm     s    	t   startc         C   sU   |  j  } | r | j   } n  |  j j d | d |  } |  j | d | j |   S(   s  
        Cast to datetimeindex of timestamps, at *beginning* of period.

        Parameters
        ----------
        freq : string, default frequency of PeriodIndex
            Desired frequency
        how : {'s', 'e', 'start', 'end'}
            Convention for converting period to timestamp; start of period
            vs. end

        Returns
        -------
        ts : Series with DatetimeIndex
        R  R  R   (   R   Rr   R   t   to_timestampR   R   (   R_   R  R  Rr   R   R	  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR,    s    	c         C   sO   |  j  } | r | j   } n  |  j j d |  } |  j | d | j |   S(   s  
        Convert Series from DatetimeIndex to PeriodIndex with desired
        frequency (inferred from index if not passed).

        Parameters
        ----------
        freq : string, default

        Returns
        -------
        ts : Series with PeriodIndex
        R  R   (   R   Rr   R   t	   to_periodR   R   (   R_   R  Rr   R   R	  (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyR-    s    	t   plotN(    (   Rc   t
   __module__t   __doc__t	   _metadatat
   _accessorsR,   R   t   _deprecationsR   t   propertyR+   t   IndexOpsMixint   hasnansR  R{   R   R   R   t   classmethodR   R   R   R   R   R   R   R   Rb   t   setterRu   R   R   R   R   R   R   R   Rh   R   R   R   R   R   R   R   R   R   R   R   Rd   t   floatt	   __float__t   intt   __long__t   __int__R   RG   R   R   R   R   R   R  R   R  R  R  R  R  R  Rj   R"  Rk   R$  R+  R6  Rz   R1  R   t   itemsR   R   RH  R*  RK  RM  R]  R_  RL   Rc  RM   Rg  Rj  R   R   Rk  Rl  Rn  Ru  R  R  R  R  R  R  R  R   R   t   _shared_docsR  R  R  R  R  R  R  R   R  R  R  R  R  R  R  R  t   _agg_see_also_doct   _agg_examples_doct   _shared_doc_kwargsR  t   aggR  R  R  R  R  R~  R  R   R&  R  R   R  R  R  R  R  R  Rl   R$  R&   R)  R(   R*  R^  Rm   R,  R-  R/   RC   R^   R;   Re   R3   Rf   t   gfxt   SeriesPlotMethodsR.  R4   Rg   t   hist_seriest   hist(    (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyRF   f   st  #	v/		*		
		*	
	H=	!	0	1			=			#		:	8		"!	:IJEG@+?-	N		Q+i	(	7	&`_	-P			&	
	E	Z	6	;J	B9    \t	   info_axisi    t	   stat_axist   aliasest   rowst   docss&   The index (axis labels) of the Series.(   R0  t
   __future__R    t   textwrapR   RU   t   numpyR   t   pandas._libsR   R   R   R   R   t   pandas.compatR   R   R   R   R	   R
   t   pandas.compat.numpyR   R   t   pandas.util._decoratorsR   R   R   t   pandas.util._validatorsR   t   pandas.core.dtypes.commonR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   pandas.core.dtypes.genericR    R!   R"   R#   R$   R%   t   pandas.core.dtypes.missingR&   R'   R(   R)   t   pandas.coreR*   R+   R,   R-   R.   t   pandas.core.accessorR/   t   pandas.core.arraysR0   R1   t   pandas.core.arrays.categoricalR2   R3   t   pandas.core.arrays.sparseR4   t   pandas.core.commont   coreR  R   t   pandas.core.configR5   t   pandas.core.indexR6   R7   R8   R9   R:   t   pandas.core.indexes.accessorsR;   t   pandas.core.indexes.baset   indexesR   t   pandas.core.indexes.datetimesR<   t   pandas.core.indexes.periodR=   t   pandas.core.indexes.timedeltasR>   t   pandas.core.indexingR?   R@   t   pandas.core.internalsRA   t"   pandas.core.internals.constructionRB   t   pandas.core.stringsRC   t   pandas.core.tools.datetimesRD   t   pandas.io.formats.formatt   iot   formatsR]   R<  t   pandas.io.formats.terminalRE   t   pandas.plotting._coret   plottingt   _coreRD  t   __all__R   RB  RY   Rd   R5  R   RF   t   _setup_axest   _add_numeric_operationst   _add_series_only_operationst#   _add_series_or_dataframe_operationst   add_flex_arithmetic_methodst   add_special_arithmetic_methods(    (    (    s1   lib/python2.7/site-packages/pandas/core/series.pyt   <module>   s   "(j."((				                (


