
    A>i                       S r SSKJr  SSKJrJrJrJrJrJ	r	J
r
Jr  SSKrSSKJr  SSKJrJrJrJrJrJr  SSKJr  SSKJr  SS	KJr  SS
KJr  SSK J!r!  SSK"J#r#J$r$  SSK%J&r&  SSK'J(r(J)r)J*r*J+r+  SSK,J-r-J.r.  SSK/J0r0J1r1J2r2  SSK3J4r4  SSK5J6r6  SSK7J8r8  SSK9J:r:J;r;  \(       a  SSK<J=r=J>r>  SSKJ?r?J@r@JArAJBrB  SSKCJDrDJErEJFrF   " S S\45      rG " S S5      rH " S S\\   5      rI " S S\65      rJg) z.
Base and utility classes for pandas objects.
    )annotations)TYPE_CHECKINGAnyGenericLiteralSelfcastfinaloverloadN)lib)AxisIntDtypeObj
IndexLabelNDFrameTShapenpt)PYPY)functionAbstractMethodError)cache_readonly)can_hold_element)is_object_dtype	is_scalar)ExtensionDtype)ABCDataFrameABCIndexABCMultiIndex	ABCSeries)isnaremove_na_arraylike)
algorithmsnanopsops)DirNamesMixin)OpsMixin)ExtensionArray)ensure_wrapped_if_datetimelikeextract_array)HashableIterator)DropKeepNumpySorterNumpyValueArrayLikeScalarLike_co)	DataFrameIndexSeriesc                  h   ^  \ rS rSr% SrS\S'   \S
S j5       rSS jrSSS jjr	SU 4S jjr
S	rU =r$ )PandasObjectT   z(
Base class for various pandas objects.
zdict[str, Any]_cachec                    [        U 5      $ )z;
Class constructor (for this class it's just `__class__`).
)typeselfs    O/var/www/html/land-tabula/venv/lib/python3.13/site-packages/pandas/core/base.py_constructorPandasObject._constructor\   s    
 Dz    c                ,    [         R                  U 5      $ )z9
Return a string representation for a particular object.
)object__repr__r9   s    r;   rA   PandasObject.__repr__c   s    
 t$$r>   c                    [        U S5      (       d  gUc  U R                  R                  5         gU R                  R                  US5        g)zF
Reset cached properties. If ``key`` is passed, only clears that key.
r6   N)hasattrr6   clearpop)r:   keys     r;   _reset_cachePandasObject._reset_cachej   s;     tX&&;KKKKOOC&r>   c                   > [        U SS5      nU(       a5  U" SS9n[        [        U5      (       a  U5      $ UR                  5       5      $ [        TU ]  5       $ )z`
Generates the total memory usage for an object that returns
either a value or Series of values
memory_usageNTdeep)getattrintr   sumsuper
__sizeof__)r:   rK   mem	__class__s      r;   rR   PandasObject.__sizeof__u   sQ    
 t^T:D)Cinns<<#'')<< w!##r>    )returnz
type[Self])rW   strN)rG   z
str | NonerW   NonerW   rO   )__name__
__module____qualname____firstlineno____doc____annotations__propertyr<   rA   rH   rR   __static_attributes____classcell__)rT   s   @r;   r4   r4   T   s6    
  %	'$ $r>   r4   c                  ,    \ rS rSrSrSS jrSS jrSrg)	NoNewAttributesMixin   ah  
Mixin which prevents adding new attributes.

Prevents additional attributes via xxx.attribute = "something" after a
call to `self.__freeze()`. Mainly used to prevent the user from using
wrong attributes on an accessor (`Series.cat/.str/.dt`).

If you really want to add a new attribute at a later time, you need to use
`object.__setattr__(self, key, value)`.
c                2    [         R                  U SS5        g)z)
Prevents setting additional attributes.
__frozenTN)r@   __setattr__r9   s    r;   _freezeNoNewAttributesMixin._freeze   s     	4T2r>   c                    [        U SS5      (       a;  US:X  d5  U[        U 5      R                  ;   d  [        XS 5      c  [        SU S35      e[        R                  XU5        g )Nri   Fr6   z"You cannot add any new attribute '')rN   r8   __dict__AttributeErrorr@   rj   )r:   rG   values      r;   rj    NoNewAttributesMixin.__setattr__   s^     4U++8Od4j)))t$'3 #EcU!!LMM4e,r>   rV   N)rW   rZ   )rG   rX   rW   rZ   )r\   r]   r^   r_   r`   rk   rj   rc   rV   r>   r;   rf   rf      s    	3-r>   rf   c                      \ rS rSr% SrS\S'   SrS\S'   S\S	'   S
S/r\" \5      r	\
\S 5       5       r\S 5       r\
\SS j5       5       r\
\S 5       5       rS rSSS jjr\
SS j5       rS r\rSrg)SelectionMixin   z}
mixin implementing the selection & aggregation interface on a group-like
object sub-classes need to define: obj, exclusions
r   objNzIndexLabel | None
_selectionzfrozenset[Hashable]
exclusionsr6   __setstate__c                    [        U R                  [        [        [        [
        [        R                  45      (       d  U R                  /$ U R                  $ rY   )
isinstancerw   listtupler   r   npndarrayr9   s    r;   _selection_listSelectionMixin._selection_list   sB     OOdE9h

K
 
 OO$$r>   c                    U R                   b  [        U R                  [        5      (       a  U R                  $ U R                  U R                      $ rY   )rw   r{   rv   r   r9   s    r;   _selected_objSelectionMixin._selected_obj   s8    ??"j9&E&E88O88DOO,,r>   c                .    U R                   R                  $ rY   )r   ndimr9   s    r;   r   SelectionMixin.ndim   s     !!&&&r>   c                8   [        U R                  [        5      (       a  U R                  $ U R                  b  U R                  U R                     $ [        U R                  5      S:  a%  U R                  R                  U R                  SSS9$ U R                  $ )Nr      T)axis
only_slice)r{   rv   r   rw   r   lenrx   
_drop_axisr9   s    r;   _obj_with_exclusions#SelectionMixin._obj_with_exclusions   sy     dhh	**88O??&88D0011t!#
 88&&tQ4&PP88Or>   c                   U R                   b  [        SU R                    S35      e[        U[        [        [
        [        [        R                  45      (       a  [        U R                  R                  R                  U5      5      [        [        U5      5      :w  aQ  [        [        U5      R                  U R                  R                  5      5      n[        S[!        U5      SS  35      eU R#                  [        U5      SS9$ XR                  ;  a  [        SU 35      eU R                  U   R$                  nU R#                  XS9$ )	Nz
Column(s) z already selectedzColumns not found: r      )r   zColumn not found: )rw   
IndexErrorr{   r|   r}   r   r   r~   r   r   rv   columnsintersectionset
differenceKeyErrorrX   _gotitemr   )r:   rG   bad_keysr   s       r;   __getitem__SelectionMixin.__getitem__   s   ??&z$//)::KLMMcD%HbjjIJJ488##0056#c#h-GC 3 3DHH4D4D EF!4S]1R5H4IJKK==c=33 (("!3C59::88C=%%D===00r>   c                    [        U 5      e)z
sub-classes to define
return a sliced object

Parameters
----------
key : str / list of selections
ndim : {1, 2}
    requested ndim of result
subset : object, default None
    subset to act on
r   )r:   rG   r   subsets       r;   r   SelectionMixin._gotitem   s     "$''r>   c                    SnUR                   S:X  a?  [        R                  " U5      (       a  X;   d  [        R                  " U5      (       a  UnU$ UR                   S:X  a,  [        R                  " U5      (       a  XR                  :X  a  UnU$ )z?
Infer the `selection` to pass to our constructor in _gotitem.
Nr   r   )r   r   r   is_list_likename)r:   rG   r   	selections       r;   _infer_selectionSelectionMixin._infer_selection   su     	;;!]]3CMc6F6Fs6K6KI  [[A#--"4"49KIr>   c                    [        U 5      erY   r   )r:   funcargskwargss       r;   	aggregateSelectionMixin.aggregate  s    !$''r>   rV   r[   rY   )r   rO   )r   zSeries | DataFrame)r\   r]   r^   r_   r`   ra   rw   _internal_namesr   _internal_names_setr
   rb   r   r   r   r   r   r   r   r   r   aggrc   rV   r>   r;   rt   rt      s    
 
M$(J!(##0Oo.
   - - '  '    1 (  ( Cr>   rt   c                  ,   \ rS rSr% SrSr\" S/5      rS\S'   \	S/S j5       r
\	S0S j5       r\S1S	 j5       r\	" \S
S9r\	S2S j5       rS3S jr\	S3S j5       r\S 5       r\	S3S j5       r\	S3S j5       r\	S4S j5       rSS\R.                  4       S5S jjr\\	S6S j5       5       r S7     S8S jjr S7     S8S jjrS9S jr\rS:S jr\S6S j5       r \S;S j5       r!     S<         S=S jjr"S r#\S>S?S jj5       r$\	S6S  j5       r%\	S6S! j5       r&\	S6S" j5       r'\S@SAS# jj5       r(  SB     SCS$ jjr)\*  SD       SES% jj5       r+\*  SD       SFS& jj5       r+  SG       SHS' jjr+S(S).SIS* jjr,\SJSKS+ jj5       r-S, r.S- r/S.r0g)LIndexOpsMixini  zK
Common ops mixin to support a unified interface / docs for Series / Index
i  tolistzfrozenset[str]_hidden_attrsc                    [        U 5      erY   r   r9   s    r;   dtypeIndexOpsMixin.dtype       "$''r>   c                    [        U 5      erY   r   r9   s    r;   _valuesIndexOpsMixin._values  r   r>   c                2    [         R                  " X5        U $ )zO
Return the transpose, which is by definition self.

Returns
-------
%(klass)s
)nvvalidate_transpose)r:   r   r   s      r;   	transposeIndexOpsMixin.transpose!  s     	d+r>   a:  
        Return the transpose, which is by definition self.

        See Also
        --------
        Index : Immutable sequence used for indexing and alignment.

        Examples
        --------
        For Series:

        >>> s = pd.Series(['Ant', 'Bear', 'Cow'])
        >>> s
        0     Ant
        1    Bear
        2     Cow
        dtype: str
        >>> s.T
        0     Ant
        1    Bear
        2     Cow
        dtype: str

        For Index:

        >>> idx = pd.Index([1, 2, 3])
        >>> idx.T
        Index([1, 2, 3], dtype='int64')
        )docc                .    U R                   R                  $ )aK  
Return a tuple of the shape of the underlying data.

See Also
--------
Series.ndim : Number of dimensions of the underlying data.
Series.size : Return the number of elements in the underlying data.
Series.nbytes : Return the number of bytes in the underlying data.

Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> s.shape
(3,)
)r   shaper9   s    r;   r   IndexOpsMixin.shapeN  s    " ||!!!r>   c                    [        U 5      erY   r   r9   s    r;   __len__IndexOpsMixin.__len__a  s    !$''r>   c                    g)a@  
Number of dimensions of the underlying data, by definition 1.

See Also
--------
Series.size: Return the number of elements in the underlying data.
Series.shape: Return a tuple of the shape of the underlying data.
Series.dtype: Return the dtype object of the underlying data.
Series.values: Return Series as ndarray or ndarray-like depending on the dtype.

Examples
--------
>>> s = pd.Series(["Ant", "Bear", "Cow"])
>>> s
0     Ant
1    Bear
2     Cow
dtype: str
>>> s.ndim
1

For Index:

>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.ndim
1
r   rV   r9   s    r;   r   IndexOpsMixin.ndimh  s    > r>   c                ^    [        U 5      S:X  a  [        [        U 5      5      $ [        S5      e)a  
Return the first element of the underlying data as a Python scalar.

Returns
-------
scalar
    The first element of Series or Index.

Raises
------
ValueError
    If the data is not length = 1.

See Also
--------
Index.values : Returns an array representing the data in the Index.
Series.head : Returns the first `n` rows.

Examples
--------
>>> s = pd.Series([1])
>>> s.item()
1

For an index:

>>> s = pd.Series([1], index=["a"])
>>> s.index.item()
'a'
r   z6can only convert an array of size 1 to a Python scalar)r   nextiter
ValueErrorr9   s    r;   itemIndexOpsMixin.item  s+    @ t9>T
##QRRr>   c                .    U R                   R                  $ )a  
Return the number of bytes in the underlying data.

See Also
--------
Series.ndim : Number of dimensions of the underlying data.
Series.size : Return the number of elements in the underlying data.

Examples
--------
For Series:

>>> s = pd.Series(["Ant", "Bear", "Cow"])
>>> s
0     Ant
1    Bear
2     Cow
dtype: str
>>> s.nbytes
34

For Index:

>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.nbytes
24
)r   nbytesr9   s    r;   r   IndexOpsMixin.nbytes  s    > ||"""r>   c                ,    [        U R                  5      $ )aM  
Return the number of elements in the underlying data.

See Also
--------
Series.ndim: Number of dimensions of the underlying data, by definition 1.
Series.shape: Return a tuple of the shape of the underlying data.
Series.dtype: Return the dtype object of the underlying data.
Series.values: Return Series as ndarray or ndarray-like depending on the dtype.

Examples
--------
For Series:

>>> s = pd.Series(["Ant", "Bear", "Cow"])
>>> s
0     Ant
1    Bear
2     Cow
dtype: str
>>> s.size
3

For Index:

>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.size
3
)r   r   r9   s    r;   sizeIndexOpsMixin.size  s    B 4<<  r>   c                    [        U 5      e)a  
The ExtensionArray of the data backing this Series or Index.

This property provides direct access to the underlying array data of a
Series or Index without requiring conversion to a NumPy array. It
returns an ExtensionArray, which is the native storage format for
pandas extension dtypes.

Returns
-------
ExtensionArray
    An ExtensionArray of the values stored within. For extension
    types, this is the actual array. For NumPy native types, this
    is a thin (no copy) wrapper around :class:`numpy.ndarray`.

    ``.array`` differs from ``.values``, which may require converting
    the data to a different form.

See Also
--------
Index.to_numpy : Similar method that always returns a NumPy array.
Series.to_numpy : Similar method that always returns a NumPy array.

Notes
-----
This table lays out the different array types for each extension
dtype within pandas.

================== =============================
dtype              array type
================== =============================
category           Categorical
period             PeriodArray
interval           IntervalArray
IntegerNA          IntegerArray
string             StringArray
boolean            BooleanArray
datetime64[ns, tz] DatetimeArray
================== =============================

For any 3rd-party extension types, the array type will be an
ExtensionArray.

For all remaining dtypes ``.array`` will be a
:class:`arrays.NumpyExtensionArray` wrapping the actual ndarray
stored within. If you absolutely need a NumPy array (possibly with
copying / coercing data), then use :meth:`Series.to_numpy` instead.

Examples
--------
For regular NumPy types like int, and float, a NumpyExtensionArray
is returned.

>>> pd.Series([1, 2, 3]).array
<NumpyExtensionArray>
[1, 2, 3]
Length: 3, dtype: int64

For extension types, like Categorical, the actual ExtensionArray
is returned

>>> ser = pd.Series(pd.Categorical(["a", "b", "a"]))
>>> ser.array
['a', 'b', 'a']
Categories (2, str): ['a', 'b']
r   r9   s    r;   arrayIndexOpsMixin.array  s    H "$''r>   NFc                   [        U R                  [        5      (       a  U R                  R                  " U4X#S.UD6$ U(       a1  [        [        UR                  5       5      5      n[        SU S35      eU[        R                  L=(       aM    U[        R                  L =(       a/    [        R                  " U R                  [        R                  5      (       + nU R                  nU(       ag  U R                   (       aV  [#        Xs5      (       d  [        R$                  " XqS9nOUR'                  5       nX7[        R(                  " [+        U 5      5      '   [        R$                  " XqS9nU(       a  U(       a  U(       df  [        R,                  " U R                  SS USS 5      (       a:  U(       d#  UR/                  5       nSUR0                  l        U$ UR'                  5       nU$ )a  
A NumPy ndarray representing the values in this Series or Index.

Parameters
----------
dtype : str or numpy.dtype, optional
    The dtype to pass to :meth:`numpy.asarray`.
copy : bool, default False
    Whether to ensure that the returned value is not a view on
    another array. Note that ``copy=False`` does not *ensure* that
    ``to_numpy()`` is no-copy. Rather, ``copy=True`` ensure that
    a copy is made, even if not strictly necessary.
na_value : Any, optional
    The value to use for missing values. The default value depends
    on `dtype` and the type of the array.
**kwargs
    Additional keywords passed through to the ``to_numpy`` method
    of the underlying array (for extension arrays).

Returns
-------
numpy.ndarray
    The NumPy ndarray holding the values from this Series or Index.
    The dtype of the array may differ. See Notes.

See Also
--------
Series.array : Get the actual data stored within.
Index.array : Get the actual data stored within.
DataFrame.to_numpy : Similar method for DataFrame.

Notes
-----
The returned array will be the same up to equality (values equal
in `self` will be equal in the returned array; likewise for values
that are not equal). When `self` contains an ExtensionArray, the
dtype may be different. For example, for a category-dtype Series,
``to_numpy()`` will return a NumPy array and the categorical dtype
will be lost.

For NumPy dtypes, this will be a reference to the actual data stored
in this Series or Index (assuming ``copy=False``). Modifying the result
in place will modify the data stored in the Series or Index (not that
we recommend doing that).

For extension types, ``to_numpy()`` *may* require copying data and
coercing the result to a NumPy type (possibly object), which may be
expensive. When you need a no-copy reference to the underlying data,
:attr:`Series.array` should be used instead.

This table lays out the different dtypes and default return types of
``to_numpy()`` for various dtypes within pandas.

================== ================================
dtype              array type
================== ================================
category[T]        ndarray[T] (same dtype as input)
period             ndarray[object] (Periods)
interval           ndarray[object] (Intervals)
IntegerNA          ndarray[object]
datetime64[ns]     datetime64[ns]
datetime64[ns, tz] ndarray[object] (Timestamps)
================== ================================

Examples
--------
>>> ser = pd.Series(pd.Categorical(["a", "b", "a"]))
>>> ser.to_numpy()
array(['a', 'b', 'a'], dtype=object)

Specify the `dtype` to control how datetime-aware data is represented.
Use ``dtype=object`` to return an ndarray of pandas :class:`Timestamp`
objects, each with the correct ``tz``.

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

Or ``dtype='datetime64[ns]'`` to return an ndarray of native
datetime64 values. The values are converted to UTC and the timezone
info is dropped.

>>> ser.to_numpy(dtype="datetime64[ns]")
... # doctest: +ELLIPSIS
array(['1999-12-31T23:00:00.000000000', '2000-01-01T23:00:00...'],
      dtype='datetime64[ns]')
)copyna_valuez/to_numpy() got an unexpected keyword argument 'rn   )r   Nr   F)r{   r   r   r   to_numpyr   r   keys	TypeErrorr   
no_defaultr~   nan
issubdtypefloatingr   hasnansr   asarrayr   
asanyarrayr    shares_memoryviewflags	writeable)	r:   r   r   r   r   r   fillnavaluesresults	            r;   r   IndexOpsMixin.to_numpy7  sa   @ djj.11::&&uU4UfUUD/0HA(1M 
 CNN* T'RBMM$**bkk,RS 	 dll#F55 F8082==d,-F0Ra 0&!*==#[[]F-2FLL*  $[[]Fr>   c                $    U R                   (       + $ )a#  
Indicator whether Index is empty.

An Index is considered empty if it has no elements. This property can be
useful for quickly checking the state of an Index, especially in data
processing and analysis workflows where handling of empty datasets might
be required.

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

See Also
--------
Index.size : Return the number of elements in the underlying data.

Examples
--------
>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.empty
False

>>> idx_empty = pd.Index([])
>>> idx_empty
Index([], dtype='object')
>>> idx_empty.empty
True

If we only have NaNs in our DataFrame, it is not considered empty!

>>> idx = pd.Index([np.nan, np.nan])
>>> idx
Index([nan, nan], dtype='float64')
>>> idx.empty
False
)r   r9   s    r;   emptyIndexOpsMixin.empty  s    T 99}r>   c                    U R                   n[        R                  " U5        [        R                  " X#U5      n[	        U[
        5      (       a  UR                  US9$ [        R                  " XRS9nU$ )a  
Return int position of the largest value in the Series.

If the maximum is achieved in multiple locations,
the first row position is returned.

Parameters
----------
axis : None
    Unused. Parameter needed for compatibility with DataFrame.
skipna : bool, default True
    Exclude NA/null values. If the entire Series is NA, or if ``skipna=False``
    and there is an NA value, this method will raise a ``ValueError``.
*args, **kwargs
    Additional arguments and keywords for compatibility with NumPy.

Returns
-------
int
    Row position of the maximum value.

See Also
--------
Series.argmax : Return position of the maximum value.
Series.argmin : Return position of the minimum value.
numpy.ndarray.argmax : Equivalent method for numpy arrays.
Series.idxmax : Return index label of the maximum values.
Series.idxmin : Return index label of the minimum values.

Examples
--------
Consider dataset containing cereal calories

>>> s = pd.Series(
...     [100.0, 110.0, 120.0, 110.0],
...     index=[
...         "Corn Flakes",
...         "Almond Delight",
...         "Cinnamon Toast Crunch",
...         "Cocoa Puff",
...     ],
... )
>>> s
Corn Flakes              100.0
Almond Delight           110.0
Cinnamon Toast Crunch    120.0
Cocoa Puff               110.0
dtype: float64

>>> s.argmax()
np.int64(2)
>>> s.argmin()
np.int64(0)

The maximum cereal calories is the third element and
the minimum cereal calories is the first element,
since series is zero-indexed.
skipna)	r   r   validate_minmax_axisvalidate_argmax_with_skipnar{   r'   argmaxr#   	nanargmaxr:   r   r   r   r   delegater   s          r;   r   IndexOpsMixin.argmax  c    z <<
%//fEh//??&?11%%h>F Mr>   c                    U R                   n[        R                  " U5        [        R                  " X#U5      n[	        U[
        5      (       a  UR                  US9$ [        R                  " XRS9nU$ )a  
Return int position of the smallest value in the Series.

If the minimum is achieved in multiple locations,
the first row position is returned.

Parameters
----------
axis : None
    Unused. Parameter needed for compatibility with DataFrame.
skipna : bool, default True
    Exclude NA/null values. If the entire Series is NA, or if ``skipna=False``
    and there is an NA value, this method will raise a ``ValueError``.
*args, **kwargs
    Additional arguments and keywords for compatibility with NumPy.

Returns
-------
int
    Row position of the minimum value.

See Also
--------
Series.argmin : Return position of the minimum value.
Series.argmax : Return position of the maximum value.
numpy.ndarray.argmin : Equivalent method for numpy arrays.
Series.idxmin : Return index label of the minimum values.
Series.idxmax : Return index label of the maximum values.

Examples
--------
Consider dataset containing cereal calories

>>> s = pd.Series(
...     [100.0, 110.0, 120.0, 110.0],
...     index=[
...         "Corn Flakes",
...         "Almond Delight",
...         "Cinnamon Toast Crunch",
...         "Cocoa Puff",
...     ],
... )
>>> s
Corn Flakes              100.0
Almond Delight           110.0
Cinnamon Toast Crunch    120.0
Cocoa Puff               110.0
dtype: float64

>>> s.argmax()
np.int64(2)
>>> s.argmin()
np.int64(0)

The maximum cereal calories is the third element and
the minimum cereal calories is the first element,
since series is zero-indexed.
r   )	r   r   r   r   r{   r'   argminr#   	nanargminr   s          r;   r   IndexOpsMixin.argmin3  r   r>   c                6    U R                   R                  5       $ )a8  
Return a list of the values.

These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period)

Returns
-------
list
    List containing the values as Python or pandas scalers.

See Also
--------
numpy.ndarray.tolist : Return the array as an a.ndim-levels deep
    nested list of Python scalars.

Examples
--------
For Series

>>> s = pd.Series([1, 2, 3])
>>> s.to_list()
[1, 2, 3]

For Index:

>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')

>>> idx.to_list()
[1, 2, 3]
)r   r   r9   s    r;   r   IndexOpsMixin.tolist|  s    F ||""$$r>   c                    [        U R                  [        R                  5      (       d  [	        U R                  5      $ [        U R                  R                  [        U R                  R                  5      5      $ )a  
Return an iterator of the values.

These are each a scalar type, which is a Python scalar
(for str, int, float) or a pandas scalar
(for Timestamp/Timedelta/Interval/Period)

Returns
-------
iterator
    An iterator yielding scalar values from the Series.

See Also
--------
Series.items : Lazily iterate over (index, value) tuples.

Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> for x in s:
...     print(x)
1
2
3
)	r{   r   r~   r   r   mapr   ranger   r9   s    r;   __iter__IndexOpsMixin.__iter__  sN    6 $,,

33%%t||((%0A0A*BCCr>   c                F    [        [        U 5      R                  5       5      $ )aP  
Return True if there are any NaNs.

Enables various performance speedups.

Returns
-------
bool

See Also
--------
Series.isna : Detect missing values.
Series.notna : Detect existing (non-missing) values.

Examples
--------
>>> s = pd.Series([1, 2, 3, None])
>>> s
0    1.0
1    2.0
2    3.0
3    NaN
dtype: float64
>>> s.hasnans
True
)boolr    anyr9   s    r;   r   IndexOpsMixin.hasnans  s    < DJNN$%%r>   c                    U R                   n[        U[        5      (       a  UR                  XS9$ [        R
                  " X1US9$ )a  
An internal function that maps values using the input
correspondence (which can be a dict, Series, or function).

Parameters
----------
mapper : function, dict, or Series
    The input correspondence object
na_action : {None, 'ignore'}
    If 'ignore', propagate NA values, without passing them to the
    mapping function

Returns
-------
Union[Index, MultiIndex], inferred
    The output of the mapping function applied to the index.
    If the function returns a tuple with more than one element
    a MultiIndex will be returned.
)	na_action)r   r{   r'   r  r"   	map_array)r:   mapperr
  arrs       r;   _map_valuesIndexOpsMixin._map_values  s>    * llc>**776777##C9EEr>   c           	     4    [         R                  " U UUUUUS9$ )ai
  
Return a Series containing counts of unique values.

The resulting object will be in descending order so that the
first element is the most frequently-occurring element.
Excludes NA values by default.

Parameters
----------
normalize : bool, default False
    If True then the object returned will contain the relative
    frequencies of the unique values.
sort : bool, default True
    Stable sort by frequencies when True. Preserve the order of the data
    when False.

    .. versionchanged:: 3.0.0

        Prior to 3.0.0, the sort was unstable.
ascending : bool, default False
    Sort in ascending order.
bins : int, optional
    Rather than count values, group them into half-open bins,
    a convenience for ``pd.cut``, only works with numeric data.
dropna : bool, default True
    Don't include counts of NaN.

Returns
-------
Series
    Series containing counts of unique values.

See Also
--------
Series.count: Number of non-NA elements in a Series.
DataFrame.count: Number of non-NA elements in a DataFrame.
DataFrame.value_counts: Equivalent method on DataFrames.

Examples
--------
>>> index = pd.Index([3, 1, 2, 3, 4, np.nan])
>>> index.value_counts()
3.0    2
1.0    1
2.0    1
4.0    1
Name: count, dtype: int64

With `normalize` set to `True`, returns the relative frequency by
dividing all values by the sum of values.

>>> s = pd.Series([3, 1, 2, 3, 4, np.nan])
>>> s.value_counts(normalize=True)
3.0    0.4
1.0    0.2
2.0    0.2
4.0    0.2
Name: proportion, dtype: float64

**bins**

Bins can be useful for going from a continuous variable to a
categorical variable; instead of counting unique
apparitions of values, divide the index in the specified
number of half-open bins.

>>> s.value_counts(bins=3)
(0.996, 2.0]    2
(2.0, 3.0]      2
(3.0, 4.0]      1
Name: count, dtype: int64

**dropna**

With `dropna` set to `False` we can also see NaN index values.

>>> s.value_counts(dropna=False)
3.0    2
1.0    1
2.0    1
4.0    1
NaN    1
Name: count, dtype: int64

**Categorical Dtypes**

Rows with categorical type will be counted as one group
if they have same categories and order.
In the example below, even though ``a``, ``c``, and ``d``
all have the same data types of ``category``,
only ``c`` and ``d`` will be counted as one group
since ``a`` doesn't have the same categories.

>>> df = pd.DataFrame({"a": [1], "b": ["2"], "c": [3], "d": [3]})
>>> df = df.astype({"a": "category", "c": "category", "d": "category"})
>>> df
   a  b  c  d
0  1  2  3  3

>>> df.dtypes
a    category
b      str
c    category
d    category
dtype: object

>>> df.dtypes.value_counts()
category    2
category    1
str         1
Name: count, dtype: int64
)sort	ascending	normalizebinsdropna)r"   value_counts_internal)r:   r  r  r  r  r  s         r;   value_countsIndexOpsMixin.value_counts   s*    p //
 	
r>   c                    U R                   n[        U[        R                  5      (       d  UR	                  5       nU$ [
        R                  " U5      nU$ rY   )r   r{   r~   r   uniquer"   unique1d)r:   r   r   s      r;   r  IndexOpsMixin.unique  sE    &"**--]]_F   ((0Fr>   c                \    U R                  5       nU(       a  [        U5      n[        U5      $ )a  
Return number of unique elements in the object.

Excludes NA values by default.

Parameters
----------
dropna : bool, default True
    Don't include NaN in the count.

Returns
-------
int
    An integer indicating the number of unique elements in the object.

See Also
--------
DataFrame.nunique: Method nunique for DataFrame.
Series.count: Count non-NA/null observations in the Series.

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

>>> s.nunique()
4
)r  r!   r   )r:   r  uniqss      r;   nuniqueIndexOpsMixin.nunique  s'    H '.E5zr>   c                8    U R                  SS9[        U 5      :H  $ )a  
Return True if values in the object are unique.

Returns
-------
bool

See Also
--------
Series.unique : Return unique values of Series object.
Series.drop_duplicates : Return Series with duplicate values removed.
Series.duplicated : Indicate duplicate Series values.

Examples
--------
>>> s = pd.Series([1, 2, 3])
>>> s.is_unique
True

>>> s = pd.Series([1, 2, 3, 1])
>>> s.is_unique
False
F)r  )r  r   r9   s    r;   	is_uniqueIndexOpsMixin.is_unique  s    2 ||5|)SY66r>   c                2    SSK Jn  U" U 5      R                  $ )ak  
Return True if values in the object are monotonically increasing.

Returns
-------
bool

See Also
--------
Series.is_monotonic_decreasing : Return boolean if values in the object are
    monotonically decreasing.

Examples
--------
>>> s = pd.Series([1, 2, 2])
>>> s.is_monotonic_increasing
True

>>> s = pd.Series([3, 2, 1])
>>> s.is_monotonic_increasing
False
r   r1   )pandasr1   is_monotonic_increasingr:   r1   s     r;   r'  %IndexOpsMixin.is_monotonic_increasing      0 	!T{222r>   c                2    SSK Jn  U" U 5      R                  $ )an  
Return True if values in the object are monotonically decreasing.

Returns
-------
bool

See Also
--------
Series.is_monotonic_increasing : Return boolean if values in the object are
    monotonically increasing.

Examples
--------
>>> s = pd.Series([3, 2, 2, 1])
>>> s.is_monotonic_decreasing
True

>>> s = pd.Series([1, 2, 3])
>>> s.is_monotonic_decreasing
False
r   r%  )r&  r1   is_monotonic_decreasingr(  s     r;   r,  %IndexOpsMixin.is_monotonic_decreasing  r*  r>   c                l   [        U R                  S5      (       a  U R                  R                  US9$ U R                  R                  nU(       ab  [	        U R
                  5      (       aH  [        (       d=  [        [        R                  U R                  5      nU[        R                  " U5      -  nU$ )aG  
Memory usage of the values.

Parameters
----------
deep : bool, default False
    Introspect the data deeply, interrogate
    `object` dtypes for system-level memory consumption.

Returns
-------
bytes used
    Returns memory usage of the values in the Index in bytes.

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

Notes
-----
Memory usage does not include memory consumed by elements that
are not components of the array if deep=False or if used on PyPy

Examples
--------
>>> idx = pd.Index([1, 2, 3])
>>> idx.memory_usage()
24
rK   rL   )rD   r   rK   r   r   r   r   r	   r~   r   r   r   memory_usage_of_objects)r:   rM   vr   s       r;   _memory_usageIndexOpsMixin._memory_usage  s    @ 4::~..::** +   JJODJJ//"**dll3F,,V44Ar>   c                   [         R                  " U R                  XS9u  p4UR                  [        R
                  :X  a  UR                  [        R                  5      n[        U [        5      (       a,  [        U 5      S:X  a  U SS nX44$ U R                  U5      n X44$ SSKJn   U" X@R                  SS9nX44$ ! [         a    U" USS9n X44$ f = f)a  
Encode the object as an enumerated type or categorical variable.

This method is useful for obtaining a numeric representation of an
array when all that matters is identifying distinct values. `factorize`
is available as both a top-level function :func:`pandas.factorize`,
and as a method :meth:`Series.factorize` and :meth:`Index.factorize`.

Parameters
----------
sort : bool, default False
    Sort `uniques` and shuffle `codes` to maintain the
    relationship.
use_na_sentinel : bool, default True
    If True, the sentinel -1 will be used for NaN values. If False,
    NaN values will be encoded as non-negative integers and will not drop the
    NaN from the uniques of the values.

Returns
-------
codes : ndarray
    An integer ndarray that's an indexer into `uniques`.
    ``uniques.take(codes)`` will have the same values as `values`.
uniques : ndarray, Index, or Categorical
    The unique valid values. When `values` is Categorical, `uniques`
    is a Categorical. When `values` is some other pandas object, an
    `Index` is returned. Otherwise, a 1-D ndarray is returned.

    .. note::

        Even if there's a missing value in `values`, `uniques` will
        *not* contain an entry for it.

See Also
--------
cut : Discretize continuous-valued array.
unique : Find the unique value in an array.

Notes
-----
Reference :ref:`the user guide <reshaping.factorize>` for more examples.

Examples
--------
These examples all show factorize as a top-level method like
``pd.factorize(values)``. The results are identical for methods like
:meth:`Series.factorize`.

>>> codes, uniques = pd.factorize(
...     np.array(["b", "b", "a", "c", "b"], dtype="O")
... )
>>> codes
array([0, 0, 1, 2, 0])
>>> uniques
array(['b', 'a', 'c'], dtype=object)

With ``sort=True``, the `uniques` will be sorted, and `codes` will be
shuffled so that the relationship is the maintained.

>>> codes, uniques = pd.factorize(
...     np.array(["b", "b", "a", "c", "b"], dtype="O"), sort=True
... )
>>> codes
array([1, 1, 0, 2, 1])
>>> uniques
array(['a', 'b', 'c'], dtype=object)

When ``use_na_sentinel=True`` (the default), missing values are indicated in
the `codes` with the sentinel value ``-1`` and missing values are not
included in `uniques`.

>>> codes, uniques = pd.factorize(
...     np.array(["b", None, "a", "c", "b"], dtype="O")
... )
>>> codes
array([ 0, -1,  1,  2,  0])
>>> uniques
array(['b', 'a', 'c'], dtype=object)

Thus far, we've only factorized lists (which are internally coerced to
NumPy arrays). When factorizing pandas objects, the type of `uniques`
will differ. For Categoricals, a `Categorical` is returned.

>>> cat = pd.Categorical(["a", "a", "c"], categories=["a", "b", "c"])
>>> codes, uniques = pd.factorize(cat)
>>> codes
array([0, 0, 1])
>>> uniques
['a', 'c']
Categories (3, str): ['a', 'b', 'c']

Notice that ``'b'`` is in ``uniques.categories``, despite not being
present in ``cat.values``.

For all other pandas objects, an Index of the appropriate type is
returned.

>>> cat = pd.Series(["a", "a", "c"])
>>> codes, uniques = pd.factorize(cat)
>>> codes
array([0, 0, 1])
>>> uniques
Index(['a', 'c'], dtype='str')

If NaN is in the values, and we want to include NaN in the uniques of the
values, it can be achieved by setting ``use_na_sentinel=False``.

>>> values = np.array([1, 2, 1, np.nan])
>>> codes, uniques = pd.factorize(values)  # default: use_na_sentinel=True
>>> codes
array([ 0,  1,  0, -1])
>>> uniques
array([1., 2.])

>>> codes, uniques = pd.factorize(values, use_na_sentinel=False)
>>> codes
array([0, 1, 0, 2])
>>> uniques
array([ 1.,  2., nan])
)r  use_na_sentinelr   Nr%  F)r   r   )r   )r"   	factorizer   r   r~   float16astypefloat32r{   r   r   r<   r&  r1   NotImplementedError)r:   r  r4  codesuniquesr1   s         r;   r5  IndexOpsMixin.factorize1  s    z $--LLt
 ==BJJ&nnRZZ0GdM**4yA~r( ~ ++G4 ~ %5zzF
 ~	 ' 5  e4~	5s   'B; ;CCc                    g rY   rV   r:   rq   sidesorters       r;   searchsortedIndexOpsMixin.searchsorted  s     r>   c                    g rY   rV   r>  s       r;   rA  rB    s      #r>   c                   [        U[        5      (       a$  S[        U5      R                   S3n[	        U5      eU R
                  n[        U[        R                  5      (       d  UR                  XUS9$ [        R                  " UUUUS9$ )a  
Find indices where elements should be inserted to maintain order.

Find the indices into a sorted Index `self` such that, if the
corresponding elements in `value` were inserted before the indices,
the order of `self` would be preserved.

.. note::

    The Index *must* be monotonically sorted, otherwise
    wrong locations will likely be returned. Pandas does *not*
    check this for you.

Parameters
----------
value : array-like or scalar
    Values to insert into `self`.
side : {{'left', 'right'}}, optional
    If 'left', the index of the first suitable location found is given.
    If 'right', return the last such index.  If there is no suitable
    index, return either 0 or N (where N is the length of `self`).
sorter : 1-D array-like, optional
    Optional array of integer indices that sort `self` into ascending
    order. They are typically the result of ``np.argsort``.

Returns
-------
int or array of int
    A scalar or array of insertion points with the
    same shape as `value`.

See Also
--------
sort_values : Sort by the values along either axis.
numpy.searchsorted : Similar method from NumPy.

Notes
-----
Binary search is used to find the required insertion points.

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

>>> ser.searchsorted(4)
np.int64(3)

>>> ser.searchsorted([0, 4])
array([0, 3])

>>> ser.searchsorted([1, 3], side="left")
array([0, 2])

>>> ser.searchsorted([1, 3], side="right")
array([1, 3])

>>> ser = pd.Series(pd.to_datetime(["3/11/2000", "3/12/2000", "3/13/2000"]))
>>> ser
0   2000-03-11
1   2000-03-12
2   2000-03-13
dtype: datetime64[us]

>>> ser.searchsorted("3/14/2000")
np.int64(3)

>>> ser = pd.Categorical(
...     ["apple", "bread", "bread", "cheese", "milk"], ordered=True
... )
>>> ser
['apple', 'bread', 'bread', 'cheese', 'milk']
Categories (4, str): ['apple' < 'bread' < 'cheese' < 'milk']

>>> ser.searchsorted("bread")
np.int64(1)

>>> ser.searchsorted(["bread"], side="right")
array([3])

If the values are not monotonically sorted, wrong locations
may be returned:

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

>>> ser.searchsorted(1)  # doctest: +SKIP
0  # wrong result, correct would be 1
z(Value must be 1-D array-like or scalar, z is not supported)r?  r@  )
r{   r   r8   r\   r   r   r~   r   rA  r"   )r:   rq   r?  r@  msgr   s         r;   rA  rB    s    N e\**:;''((9;  S/!&"**--&&u&GG&&	
 	
r>   firstkeepc               *    U R                  US9nX)    $ NrG  )_duplicated)r:   rH  
duplicateds      r;   drop_duplicatesIndexOpsMixin.drop_duplicatesU  s     %%4%0
K  r>   c                    U R                   n[        U[        5      (       a  UR                  US9$ [        R                  " X!S9$ rJ  )r   r{   r'   rL  r"   )r:   rH  r  s      r;   rK  IndexOpsMixin._duplicatedZ  s:    llc>**>>t>,,$$S44r>   c                   [         R                  " X5      nU R                  n[        USSS9n[         R                  " XTR
                  5      n[        U5      n[        U[        5      (       a6  [        R                  " UR                  UR                  UR                  5      n[        R                  " SS9   [         R                  " XEU5      nS S S 5        U R!                  WX1S9$ ! , (       d  f       N= f)NT)extract_numpyextract_rangeignore)all)r   other)r$   get_op_result_namer   r)   maybe_prepare_scalar_for_opr   r(   r{   r  r~   arangestartstopsteperrstatearithmetic_op_construct_result)r:   rV  opres_namelvaluesrvaluesr   s          r;   _arith_methodIndexOpsMixin._arith_methoda  s    ))$6,,TN11'==I09gu%%iiw||W\\JG[[X&&&w<F ' %%f8%II '&s   8C((
C6c                    [        U 5      e)zf
Construct an appropriately-wrapped result from the ArrayLike result
of an arithmetic-like operation.
r   )r:   r   r   rV  s       r;   r_  IndexOpsMixin._construct_resultp  s    
 "$''r>   rV   )rW   r   )rW   zExtensionArray | np.ndarray)rW   r   )rW   r   r[   )rW   r'   )r   znpt.DTypeLike | Noner   r  r   r@   rW   z
np.ndarray)rW   r  )NT)r   zAxisInt | Noner   r  rW   rO   )rW   r|   )rW   r+   rY   )FTFNT)
r  r  r  r  r  r  r  r  rW   r2   )T)r  r  rW   rO   )F)rM   r  rW   rO   )FT)r  r  r4  r  rW   z"tuple[npt.NDArray[np.intp], Index])..)rq   r/   r?  Literal['left', 'right']r@  r-   rW   znp.intp)rq   znpt.ArrayLike | ExtensionArrayr?  rh  r@  r-   rW   znpt.NDArray[np.intp])leftN)rq   z$NumpyValueArrayLike | ExtensionArrayr?  rh  r@  zNumpySorter | NonerW   znpt.NDArray[np.intp] | np.intp)rH  r,   rW   r   )rF  )rH  r,   rW   znpt.NDArray[np.bool_])1r\   r]   r^   r_   r`   __array_priority__	frozensetr   ra   rb   r   r   r
   r   Tr   r   r   r   r   r   r   r   r   r   r   r   r   r   to_listr  r   r   r  r  r  r  r"  r'  r,  r1  r5  r   rA  rM  rK  rd  r_  rc   rV   r>   r;   r   r     s   
 $-	
%M>  ( ( ( ( 	 	 		AB " "$(  @ !S !SF # #@  !  !D C( C(N '+>>	E#E E 	E 
EN (  (V ;?G"G37G	GT ;?G"G37G	GR#%J GDB & &> F F:  

 
 	
 
 

B & &P 7 74 3 36 3 36 ( (X  $SS S 
,	St  *-!	 ' 	
 
   *-!	#-# '# 	#
 
# # *0%)	x
3x
 'x
 #	x

 
(x
t 3: !
 5 5J(r>   r   )Kr`   
__future__r   typingr   r   r   r   r   r	   r
   r   numpyr~   pandas._libsr   pandas._typingr   r   r   r   r   r   pandas.compatr   pandas.compat.numpyr   r   pandas.errorsr   pandas.util._decoratorsr   pandas.core.dtypes.castr   pandas.core.dtypes.commonr   r   pandas.core.dtypes.dtypesr   pandas.core.dtypes.genericr   r   r   r   pandas.core.dtypes.missingr    r!   pandas.corer"   r#   r$   pandas.core.accessorr%   pandas.core.arrayliker&   pandas.core.arraysr'   pandas.core.constructionr(   r)   collections.abcr*   r+   r,   r-   r.   r/   r&  r0   r1   r2   r4   rf   rt   r   rV   r>   r;   <module>r     s    #	 	 	     . - 2 4 5 
 
 / * -
 
  ,$= ,$^- -DdWX& dNi(H i(r>   