
    Mhb                      % S SK Jr  S SKJr  S SKJr  S SKrS SKJr  S SKrS SK	J
r
JrJrJrJrJrJrJrJr  S SKrS SKrS SKJrJrJr  S SKJrJrJrJ r J!r!  S S	K"J#r#  S SK$J%s  J&r'  S S
K(J)r)J*r*  S SK+J,r,J-r-J.r.J/r/  S SK0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@  S SKAJBrC  S SKDJErEJFrF  S SKGJHrHJIrIJJrJJKrK  S SKLJMrMJNrN  S SKOJPrPJQrQ  S SKRJSrSJTrTJUrUJVrVJWrWJXrXJYrY  S SKZJ[r[J\r\J]r]J^r^J_r_J`r`JaraJbrbJcrcJdrdJereJfrfJgrgJhrhJiriJjrjJkrkJlrlJmrm  S SKnJoro  S SKpJqrqJrrrJsrsJtrtJuruJvrvJwrw  S SKxJyryJzrzJ{r{J|r|J}r}J~r~JrJrJr  S SKJr  S SKJrJrJr  S SKJrJrJr  S SKJr  S SKJs  Jr  S SKJrJr  S SKJrJrJrJrJrJr  S SKJrJr  S SKJrJr  S SKJs  Jr  S SKJrJrJr  S S KJrJr  S S!KJr  S S"KJr  S S#KJr  S S$KJr  S S%KJrJrJr  S S&KJr  S S'KJrJrJrJr  \
(       a  S S(KJrJrJr  S S)KJrJrJrJr  S S*KJrJr  S+/r\" S,5      rS+S-S+S-S+S.S/.rS0\S1'   0 rS0\S2'   \r\GR                  " S35      r0 S4\GR                  _S5\GR                  _S6\GR                  _S7\GR                  _S8\GR                  _S9\GR                  _S:\GR                  _S;\GR                  _S<\GR                  _S=\GR                  _S>\GR                  _S?\GR                  _S@\GR                  _SA\GR                  _SB\GR                  _SC\GR                  _SD\GR                  _\GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  \GR                  SE.	ErSVSF jrSG r " SH S+\\5      rSWSXSI jjrSYSZSJ jjrSK rS[SL jrS\SM jrS]SN jrS^SO jrS_SP jrS`SQ jrSRSSSSST.       SaSU jjrg)b    )annotations)abc)datetimeN)zip_longest)	TYPE_CHECKINGAnyCallableClassVarLiteralNoReturncastfinaloverload)
get_optionusing_copy_on_writeusing_pyarrow_string_dtype)NaTalgosindexlibwriters)BlockValuesRefs)is_datetime_array
no_default)IncompatibleFrequencyOutOfBoundsDatetime	Timestamp
tz_compare)AnyAll	ArrayLikeAxesAxisDropKeepDtypeObjFIgnoreRaise
IndexLabelJoinHowLevel
NaPositionReindexMethodSelfShapenpt)function)DuplicateLabelErrorInvalidIndexError)Appendercache_readonlydeprecate_nonkeyword_argumentsdoc)find_stack_levelrewrite_exception)astype_arrayastype_is_view)LossySetitemErrorcan_hold_elementcommon_dtype_categorical_compatfind_result_typeinfer_dtype_frommaybe_cast_pointwise_resultnp_can_hold_element)ensure_int64ensure_objectensure_platform_intis_any_real_numeric_dtypeis_bool_dtypeis_ea_or_datetimelike_dtypeis_floatis_hashable
is_integeris_iteratoris_list_likeis_numeric_dtypeis_object_dtype	is_scalaris_signed_integer_dtypeis_string_dtypeneeds_i8_conversionpandas_dtypevalidate_all_hashable)concat_compat)
ArrowDtypeCategoricalDtypeDatetimeTZDtypeExtensionDtypeIntervalDtypePeriodDtypeSparseDtype)	ABCCategoricalIndexABCDataFrameABCDatetimeIndexABCIntervalIndexABCMultiIndexABCPeriodIndexABCRangeIndex	ABCSeriesABCTimedeltaIndex)is_dict_like)array_equivalentis_valid_na_for_dtypeisna)	arraylikenanopsops)CachedAccessor)setitem_datetimelike_compatvalidate_putmask)ArrowExtensionArrayBaseMaskedArrayCategoricalDatetimeArrayExtensionArrayTimedeltaArray)StringArrayStringDtype)IndexOpsMixinPandasObject)ensure_wrapped_if_datetimelikeextract_arraysanitize_array)disallow_ndim_indexingis_valid_positional_slice)
FrozenList)clean_reindex_fill_method)get_op_result_name)make_invalid_op)ensure_key_mappedget_group_index_sorternargsort)StringMethods)
PrettyDictdefault_pprintformat_object_summarypprint_thing)HashableIterableSequence)CategoricalIndex	DataFrame
MultiIndexSeries)IntervalArrayPeriodArrayIndex)mixedmixed-integer 
np.ndarray)klassinplacetarget_klassraises_sectionunique
duplicatedzdict[str, str]_index_doc_kwargs_index_shared_docsobject
Complex128	Complex64Float64Float32UInt64UInt32UInt16UInt8Int64Int32Int16Int8booleanzdouble[pyarrow]zfloat64[pyarrow]zfloat32[pyarrow]zfloat[pyarrow])	zuint64[pyarrow]zuint32[pyarrow]zuint16[pyarrow]zuint8[pyarrow]zint64[pyarrow]zint32[pyarrow]zint16[pyarrow]zint8[pyarrow]zbool[pyarrow]c                   ^  [         R                  " T 5      SSSSS.       SU 4S jjj5       n[        [        U5      $ )z?
Decorator to simplify 'return_indexers' checks in Index.join.
leftNFhowlevelreturn_indexerssortc               l   > T	" XX#US9u  pgnU(       d  U$ Ub  [        U5      nUb  [        U5      nXgU4$ )Nr   r   r   )rC   )
selfotherr   r   r   r   
join_indexlidxridxmeths
            J/var/www/html/env/lib/python3.13/site-packages/pandas/core/indexes/base.pyjoin$_maybe_return_indexers.<locals>.join  sL     "&dsd!S
$&t,D&t,D%%    )r   r   r   r(   r   boolr   r   )	functoolswrapsr   r%   )r   r   s   ` r   _maybe_return_indexersr     sb    
 __T
  %&& 	& & & && 4=r   c                "   [        U [        5      (       a  SSKJn  U" U 40 UD6$ [        U [        5      (       a&  SU;   a  SU;  a  UR                  S5      US'   SUS'   OSU;  a  SU;   a  US   R                  US'   U R                  " U 40 UD6$ )	zj
This is called upon unpickling, rather than the default which doesn't
have arguments and breaks __new__.
r   )_new_PeriodIndexlabelscodesFverify_integritydtypedata)
issubclassra   pandas.core.indexes.periodr   r`   popr   __new__)clsdr   s      r   
_new_Indexr   $  s     #~&&?)q))#}%%q=WA-xAgJ !&
		fk vY__'
;;s a  r   c                    ^  \ rS rSr% SrSr\GS!S j5       r\    GS"S j5       r\    GS"S j5       r	\    GS"S j5       r
SrS	\S
'   S\S'   \R                  \4rS\S'   SrS\S'   SrS\S'   SrS\S'   S/rS\S'   S/rS\S'   \GS#S j5       r\R0                  " \R2                  5      \R6                  \R0                  " \R8                  5      \R:                  \R0                  " \R<                  5      \R>                  \R0                  " \R@                  5      \RB                  \R0                  " \RD                  5      \RF                  \R0                  " \RH                  5      \RJ                  \R0                  " \RL                  5      \RN                  \R0                  " \RP                  5      \RR                  \R0                  " \RT                  5      \RV                  \R0                  " \RX                  5      \RZ                  \R0                  " \R\                  5      \R^                  \R0                  " \R`                  5      \Rb                  0r2S\S'   \3  GS$S j5       r4Sr5S	1r6\7" S	\85      r9Sr:     GS%     GS&S  jjr;\<GS'S! j5       r=\\<GS(S" j5       5       r>\< GS)     GS*S# jj5       r?\<S$ 5       r@\GS+S% j5       rA\GS,S& j5       rB\GS-S' j5       rC\D4GS.S( jjrEGS/S) jrF\GS.S* j5       rG\GS#S+ j5       rH\GS,S, j5       rI\GS,S- j5       rJ\  GS0S. j5       rK\\GS1S/ j5       5       rLGS2S0 jrMGS)GS3S1 jjrNGS4S2 jrO\GS5S3 j5       rP\GS6S4 j5       r\GS7GS8S5 jj5       rQGS9S6 jrRGS:GS'S7 jjrSS8\TS9'   \U" \TS9   \V-  5         GS;     GS<S: jj5       rW\GS=S; j5       rXS<\TS='   \U" \TS=   \V-  5      GS9GS>S> jj5       rY  GS5     GS?S? jjrZ\GS/S@ j5       r[\GS9GS/SA jj5       r\\GS@SB j5       r]\3SC 5       r^\GS9GS@SD jj5       r_GSASE jr`\GSBSF j5       ra\GS3SG j5       rb   GSC       GSDSI jjrcSHrd\SSJ.     GSESK jj5       reGSFSL jrfSMSNSSSSO.     GSGSP jjrgGS9GS@SQ jjrhGS/SR jri\GS)GSHSS jj5       rjS\kR                  4     GSIST jjrl\3GSJSU j5       rm\mR                  GSKSV j5       rm\ GSL   GSMSW jj5       ro GS)   GSNSX jjrpGSOSY jrqSSZ.GS,S[ jjrr\3" \r\qS\9rs\tS]S]S^.GSPS_ jj5       ru\tS]SZ.GSQS` jj5       ru\tS]S]S^.GSRSa jj5       ruSSS^.GSRSb jjru\tS]Sc.GSPSd jj5       rv\tGSQSe j5       rv\w" SfSgS/ShSi9GSSGSRSj jj5       rv\3GS2Sk j5       rxGS/Sl jry\GS,Sm j5       rzGS2Sn jr{    GST   GSUSp jjr|GSVSq jr}\}r~\GSWGSXSr jj5       r\GSYSs j5       r\\GS#St j5       5       r\3GS#Su j5       r\3GS#Sv j5       r\\3GS#Sw j5       5       r\\3GS#Sx j5       5       r\GS#Sy j5       r\\3GS#Sz j5       5       r\GS#S{ j5       r\GS#S| j5       r\GS#S} j5       r\GS#S~ j5       r\GS#S j5       r\GS#S j5       r\GS#S j5       r\GS#S j5       r\GS#S j5       r\GS@S j5       r\\GS#S j5       5       r\\GS#S j5       5       rS r\S 5       r\GSZS j5       r\GS#S j5       r\GSZS j5       r\r\GSZS j5       r\rS\kR                  4S jrGS[GS\S jjrGS9GS]U 4S jjjrSoS.GS^U 4S jjjrGS_GS`S jjrS r\GSaS j5       r\rS r\S 5       r\GSbS j5       r\GS9S j5       rGScS jr\GSdS j5       r\GSSGSeS jj5       rGSSGSfS jjrS r\    GSgS j5       r\GS9S j5       rS rS rGS)S jr\GS#S j5       rGShS jrS r\   GSi     GSjS jj5       r   GSi       GSkS jjr\GSlS j5       r\  GS)     GSmS jj5       rGSnS jr\ GS)       GSoS jj5       r\ GS9       GSoS jj5       r\      GSpS j5       r\      GSqS j5       r\      GSrS j5       r\GSsS j5       rGStS jr\\kR                  4     GSuS jj5       r\GSvS j5       r    GSw       GSxS jjrGSyS jrGSzS jr\    GS{S j5       r\tS]S]S]S.           GS|S jj5       r\tS]S]S]S]S.           GS}S jj5       r\tS]S]S]S]S.           GS~S jj5       r\\SSSSS.           GSS jj5       5       r\        GSS j5       r\        GSS j5       r\GSS j5       r\ GS       GSS jj5       r\ GS       GSS jj5       r\ GS     GSS jj5       r          GSS jr\\GS#S j5       5       r\3GSS j5       r\\" \GR                  5      GSS j5       5       r\3GSS j5       rGSS jr\GS3S j5       rGSS jr\" \GR                  5      GSSGSS jj5       r\GS9GSVS jj5       r\\<S 5       5       rS rGS#S jrGSS jrS\S'   \GS,S j5       rS rGSS jr\GS#S j5       rGSS jrGSS jrGSVS jrGSS jr\GS#S j5       r\S 5       r      GSS jr\tS]S]S]S]S.         GSS jj5       r\tS]S]S]S.         GSS jj5       r\tS]S]S]S]S.         GSS jj5       r\w" SfSg/SSi9    GS         GSS jj5       r\S 5       rGSGSS jjrGSS jrS r\GS#S j5       rS\TS'   \U" \TS   \V-  5        GSS j5       r\GSS j5       rGSS jrGSS jr\t GS     GSS jj5       r\t      GSS j5       r\t GS:     GSS jj5       r\ GS:     GSS jj5       r\3GS#S j5       rSr\GSS j5       r\GS6S j5       r\GSS j5       rGSS jr\GSS j5       rGS9GSS jjr\SSZ.GSVS jj5       rGS9GSZS jjrGSGS  jGr    GSi       GSGS jjGrGS GrGSVGS jGr\      GSGS j5       GrGSGS jGrGSGSGS jjGrGSGS jGrGSiGSGS jjGrGS/GS	 jGr	GSGS
 jGr
 GS     GSGS jjGr\GS:GSGS jj5       Gr\GSGSGS jj5       Gr\GSWGSGS jj5       GrGS Gr\GS 5       Gr\GS 5       GrU 4GS jGr\GS 5       GrGSVGS jGrGSVGS jGrGSVGS jGrGSVGS jGrGS GrGS Gr\GSGS j5       Gr\U" \GR6                  R                  5      GSGSU 4GS jjj5       Gr\U" \GR8                  R                  5      GSGSU 4GS jjj5       GrGSGSGS jjGrGSGSGS jjGr\\3GSGS j5       5       GrGS Gr U =Gr!$ (  r   i@  a  
Immutable sequence used for indexing and alignment.

The basic object storing axis labels for all pandas objects.

.. versionchanged:: 2.0.0

   Index can hold all numpy numeric dtypes (except float16). Previously only
   int64/uint64/float64 dtypes were accepted.

Parameters
----------
data : array-like (1-dimensional)
dtype : str, numpy.dtype, or ExtensionDtype, optional
    Data type for the output Index. 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.
name : object
    Name to be stored in the index.
tupleize_cols : bool (default: True)
    When True, attempt to create a MultiIndex if possible.

See Also
--------
RangeIndex : Index implementing a monotonic integer range.
CategoricalIndex : Index of :class:`Categorical` s.
MultiIndex : A multi-level, or hierarchical Index.
IntervalIndex : An Index of :class:`Interval` s.
DatetimeIndex : Index of datetime64 data.
TimedeltaIndex : Index of timedelta64 data.
PeriodIndex : Index of Period data.

Notes
-----
An Index instance can **only** contain hashable objects.
An Index instance *can not* hold numpy float16 dtype.

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

>>> pd.Index(list('abc'))
Index(['a', 'b', 'c'], dtype='object')

>>> pd.Index([1, 2, 3], dtype="uint8")
Index([1, 2, 3], dtype='uint8')
i  c                n    U R                  5       nUR                  5       n[        R                  " X#5      $ N)_get_join_targetlibjoinleft_join_indexer_unique)r   r   svovs       r   _left_indexer_uniqueIndex._left_indexer_unique}  s1     ""$##%//77r   c                    U R                  5       nUR                  5       n[        R                  " X#5      u  pEnU R                  U5      nXuU4$ r   )r   r   left_join_indexer_from_join_targetr   r   r   r   joined_ndarrayr   r   joineds           r   _left_indexerIndex._left_indexer  sP    
 ""$##%%,%>%>r%F"d''7T!!r   c                    U R                  5       nUR                  5       n[        R                  " X#5      u  pEnU R                  U5      nXuU4$ r   )r   r   inner_join_indexerr   r   s           r   _inner_indexerIndex._inner_indexer  P    
 ""$##%%,%?%?%G"d''7T!!r   c                    U R                  5       nUR                  5       n[        R                  " X#5      u  pEnU R                  U5      nXuU4$ r   )r   r   outer_join_indexerr   r   s           r   _outer_indexerIndex._outer_indexer  r   r   r   str_typExtensionArray | np.ndarray_datazDtype[ExtensionArray] | tuple[type[np.ndarray], type[ExtensionArray]]	_data_clsNzobject | None_idr   _nameFr   _no_setting_namename	list[str]_comparables_attributesc                6    [        U R                  5      (       + $ r   )rL   r   r   s    r   _can_hold_stringsIndex._can_hold_strings  s    #DJJ///r   z;dict[np.dtype | ExtensionDtype, type[libindex.IndexEngine]]_engine_typesc                j    U R                   R                  U R                  [        R                  5      $ r   )r   getr   libindexObjectEnginer   s    r   _engine_typeIndex._engine_type  s'     !!%%djj(2G2GHHr   Tc                \   SSK Jn  [        XAU 5      nUb  [        U5      n[	        USS 5      nS nU(       d'  [        U[        [        45      (       a  UR                  n[        U[        [        [        45      n	[        U[        U45      (       a  U" XUS9n
Ub  U
R                  USS9$ U
$ [        U5      (       a  GO[        U5      (       a  GO[        U[        R                  [        [        45      (       aV  [        U[        5      (       a  UR                   nUR"                  R$                  S;  a  [&        R(                  " U[*        S9nGOi[-        U5      (       a  U R/                  U5      e[1        US	5      (       a  U " [        R2                  " U5      X#US
9$ [5        U5      (       d&  [        U[6        5      (       d  U R/                  U5      eU(       aO  [9        U5      (       a  [;        U5      nU(       a-  [=        S U 5       5      (       a  SSKJ n  URB                  " XS9$ [        U[:        [D        45      (       d  [;        U5      n[G        U5      S:X  a  [        RH                  " U[J        S9n[G        U5      (       a1  [        US   [D        5      (       a  [&        R(                  " U[*        S9n [M        US X#S9n[S        U5      nU RU                  UR"                  5      nURW                  XR"                  SS9nURY                  XUS9n
UcE  U	(       a>  U[        RZ                  :X  a*  U
R"                  U:w  a  [\        R^                  " S[`        SS9  U
$ ! [N         aB  nS[Q        U5      ;   a  U R/                  U5      UeS[Q        U5      ;   a  [O        S5      Uee S nAff = f)Nr   )
RangeIndexr   )startcopyr   Fr  iufcbmMr   	__array__r   r  r   c              3  B   #    U  H  n[        U[        5      v   M     g 7fr   )
isinstancetuple).0es     r   	<genexpr> Index.__new__.<locals>.<genexpr>  s     Cd
1e 4 4d   r   namesr   r  z2index must be specified when data is not list-likezData must be 1-dimensional Index data must be 1-dimensional)refszDtype inference on a pandas object (Series, Index, ExtensionArray) is deprecated. The Index constructor will keep the original dtype in the future. Call `infer_objects` on the result to get the old behavior.   
stacklevel)1pandas.core.indexes.ranger  maybe_extract_namerR   getattrr  rc   r   _referencesrs   rangeastyperF   npndarrayr`   _valuesr   kindcomasarray_tuplesafe
_dtype_objrN   _raise_scalar_data_errorhasattrasarrayrK   
memoryviewrJ   listallpandas.core.indexes.multir   from_tuplesr  lenarrayr   r{   
ValueErrorr   ry   _dtype_to_subclass_ensure_array_simple_newobject_warningswarnFutureWarning)r   r   r   r  r   tupleize_colsr  
data_dtyper  is_pandas_objectresultr   arrerrr   s                  r   r   Index.__new__  s    	9!$c2 'ET7D1

4)U);<<##D%dY~,NO dUJ/00dDAF }}U}77 M(//(44rzz5)<==$..||zzi/
 ,,TDt__..t44T;''rzz$'udKKd##JtZ,H,H ..t44 t$$:DCCdCCC E &11 
 dT5M22 Dz4yA~xxF34yyZQ77,,TD	 t5DC -S1&&syy1!!#yyu!=""34"8=-*

2J||z) 
 "  /  	Cs3xO2248cA+s3x7 !CD#M	s   :M 
N+)=N&&N+c                    UR                   S:  a  [        S5      eU[        R                  :X  a  [	        S5      eU(       a  UR                  5       nU$ )z6
Ensure we have a valid array to pass to _simple_new.
   r  z!float16 indexes are not supported)ndimr6  r%  float16NotImplementedErrorr  )r   r   r   r  s       r   r8  Index._ensure_arrayO  sH    
 99q=?@@bjj %&IJJ 99;Dr   c                P   [        U[        5      (       a  UR                  $ UR                  S:X  a  SSKJn  U$ UR                  S:X  a  SSKJn  U$ UR                  S:X  a  [        $ [        UR                  [        5      (       d  [        U5      (       a  [        $ [        U5      e)NMr   )DatetimeIndexm)TimedeltaIndexO)r  rX   index_classr(  pandasrM  rO  r   r   typer   rL   rI  )r   r   rM  rO  s       r   r7  Index._dtype_to_subclassa  s    
 e^,,$$$::,  ZZ3-!!ZZ3L

C((,<U,C,CL!%((r   c                2   [        XR                  5      (       d   [        U5      5       e[        R	                  U 5      nXl        X$l        0 Ul        UR                  5         Ub  X4l	        O[        5       Ul	        UR                  R                  U5        U$ )z
We require that we have a dtype compat for the values. If we are passed
a non-dtype compat, then coerce using the constructor.

Must be careful not to recurse.
)r  r   rS  r   r   r   r   _cache_reset_identityr"  r   add_index_reference)r   valuesr   r  rA  s        r   r9  Index._simple_new  s}     &--00>$v,>0$ !%!0!2F..v6r   c                    U " U0 UD6nUR                   [        :X  a^  UR                  (       dM  [        R                  " UR
                  5      nUR                   R                  S;   a  [        XCR                  S9$ U$ )z_
Constructor that uses the 1.0.x behavior inferring numeric dtypes
for ndarray[object] inputs.
iufbr   )	r   r+  	_is_multir   maybe_convert_objectsr'  r(  r   r   )r   argskwargsrA  rY  s        r   _with_inferIndex._with_infer  sc     d%f%<<:%f.>.> ..v~~>F||  F*V++66r   c                    [        U 5      $ r   )rS  r   s    r   _constructorIndex._constructor  s    Dzr   c                p    U R                   (       d%  SnU R                  5       nUSU 3-  n[        U5      eg)z
Check that an Index has no duplicates.

This is typically only called via
`NDFrame.flags.allows_duplicate_labels.setter` when it's set to
True (duplicates aren't allowed).

Raises
------
DuplicateLabelError
    When the index is not unique.
zIndex has duplicates.
N)	is_unique_format_duplicate_messager0   )r   msg
duplicatess      r   _maybe_check_uniqueIndex._maybe_check_unique  s?     ~~-C779JR
|$$C%c** r   c                   SSK Jn  X R                  SS9   R                  5       n[	        U5      (       d   eU" [
        R                  " [	        U 5      5      SS9R                  U SS9R                  [        5      U   nU R                  (       a)  [        U 5      R                  UR                  5      Ul        U R                  S:X  a  UR                  S	5      nUR!                  S
S9$ )a\  
Construct the DataFrame for a DuplicateLabelError.

This returns a DataFrame indicating the labels and positions
of duplicates in an index. This should only be called when it's
already known that duplicates are present.

Examples
--------
>>> idx = pd.Index(['a', 'b', 'a'])
>>> idx._format_duplicate_message()
    positions
label
a        [0, 2]
r   r   firstkeepFr	  )observedrF  label	positionsr]  )rR  r   r   r   r4  r%  arangegroupbyaggr0  r^  rS  r3  r   nlevelsrename_axisto_frame)r   r   rl  outs       r   rj  Index._format_duplicate_message  s    " 	"//w/78??A
: 299SY'e4WTEW*SYz# 	
 >> T
..syy9CI<<1//'*C|||--r   c                d    U[         L a  U R                  OUnU R                  XU R                  S9$ )a2  
Create a new Index with the same class as the caller, don't copy the
data, use the same object attributes with passed in attributes taking
precedence.

*this is an internal non-public method*

Parameters
----------
values : the values to create the new Index, optional
name : Label, defaults to self.name
r   r  )r   r   r9  r"  )r   rY  r   s      r   _shallow_copyIndex._shallow_copy  s2     "Z/tzzT8H8HIIr   c                    U R                  U R                  U R                  U R                  S9nU R                  Ul        U$ )zB
fastpath to make a shallow copy, i.e. new object with same data.
r  )r9  r'  r   r"  rV  r   rA  s     r   _viewIndex._view  s9     !!$,,TZZdFVFV!Wr   c                2    U R                  5       nXl        U$ )z7
fastpath for rename if new name is already validated.
)r  r   )r   r   rA  s      r   _renameIndex._rename  s    
 r   c                    XL a  g[        US5      (       d  gU R                  b  UR                  c  gU R                  UR                  L $ )a  
More flexible, faster check like ``is`` but that works through views.

Note: this is *not* the same as ``Index.identical()``, which checks
that metadata is also the same.

Parameters
----------
other : object
    Other object to compare against.

Returns
-------
bool
    True if both have same underlying data, False otherwise.

See Also
--------
Index.identical : Works like ``Index.is_`` but also checks metadata.

Examples
--------
>>> idx1 = pd.Index(['1', '2', '3'])
>>> idx1.is_(idx1.view())
True

>>> idx1.is_(idx1.copy())
False
Tr   F)r-  r   r   r   s     r   is_	Index.is_  sE    > =&&XX!288uyy((r   c                "    [        5       U l        g)z:
Initializes or resets ``_id`` attribute with new object.
N)r   r   r   s    r   rW  Index._reset_identity?  s    
 8r   c                8    U R                   R                  5         g r   )_engineclear_mappingr   s    r   _cleanupIndex._cleanupF  s    ""$r   c                L   U R                  5       n[        U R                  [        5      (       a  U R                  R
                  S;   a  SS KnU R                  R                  R                  nUR                  R                  U5      (       a:  U R                  R                  5       n[        R                  " UR                  5      $ UR                  R                  U5      (       a:  U R                  R!                  5       n[        R"                  " UR                  5      $ [        U[$        5      (       ar  [        U[&        [        45      (       a$   [(        UR                  R*                     " U5      $ U R.                  [        R0                  L a  [        R2                  " U5      $ [5        [6        R8                  U5      nUR                  [:        :X  a  [        R<                  " U5      $ UR                  [6        R>                  :X  a  [        R@                  " U5      $ UR                  [6        RB                  :X  a  [        RD                  " U5      $ [G        U R                  5      (       a  U RH                  R                  nU R/                  U5      $ ! [,         a     Nf = f)NMmr   )%_get_engine_targetr  r'  ro   r   r(  pyarrow	_pa_arrayrS  typesis_timestamp_to_datetimearrayr  DatetimeEngine_ndarrayis_duration_to_timedeltaarrayTimedeltaEnginers   rp   _masked_enginesr   KeyErrorr  r  ExtensionEnginer   r%  r&  r   
BoolEngine	complex64Complex64Engine
complex128Complex128EnginerQ   r   )r   target_valuespapa_types       r   r  Index._engineJ  s   
 //1dll$788TZZ__PT=T ll,,11Gxx$$W-- $ > > @..}/E/EFF%%g.. $ ? ? A//0F0FGGm^44-/;N)OPP*=+>+>+C+CD]SS ""h&;&;;//>>RZZ7 $&&&}55  BLL0++M::  BMM1,,];; ,, !JJ//M   //3   s   "J 
J#"J#c                    U R                  SS9S[        S5        Vs1 s H3  n[        U[        5      (       d  M  UR	                  5       (       d  M1  UiM5     sn$ s  snf )z
Add the string-like labels to the owner dataframe/series dir output.

If this is a MultiIndex, it's first level values are used.
r   r   Nzdisplay.max_dir_items)r   r   r  r   isidentifier)r   cs     r   _dir_additions_for_ownerIndex._dir_additions_for_owner{  s[     [[q[)*OJ7N,OP
P!S! &'nn&6 P
 	
 
s   AAAc                ,    [        U R                  5      $ )z!
Return the length of the Index.
)r4  r   r   s    r   __len__Index.__len__  s     4::r   c                @    [         R                  " U R                  US9$ )z(
The array interface, return my values.
r  )r%  r.  r   )r   r   r  s      r   r  Index.__array__  s     zz$**E22r   c                  ^  [        S U 5       5      (       a  [        $ [        R                  " T X/UQ70 UD6nU[        La  U$ SU;   a  [        R                  " T X/UQ70 UD6$ US:X  a&  [        R
                  " T X/UQ70 UD6nU[        La  U$ U Vs/ s H  ofT La  UOUR                  PM     nn[        X5      " U0 UD6nUR                  S:X  a  [        U 4S jU 5       5      $ US:X  a  [        R                  " U5      nU$ UR                  [        R                  :X  a  UR                  [        R                   5      nT R#                  U5      $ s  snf )Nc              3  N   #    U  H  n[        U[        [        45      v   M     g 7fr   )r  rc   r]   )r  r   s     r   r  (Index.__array_ufunc__.<locals>.<genexpr>  s     Pz%)\!:;;s   #%r}  reducer  c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr   )__array_wrap__)r  xr   s     r   r  r    s     @A,,Q//   !)anyNotImplementedri   !maybe_dispatch_ufunc_to_dunder_opdispatch_ufunc_with_outdispatch_reduction_ufuncr'  r!  noutr  r   item_from_zerodimr   r%  rH  r$  float32r  )r   ufuncmethodinputsra  rA  r  
new_inputss   `       r   __array_ufunc__Index.__array_ufunc__  sb   PPPP!!<<%
"(
,2
 'MF?44e&,06  X77e&,06F ^+AGHAD=aaii7
H'>v>::?@@@@x**62FM<<2::%]]2::.F""6** Is   Ec                    [         R                  " U5      n[        U[        5      (       d  [	        UR
                  5      (       d  [        R                  " U5      S:  a  U$ [        XR                  S9$ )z>
Gets called after a ufunc and other functions e.g. np.split.
rF  r]  )	r   r  r  r   rE   r   r%  rG  r   )r   rA  contextreturn_scalars       r   r  Index.__array_wrap__  s]    
 &&v.65))mFLL.I.IbggO
O MV)),,r   c                .    U R                   R                  $ )z
Return the dtype object of the underlying data.

Examples
--------
>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.dtype
dtype('int64')
)r   r   r   s    r   r   Index.dtype  s     zzr   c                    U SS $ )z
Return a view on self.

Returns
-------
Index

See Also
--------
numpy.ndarray.ravel : Return a flattened array.

Examples
--------
>>> s = pd.Series([1, 2, 3], index=['a', 'b', 'c'])
>>> s.index.ravel()
Index(['a', 'b', 'c'], dtype='object')
N )r   orders     r   ravelIndex.ravel  s    & Awr   c                |   Ub  [        US5      (       d  Un[        U[        5      (       a  [        U5      n[	        U5      (       ag  U R                  U5      nU R                  R                  U5      n[        U[        5      (       a$  UR                  X@R                  U R                  S9$ U$ U R                  R                  U5      nOLUb9  [        R                  " S[        U 5      R                    S3["        [%        5       S9  U R'                  5       n[        U[(        5      (       a  U R*                  Ul        U$ )Nr   r  zPassing a type in zr.view is deprecated and will raise in a future version. Call view without any argument to retain the old behavior.r  )r-  r  r   rR   rQ   r7  r5  viewrs   r9  r   r"  r   r;  r<  rS  __name__r=  r6   r  r   r   )r   r   r   idx_clsrB  rA  s         r   r  
Index.view  s    ?73#7#7E#s##$S)"5))11%8jjooe,c>22"..))$2B2B /   
ZZ__S)F(d)<)<(= >Q Q "/1 ZZ\Ffe$$FJr   c                   Ub  [        U5      nU R                  U:X  a  U(       a  U R                  5       $ U $ U R                  n[	        U[
        5      (       aK  [        [        U5      R                  [        U 5      R                  5         UR                  XS9nSSS5        O@[	        U[        5      (       a!  UR                  5       nUR                  XUS9nO
[        X1US9n[        WU R                  UR                  SS9nU(       dT  U R                   bG  [#        U R                  U5      (       a,  U R                   Ul        UR                   R%                  U5        U$ ! , (       d  f       N= f)a\  
Create an Index with values cast to dtypes.

The class of a new Index is determined by dtype. When conversion is
impossible, a TypeError exception is raised.

Parameters
----------
dtype : numpy dtype or pandas type
    Note that any signed integer `dtype` is treated as ``'int64'``,
    and any unsigned integer `dtype` is treated as ``'uint64'``,
    regardless of the size.
copy : bool, default True
    By default, astype always returns a newly allocated object.
    If copy is set to False and internal requirements on dtype are
    satisfied, the original data is used to create a new Index
    or the original Index is returned.

Returns
-------
Index
    Index with values cast to specified dtype.

Examples
--------
>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.astype('float')
Index([1.0, 2.0, 3.0], dtype='float64')
Nr	  r  F)r   r   r  )rR   r   r  r   r  rs   r7   rS  r  r$  rX   construct_array_type_from_sequencer8   r   r   r"  r9   rX  )r   r   r  rY  
new_valuesr   rA  s          r   r$  Index.astype  s1   @  'E::"&499;0D0fn--"4<#8#8$t*:M:MN#]]5]<
 ON ~..,,.C ++DD+IJ &fEJ z		9I9IPUV  ,tzz511!%!1!1F226:- ONs   E!!
E/a  
        Return a new %(klass)s of the values selected by the indices.

        For internal compatibility with numpy arrays.

        Parameters
        ----------
        indices : array-like
            Indices to be taken.
        axis : int, optional
            The axis over which to select values, always 0.
        allow_fill : bool, default True
        fill_value : scalar, default None
            If allow_fill=True and fill_value is not None, indices specified by
            -1 are regarded as NA. If Index doesn't hold NA, raise ValueError.

        Returns
        -------
        Index
            An index formed of elements at the given indices. Will be the same
            type as self, except for RangeIndex.

        See Also
        --------
        numpy.ndarray.take: Return an array formed from the
            elements of a at the given indices.

        Examples
        --------
        >>> idx = pd.Index(['a', 'b', 'c'])
        >>> idx.take([2, 2, 1, 2])
        Index(['c', 'c', 'b', 'c'], dtype='object')
        takec                   U(       a  [         R                  " SU5        [        U5      (       a  [        S5      e[	        U5      nU R                  X4U5      nU R                  n[        U[        R                  5      (       a   [        R                  " XaX0R                  S9nOUR                  XU R                  S9nU R                  R                  XpR                  S9$ )Nr  z!Expected indices to be array-like)
allow_fill
fill_valuer]  )nvvalidate_takerN   	TypeErrorrC   _maybe_disallow_fillr'  r  r%  r&  r   r  	_na_valuere  r9  r   )r   indicesaxisr  r  ra  rY  takens           r   r  
Index.takez  s     R(W?@@%g...zwO
 fbjj))JJJ>>E
 KK4>>   E   ,,U,CCr   c                    U(       a^  Ub[  U R                   (       a&  US:  R                  5       (       a  [        S5      e U$ [        U 5      R                  n[        SU S35      eSnU$ )zU
We only use pandas-style take when allow_fill is True _and_
fill_value is not None.
zJWhen allow_fill=True and fill_value is not None, all indices must be >= -1zUnable to fill values because z cannot contain NAF)_can_hold_nar  r6  rS  r  )r   r  r  r  cls_names        r   r  Index._maybe_disallow_fill  s     *0  bL%%''$4  (   :.. 4XJ>PQ  Jr   a|  
        Repeat elements of a %(klass)s.

        Returns a new %(klass)s where each element of the current %(klass)s
        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
            %(klass)s.
        axis : None
            Must be ``None``. Has no effect but is accepted for compatibility
            with numpy.

        Returns
        -------
        %(klass)s
            Newly created %(klass)s with repeated elements.

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

        Examples
        --------
        >>> idx = pd.Index(['a', 'b', 'c'])
        >>> idx
        Index(['a', 'b', 'c'], dtype='object')
        >>> idx.repeat(2)
        Index(['a', 'a', 'b', 'b', 'c', 'c'], dtype='object')
        >>> idx.repeat([1, 2, 3])
        Index(['a', 'b', 'b', 'c', 'c', 'c'], dtype='object')
        repeatc                    [        U5      n[        R                  " SSU05        U R                  R	                  U5      nU R
                  R                  X0R                  S9$ )Nr  r  r]  )rC   r  validate_repeatr'  r  re  r9  r   )r   repeatsr  
res_valuess       r   r  Index.repeat  sT    %g.
2~.\\((1
   ,,Zii,HHr   c                    U R                  XS9S   nU(       a4  U R                  R                  5       n[        U 5      R	                  X1S9nU$ U R                  US9nU$ )a  
Make a copy of this object.

Name is set on the new object.

Parameters
----------
name : Label, optional
    Set name for new object.
deep : bool, default False

Returns
-------
Index
    Index refer to new object which is a copy of this object.

Notes
-----
In most cases, there should be no functional difference from using
``deep``, but if ``deep`` is passed it will attempt to deepcopy.

Examples
--------
>>> idx = pd.Index(['a', 'b', 'c'])
>>> new_idx = idx.copy()
>>> idx is new_idx
False
)r   deepr   r]  )_validate_namesr   r  rS  r9  r  )r   r   r  new_data	new_indexs        r   r  
Index.copy  sg    D ###9!<zz(HT
..x.CI  $/Ir   c                &    U R                   " S0 UD6$ )Nr  r	  )r   ra  s     r   __copy__Index.__copy__  s    yy"6""r   c                     U R                  SS9$ )zI
Parameters
----------
memo, default None
    Standard signature. Unused
Tr  r	  )r   memos     r   __deepcopy__Index.__deepcopy__  s     yydy##r   c                    [        U 5      R                  nU R                  5       nU R                  5       nU VVs/ s H  u  pEU SU 3PM     nnnSR	                  U5      nU SU U S3$ s  snnf )z1
Return a string representation for this object.
=, ())rS  r  _format_data_format_attrsr   )r   
klass_namer   attrskv	attrs_strpreprs           r   __repr__Index.__repr__  sy    
 $Z((
  """$,12EDAs!A3ZE	2		)$QtfUG1-- 3s   A,c                    [         $ )z 
Return the formatter function.
)r   r   s    r   _formatter_funcIndex._formatter_func*  s
    
 r   c                >   SnU R                   S:X  a  SnOh[        U R                  [        5      (       a3  [	        SU 5      n [        U R                  R                  5      (       a  SnO[        U [        5      (       a  g[        U U R                  UUU R                  S9$ )z0
Return the formatted data as a unicode string.
TstringFr   r   )
is_justifyr   line_break_each_value)inferred_typer  r   rV   r   rM   
categoriesrb   r   r  r^  )r   r   r  s      r   r  Index._format_data1  s     
)J

$455*D1Dt4455"
m,,$  !"&..
 	
r   c                   / nU R                   (       d!  UR                  SSU R                   S345        U R                  b'  UR                  S[	        U R                  5      45        OXU R                   (       aG  [        S U R                   5       5      (       a&  UR                  S[	        U R                  5      45        [        S5      =(       d    [        U 5      n[        U 5      U:  a  UR                  S[        U 5      45        U$ )z8
Return a list of tuples of the (attr,formatted_value).
r   'r   c              3  (   #    U  H  oS Lv   M
     g 7fr   r  r  r  s     r   r  &Index._format_attrs.<locals>.<genexpr>V  s     #F:aTM:s   r  zdisplay.max_seq_itemslength)	r^  appendr   r   r   r  r  r   r4  )r   r  max_seq_itemss      r   r  Index._format_attrsK  s     @B~~LL'Qtzzl!#45699 LL&.";<=^^#F4::#F F FLL'>$**#=>?"#:;Hs4yt9}$LL(CI./r   c                    U R                   (       a/  [        U R                  5       VVs/ s H  u  pUc  UOUPM     snn$ U R                  c  S$ U R                  $ s  snnf )zH
Return a name or list of names with None replaced by the level number.
r   )r^  	enumerater  r   )r   r   r   s      r   _get_level_namesIndex._get_level_names^  s[    
 >>CLTZZCXCXKE4/CX  		)18tyy8	s   Ac                   [        U R                  [        R                  5      (       a>  U R                  R                  S:w  a$  [	        [        R
                  U R                  5      $ U R                  [        SS9R                  $ )NrL  Fr	  )
r  r   r%  r(  r   r&  rY  r$  r   r'  r   s    r   	_mpl_reprIndex._mpl_reprj  sV     djj"((++

30F

DKK00{{6{.666r   NaNc                F   [         R                  " [        U 5      R                   S3[        [        5       S9  / nU(       a2  UR                  U R                  b  [        U R                  SS9OS5        Ub  U[        U R                  U5      5      -   $ U R                  XCS9$ ).
Render a string representation of the Index.
z.format is deprecated and will be removed in a future version. Convert using index.astype(str) or index.map(formatter) instead.r  	rh  escape_charsr   headerna_rep)r;  r<  rS  r  r=  r6   r)  r   r   r0  map_format_with_header)r   r   	formatterr=  r<  s        r   formatIndex.formatq  s     	Dz""# $, , ')	
 MM99( TYY5GH  D)!4555''v'EEr   )r@  c                   / nU(       a2  UR                  U R                  b  [        U R                  SS9OS5        Ub  U[        U R	                  U5      5      -   $ U R                  X0R                  S9$ )r5  r6  r9  r   r;  )r)  r   r   r0  r>  r?  _default_na_rep)r   include_namer@  r<  s       r   _format_flatIndex._format_flat  sq     MM99( TYY5GH  D)!4555''v>R>R'SSr   c                  SSK Jn  U R                  n[        UR                  5      (       d?  [        UR                  5      (       d%  [        U R                  [        [        45      (       a  SnOSnU" US US9n[        U5      nX-   $ )Nr   )format_arrayr1  r   )justify)
pandas.io.formats.formatrI  r'  rM   r   rP   r  rY   rV   
trim_front)r   r<  r=  rI  rY  rJ  	formattedrA  s           r   r?  Index._format_with_header  ss    9 FLL))v||,,$**}6F&GHH GG !w?	I&r   r   .r=  decimalfloat_formatdate_formatquotingc          	     2    [        U R                  UUUUUS9$ )NrP  )get_values_for_csvr'  )r   r=  rQ  rR  rS  rT  s         r   _get_values_for_csvIndex._get_values_for_csv  s'     "LL%#
 	
r   c                h   [        U 5      S:  a  U S   n[        US5      (       a&  [        U[        5      (       d  UR	                  5       nO;[        U R                  5      (       a!  U R                  U5      R                  SS5      nU S   n[        US5      (       a&  [        U[        5      (       d  UR	                  5       nO;[        U R                  5      (       a!  U R                  U5      R                  SS5      nSU SU 3nOSnUc  [        U 5      R                  nU S[        U 5       S	U 3$ )
z
Return a summarized representation.

Parameters
----------
name : str
    name to use in the summary representation

Returns
-------
String with a summarized representation of the index
r   rA  r$  r   r  r  z to z: z entries)r4  r-  r  r   rA  rQ   r   r  replacerS  r  )r   r   headtailindex_summarys        r   _summaryIndex._summary  s    t9q=7DtX&&z$/D/D{{}$TZZ00++D199#rB8DtX&&z$/D/D{{}$TZZ00++D199#rB d4&1MM<:&&Dr#d)H]O<<r   c                    U $ )z
Identity method.

This is implemented for compatibility with subclass implementations
when chaining.

Returns
-------
pd.Index
    Caller.

See Also
--------
MultiIndex.to_flat_index : Subclass implementation.
r  r   s    r   to_flat_indexIndex.to_flat_index  s	      r   c                    SSK Jn  Uc  U R                  5       nUc  U R                  nU" U R                  R                  5       XS9$ )aJ  
Create a Series with both index and values equal to the index keys.

Useful with map for returning an indexer based on an index.

Parameters
----------
index : Index, optional
    Index of resulting Series. If None, defaults to original index.
name : str, optional
    Name of resulting Series. If None, defaults to name of original
    index.

Returns
-------
Series
    The dtype will be based on the type of the Index values.

See Also
--------
Index.to_frame : Convert an Index to a DataFrame.
Series.to_frame : Convert Series to DataFrame.

Examples
--------
>>> idx = pd.Index(['Ant', 'Bear', 'Cow'], name='animal')

By default, the original index and original name is reused.

>>> idx.to_series()
animal
Ant      Ant
Bear    Bear
Cow      Cow
Name: animal, dtype: object

To enforce a new index, specify new labels to ``index``:

>>> idx.to_series(index=[0, 1, 2])
0     Ant
1    Bear
2     Cow
Name: animal, dtype: object

To override the name of the resulting column, specify ``name``:

>>> idx.to_series(name='zoo')
animal
Ant      Ant
Bear    Bear
Cow      Cow
Name: zoo, dtype: object
r   rp  )r   r   )rR  r   r  r   r'  r  )r   r   r   r   s       r   	to_seriesIndex.to_series  s@    n 	"=JJLE<99Ddll'')BBr   c                    SSK Jn  U[        R                  L a  U R	                  5       nU" X 0[        5       (       + S9nU(       a  Xl        U$ )a  
Create a DataFrame with a column containing the Index.

Parameters
----------
index : bool, default True
    Set the index of the returned DataFrame as the original Index.

name : object, defaults to index.name
    The passed name should substitute for the index name (if it has
    one).

Returns
-------
DataFrame
    DataFrame containing the original Index data.

See Also
--------
Index.to_series : Convert an Index to a Series.
Series.to_frame : Convert Series to DataFrame.

Examples
--------
>>> idx = pd.Index(['Ant', 'Bear', 'Cow'], name='animal')
>>> idx.to_frame()
       animal
animal
Ant       Ant
Bear     Bear
Cow       Cow

By default, the original Index is reused. To enforce a new Index:

>>> idx.to_frame(index=False)
    animal
0   Ant
1  Bear
2   Cow

To override the name of the resulting column, specify `name`:

>>> idx.to_frame(index=False, name='zoo')
    zoo
0   Ant
1  Bear
2   Cow
r   )r   r	  )rR  r   r   r   r.  r   r   )r   r   r   r   rA  s        r   r|  Index.to_frameG  sD    f 	%3>>!((*DD<2E2G.GHLr   c                    U R                   $ )z
Return Index or MultiIndex name.

Examples
--------
>>> idx = pd.Index([1, 2, 3], name='x')
>>> idx
Index([1, 2, 3], dtype='int64',  name='x')
>>> idx.name
'x'
)r   r   s    r   r   
Index.name  s     zzr   c                t    U R                   (       a  [        S5      e[        US [        U 5      5        Xl        g )NzOCannot set name on a level of a MultiIndex. Use 'MultiIndex.set_names' instead.)r   RuntimeErrorr   rS  r   )r   values     r   r   ri    s4      2  	5$T
3
r   c                   SSK Jn  Ub  Ub  [        S5      eUc)  Uc&  U(       a  U" U R                  5      OU R                  nO7Ub  [	        U5      (       d  [        S5      eUnO[	        U5      (       d  U/nOUn[        U5      [        U R                  5      :w  a-  [        S[        U R                  5       S[        U5       35      e[        US[        U 5      R                   S306  U$ )	zy
Handles the quirks of having a singular 'name' parameter for general
Index and plural 'names' parameter for MultiIndex.
r   )deepcopyz*Can only provide one of `names` and `name`Must pass list-like as `names`.zLength of new names must be z, got 
error_name.name)
r  rn  r  r  rK   r4  r6  rS   rS  r  )r   r   r  r  rn  	new_namess         r   r  Index._validate_names  s     	"!1HII=T\04,$**I&& ABBId##IIy>S_,.s4::.?vc)nEUV 
 	yST
8K8K7LE5RSr   c                F   SSK Jn  Ub  [        U[        [        45      (       a  U/n[        U[
        5      (       d  Ub  [        S5      eU(       dO  [        X5      (       a"  [        R                  " U R                  5      nU$ U R                  c  U/OU R                  /nU$ )z
Get names of index.

Parameters
----------
names : int, str or 1-dimensional list, default None
    Index names to set.
default : str
    Default name of index.

Raises
------
TypeError
    if names not str or list-like
r   r  z-Index names must be str or 1-dimensional list)r2  r   r  intr   r0  r6  r)  fill_missing_namesr  r   )r   r  defaultr   s       r   _get_default_index_namesIndex._get_default_index_names  s    $ 	9%#s,,%&&5+<LMM$++..tzz:  &*YY%6	TYYKr   c                .    [        U R                  45      $ r   )r~   r   r   s    r   
_get_namesIndex._get_names  s    499,''r   r  c                   [        U5      (       d  [        S5      e[        U5      S:w  a  [        S[        U5       35      e[        US[	        U 5      R
                   S306  US   U l        g)ay  
Set new names on index. Each name has to be a hashable type.

Parameters
----------
values : str or sequence
    name(s) to set
level : int, level name, or sequence of int/level names (default None)
    If the index is a MultiIndex (hierarchical), level(s) to set (None
    for all levels).  Otherwise level must be None

Raises
------
TypeError if each name is not hashable.
zNames must be a list-likerF  z#Length of new names must be 1, got rp  rq  r   N)rK   r6  r4  rS   rS  r  r   r   rY  r   s      r   
_set_namesIndex._set_names  sj      F##899v;!B3v;-PQQ 	vPT$Z5H5H4I2OPAY
r   )fsetfget.)r   r   c                   g r   r  r   r  r   r   s       r   	set_namesIndex.set_names      r   c                   g r   r  r  s       r   r  r  	  r  r   c                   g r   r  r  s       r   r  r    r  r   c               \   Ub   [        U [        5      (       d  [        S5      eUb+  [        U5      (       d  [        U5      (       a  [	        S5      e[        U5      (       d  Uc  U R
                  S:  a  [	        S5      e[        U5      (       a   [        U [        5      (       d  [	        S5      e[        U5      (       a  Ub  [	        S5      e[        U [        5      (       ao  [        U5      (       a_  Uc\  / / pB[        U R                  5       H>  u  pVXaR                  5       ;   d  M  UR                  U5        UR                  X   5        M@     Un[        U5      (       d  U/nUb  [        U5      (       d  U/nU(       a  U nOU R                  5       nUR                  XS9  U(       d  U$ g)	ac  
Set Index or MultiIndex name.

Able to set new names partially and by level.

Parameters
----------

names : label or list of label or dict-like for MultiIndex
    Name(s) to set.

    .. versionchanged:: 1.3.0

level : int, label or list of int or label, optional
    If the index is a MultiIndex and names is not dict-like, level(s) to set
    (None for all levels). Otherwise level must be None.

    .. versionchanged:: 1.3.0

inplace : bool, default False
    Modifies the object directly, instead of creating a new Index or
    MultiIndex.

Returns
-------
Index or None
    The same type as the caller or None if ``inplace=True``.

See Also
--------
Index.rename : Able to set new names without level.

Examples
--------
>>> idx = pd.Index([1, 2, 3, 4])
>>> idx
Index([1, 2, 3, 4], dtype='int64')
>>> idx.set_names('quarter')
Index([1, 2, 3, 4], dtype='int64', name='quarter')

>>> idx = pd.MultiIndex.from_product([['python', 'cobra'],
...                                   [2018, 2019]])
>>> idx
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           )
>>> idx = idx.set_names(['kind', 'year'])
>>> idx.set_names('species', level=0)
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           names=['species', 'year'])

When renaming levels with a dict, levels can not be passed.

>>> idx.set_names({'kind': 'snake'})
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           names=['snake', 'year'])
Nz%Level must be None for non-MultiIndexz7Names must be a string when a single level is provided.rF  ro  z2Can only pass dict-like as `names` for MultiIndex.z(Can not pass level for dictlike `names`.r  )r  r`   r6  rK   r  rz  re   r-  r  keysr)  r  r  )r   r  r   r   names_adjustedir   idxs           r   r  r    sh   D Zm%D%DDEE\%%8%8\%=P=PUVVE""u}9I=>>z$'F'FPQQ5#4FGGdM**|E/B/Bu}$&>$TZZ0::<'LLO"))%+6 1 #EE""GE\%%8%8GEC**,Cu*Jr   r   c                   g r   r  r   r   r   s      r   renameIndex.renamez  r  r   c                   g r   r  r  s      r   r  r  ~  r  r   z3.0r   r  )versionallowed_argsr   c                $    U R                  U/US9$ )a)  
Alter Index or MultiIndex name.

Able to set new names without level. Defaults to returning new index.
Length of names must match number of levels in MultiIndex.

Parameters
----------
name : label or list of labels
    Name(s) to set.
inplace : bool, default False
    Modifies the object directly, instead of creating a new Index or
    MultiIndex.

Returns
-------
Index or None
    The same type as the caller or None if ``inplace=True``.

See Also
--------
Index.set_names : Able to set new names partially and by level.

Examples
--------
>>> idx = pd.Index(['A', 'C', 'A', 'B'], name='score')
>>> idx.rename('grade')
Index(['A', 'C', 'A', 'B'], dtype='object', name='grade')

>>> idx = pd.MultiIndex.from_product([['python', 'cobra'],
...                                   [2018, 2019]],
...                                   names=['kind', 'year'])
>>> idx
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           names=['kind', 'year'])
>>> idx.rename(['species', 'year'])
MultiIndex([('python', 2018),
            ('python', 2019),
            ( 'cobra', 2018),
            ( 'cobra', 2019)],
           names=['species', 'year'])
>>> idx.rename('species')
Traceback (most recent call last):
TypeError: Must pass list-like as `names`.
r  )r  r  s      r   r  r    s    h ~~tfg~66r   c                    g)z
Number of levels.
rF  r  r   s    r   rz  Index.nlevels  s    
 r   c                    U $ )z
Compat with MultiIndex.
r  r   s    r   _sort_levels_monotonicIndex._sort_levels_monotonic  s	     r   c                    [        U[        5      (       a3  US:  a  US:w  a  [        SU S35      eUS:  a  [        SUS-    35      eg
XR                  :w  a  [	        SU SU R                   S	35      eg
)z
Validate index level.

For single-level Index getting level number is a no-op, but some
verification must be done like in MultiIndex.

r   r  z)Too many levels: Index has only 1 level, z is not a valid level numberz-Too many levels: Index has only 1 level, not rF  zRequested level (z) does not match index name (r  N)r  ru  
IndexErrorr   r  r   r   s     r   _validate_index_levelIndex._validate_index_level  s     eS!!qyUb[ ?g9;  qy CEAI;O   ii#E7*G		{RST   r   c                &    U R                  U5        g)Nr   r  r  s     r   _get_level_numberIndex._get_level_number  s    ""5)r   rq  c                   [        U[        [        45      (       d  [        S5      e[        U[        5      (       a  [	        U5      S:w  a  [        S5      eUS   n[        U[        5      (       d  [        S5      eU R                  SX$S9$ )a  
For internal compatibility with the Index API.

Sort the Index. This is for compat with MultiIndex

Parameters
----------
ascending : bool, default True
    False to sort in descending order
na_position : {'first' or 'last'}, default 'first'
    Argument 'first' puts NaNs at the beginning, 'last' puts NaNs at
    the end.

    .. versionadded:: 2.1.0

level, sort_remaining are compat parameters

Returns
-------
Index
zIascending must be a single bool value ora list of bool values of length 1rF  z3ascending must be a list of bool values of length 1r   zascending must be a bool valueT)return_indexer	ascendingna_position)r  r0  r   r  r4  sort_values)r   r   r  sort_remainingr  s        r   	sortlevelIndex.sortlevel  s    8 )dD\224 
 i&&9~" UVV!!I)T**<==9   
 	
r   c                (    U R                  U5        U $ )a  
Return an Index of values for requested level.

This is primarily useful to get an individual level of values from a
MultiIndex, but is provided on Index as well for compatibility.

Parameters
----------
level : int or str
    It is either the integer position or the name of the level.

Returns
-------
Index
    Calling object, as there is only one level in the Index.

See Also
--------
MultiIndex.get_level_values : Get values for a level of a MultiIndex.

Notes
-----
For Index, level should be 0, since there are no multiple levels.

Examples
--------
>>> idx = pd.Index(list('abc'))
>>> idx
Index(['a', 'b', 'c'], dtype='object')

Get level values by supplying `level` as integer:

>>> idx.get_level_values(0)
Index(['a', 'b', 'c'], dtype='object')
r  r  s     r   _get_level_valuesIndex._get_level_values  s    H 	""5)r   c                   ^  [        U[        [        45      (       d  U/n[        U 4S jU 5       5      SSS2   nT R	                  U5      $ )a  
Return index with requested level(s) removed.

If resulting index has only 1 level left, the result will be
of Index type, not MultiIndex. The original index is not modified inplace.

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

Returns
-------
Index or MultiIndex

Examples
--------
>>> mi = pd.MultiIndex.from_arrays(
... [[1, 2], [3, 4], [5, 6]], names=['x', 'y', 'z'])
>>> mi
MultiIndex([(1, 3, 5),
            (2, 4, 6)],
           names=['x', 'y', 'z'])

>>> mi.droplevel()
MultiIndex([(3, 5),
            (4, 6)],
           names=['y', 'z'])

>>> mi.droplevel(2)
MultiIndex([(1, 3),
            (2, 4)],
           names=['x', 'y'])

>>> mi.droplevel('z')
MultiIndex([(1, 3),
            (2, 4)],
           names=['x', 'y'])

>>> mi.droplevel(['x', 'y'])
Index([5, 6], dtype='int64', name='z')
c              3  F   >#    U  H  nTR                  U5      v   M     g 7fr   )r  )r  levr   s     r   r  "Index.droplevel.<locals>.<genexpr>k  s     F//44r  Nr  )r  r  r0  sorted_drop_level_numbers)r   r   levnumss   `  r   	droplevelIndex.droplevel;  sH    Z %%//GEFFFttL''00r   c                   U(       d  [        U [        5      (       d  U $ [        U5      U R                  :  a%  [	        S[        U5       SU R                   S35      e[        SU 5      n [        U R                  5      n[        U R                  5      n[        U R                  5      nU H6  nUR                  U5        UR                  U5        UR                  U5        M8     [        U5      S:X  a  US   n[        U5      S:X  a[  [        US   5      S:X  a  USS nU$ [        R                  " UR                  US   SS	9nUR                  R                  XS   S
9n U$ US   S:H  n	US   R                  US   5      nU	R!                  5       (       a   UR#                  U	[$        R&                  5      nUS   Ul        U$ SSKJn
  U
" UUUSS9$ )z5
Drop MultiIndex levels by level _number_, not name.
zCannot remove z levels from an index with z) levels: at least one level must be left.r   rF  r   NT)r  r]  r  r  Flevelsr   r  r   )r  r`   r4  rz  r6  r   r0  r  r   r  r   r   r  r'  re  r9  r  putmaskr%  nanr   r2  r   )r   r  
new_levels	new_codesrr  r  r  rA  r  maskr   s              r   r  Index._drop_level_numberso  s    z$>>Kw<4<<' W.I<<. IK 
 L$'$++&
$	$	ANN1MM!MM! 
 z?aQ-C3x1}y|$) !!WF M "'CKK1RV!WJ --99*UV<9XF M !|r)#A++IaL988::#^^D"&&9F(|M<!!&	 r   c                    [        U R                  [        5      (       a  U R                  R                  $ U R                  R                  S;   a  gg)NiubFT)r  r   rX   r  r(  r   s    r   r  Index._can_hold_na  s;     djj.11::***::??e#r   c                .    U R                   R                  $ )ab  
Return a boolean if the values are equal or increasing.

Returns
-------
bool

See Also
--------
Index.is_monotonic_decreasing : Check if the values are equal or decreasing.

Examples
--------
>>> pd.Index([1, 2, 3]).is_monotonic_increasing
True
>>> pd.Index([1, 2, 2]).is_monotonic_increasing
True
>>> pd.Index([1, 3, 2]).is_monotonic_increasing
False
)r  is_monotonic_increasingr   s    r   r  Index.is_monotonic_increasing      , ||333r   c                .    U R                   R                  $ )ab  
Return a boolean if the values are equal or decreasing.

Returns
-------
bool

See Also
--------
Index.is_monotonic_increasing : Check if the values are equal or increasing.

Examples
--------
>>> pd.Index([3, 2, 1]).is_monotonic_decreasing
True
>>> pd.Index([3, 2, 2]).is_monotonic_decreasing
True
>>> pd.Index([3, 1, 2]).is_monotonic_decreasing
False
)r  is_monotonic_decreasingr   s    r   r  Index.is_monotonic_decreasing  r  r   c                @    U R                   =(       a    U R                  $ )a  
Return if the index is strictly monotonic increasing
(only increasing) values.

Examples
--------
>>> Index([1, 2, 3])._is_strictly_monotonic_increasing
True
>>> Index([1, 2, 2])._is_strictly_monotonic_increasing
False
>>> Index([1, 3, 2])._is_strictly_monotonic_increasing
False
)ri  r  r   s    r   !_is_strictly_monotonic_increasing'Index._is_strictly_monotonic_increasing        ~~>$">">>r   c                @    U R                   =(       a    U R                  $ )a  
Return if the index is strictly monotonic decreasing
(only decreasing) values.

Examples
--------
>>> Index([3, 2, 1])._is_strictly_monotonic_decreasing
True
>>> Index([3, 2, 2])._is_strictly_monotonic_decreasing
False
>>> Index([3, 1, 2])._is_strictly_monotonic_decreasing
False
)ri  r  r   s    r   !_is_strictly_monotonic_decreasing'Index._is_strictly_monotonic_decreasing  r  r   c                .    U R                   R                  $ )a  
Return if the index has unique values.

Returns
-------
bool

See Also
--------
Index.has_duplicates : Inverse method that checks if it has duplicate values.

Examples
--------
>>> idx = pd.Index([1, 5, 7, 7])
>>> idx.is_unique
False

>>> idx = pd.Index([1, 5, 7])
>>> idx.is_unique
True

>>> idx = pd.Index(["Watermelon", "Orange", "Apple",
...                 "Watermelon"]).astype("category")
>>> idx.is_unique
False

>>> idx = pd.Index(["Orange", "Apple",
...                 "Watermelon"]).astype("category")
>>> idx.is_unique
True
)r  ri  r   s    r   ri  Index.is_unique		  s    B ||%%%r   c                $    U R                   (       + $ )a[  
Check if the Index has duplicate values.

Returns
-------
bool
    Whether or not the Index has duplicate values.

See Also
--------
Index.is_unique : Inverse method that checks if it has unique values.

Examples
--------
>>> idx = pd.Index([1, 5, 7, 7])
>>> idx.has_duplicates
True

>>> idx = pd.Index([1, 5, 7])
>>> idx.has_duplicates
False

>>> idx = pd.Index(["Watermelon", "Orange", "Apple",
...                 "Watermelon"]).astype("category")
>>> idx.has_duplicates
True

>>> idx = pd.Index(["Orange", "Apple",
...                 "Watermelon"]).astype("category")
>>> idx.has_duplicates
False
ri  r   s    r   has_duplicatesIndex.has_duplicates,	  s    F >>!!r   c                    [         R                  " [        U 5      R                   S3[        [        5       S9  U R                  S;   $ )a  
Check if the Index only consists of booleans.

.. deprecated:: 2.0.0
    Use `pandas.api.types.is_bool_dtype` instead.

Returns
-------
bool
    Whether or not the Index only consists of booleans.

See Also
--------
is_integer : Check if the Index only consists of integers (deprecated).
is_floating : Check if the Index is a floating type (deprecated).
is_numeric : Check if the Index only consists of numeric data (deprecated).
is_object : Check if the Index is of the object dtype (deprecated).
is_categorical : Check if the Index holds categorical data.
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
>>> idx = pd.Index([True, False, True])
>>> idx.is_boolean()  # doctest: +SKIP
True

>>> idx = pd.Index(["True", "False", "True"])
>>> idx.is_boolean()  # doctest: +SKIP
False

>>> idx = pd.Index([True, False, "True"])
>>> idx.is_boolean()  # doctest: +SKIP
False
zE.is_boolean is deprecated. Use pandas.api.types.is_bool_type instead.r  )r   r;  r<  rS  r  r=  r6   r   r   s    r   
is_booleanIndex.is_booleanQ	  sG    H 	Dz""# $9 9')		
 !![00r   c                    [         R                  " [        U 5      R                   S3[        [        5       S9  U R                  S;   $ )a  
Check if the Index only consists of integers.

.. deprecated:: 2.0.0
    Use `pandas.api.types.is_integer_dtype` instead.

Returns
-------
bool
    Whether or not the Index only consists of integers.

See Also
--------
is_boolean : Check if the Index only consists of booleans (deprecated).
is_floating : Check if the Index is a floating type (deprecated).
is_numeric : Check if the Index only consists of numeric data (deprecated).
is_object : Check if the Index is of the object dtype. (deprecated).
is_categorical : Check if the Index holds categorical data (deprecated).
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
>>> idx = pd.Index([1, 2, 3, 4])
>>> idx.is_integer()  # doctest: +SKIP
True

>>> idx = pd.Index([1.0, 2.0, 3.0, 4.0])
>>> idx.is_integer()  # doctest: +SKIP
False

>>> idx = pd.Index(["Apple", "Mango", "Watermelon"])
>>> idx.is_integer()  # doctest: +SKIP
False
zI.is_integer is deprecated. Use pandas.api.types.is_integer_dtype instead.r  )integerr  r   s    r   rI   Index.is_integer}	  sG    H 	Dz""# $= =')		
 !![00r   c                    [         R                  " [        U 5      R                   S3[        [        5       S9  U R                  S;   $ )a  
Check if the Index is a floating type.

.. deprecated:: 2.0.0
    Use `pandas.api.types.is_float_dtype` instead

The Index may consist of only floats, NaNs, or a mix of floats,
integers, or NaNs.

Returns
-------
bool
    Whether or not the Index only consists of only consists of floats, NaNs, or
    a mix of floats, integers, or NaNs.

See Also
--------
is_boolean : Check if the Index only consists of booleans (deprecated).
is_integer : Check if the Index only consists of integers (deprecated).
is_numeric : Check if the Index only consists of numeric data (deprecated).
is_object : Check if the Index is of the object dtype. (deprecated).
is_categorical : Check if the Index holds categorical data (deprecated).
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
>>> idx = pd.Index([1.0, 2.0, 3.0, 4.0])
>>> idx.is_floating()  # doctest: +SKIP
True

>>> idx = pd.Index([1.0, 2.0, np.nan, 4.0])
>>> idx.is_floating()  # doctest: +SKIP
True

>>> idx = pd.Index([1, 2, 3, 4, np.nan])
>>> idx.is_floating()  # doctest: +SKIP
True

>>> idx = pd.Index([1, 2, 3, 4])
>>> idx.is_floating()  # doctest: +SKIP
False
zH.is_floating is deprecated. Use pandas.api.types.is_float_dtype instead.r  )floatingzmixed-integer-floatz
integer-nar  r   s    r   is_floatingIndex.is_floating	  sH    X 	Dz""# $; ;')		
 !!%VVVr   c                    [         R                  " [        U 5      R                   S3[        [        5       S9  U R                  S;   $ )aJ  
Check if the Index only consists of numeric data.

.. deprecated:: 2.0.0
    Use `pandas.api.types.is_numeric_dtype` instead.

Returns
-------
bool
    Whether or not the Index only consists of numeric data.

See Also
--------
is_boolean : Check if the Index only consists of booleans (deprecated).
is_integer : Check if the Index only consists of integers (deprecated).
is_floating : Check if the Index is a floating type (deprecated).
is_object : Check if the Index is of the object dtype. (deprecated).
is_categorical : Check if the Index holds categorical data (deprecated).
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
>>> idx = pd.Index([1.0, 2.0, 3.0, 4.0])
>>> idx.is_numeric()  # doctest: +SKIP
True

>>> idx = pd.Index([1, 2, 3, 4.0])
>>> idx.is_numeric()  # doctest: +SKIP
True

>>> idx = pd.Index([1, 2, 3, 4])
>>> idx.is_numeric()  # doctest: +SKIP
True

>>> idx = pd.Index([1, 2, 3, 4.0, np.nan])
>>> idx.is_numeric()  # doctest: +SKIP
True

>>> idx = pd.Index([1, 2, 3, 4.0, np.nan, "Apple"])
>>> idx.is_numeric()  # doctest: +SKIP
False
zQ.is_numeric is deprecated. Use pandas.api.types.is_any_real_numeric_dtype insteadr  )r  r  r  r   s    r   
is_numericIndex.is_numeric	  sJ    X 	Dz""# $E E')		
 !!%<<<r   c                    [         R                  " [        U 5      R                   S3[        [        5       S9  [        U R                  5      $ )a:  
Check if the Index is of the object dtype.

.. deprecated:: 2.0.0
   Use `pandas.api.types.is_object_dtype` instead.

Returns
-------
bool
    Whether or not the Index is of the object dtype.

See Also
--------
is_boolean : Check if the Index only consists of booleans (deprecated).
is_integer : Check if the Index only consists of integers (deprecated).
is_floating : Check if the Index is a floating type (deprecated).
is_numeric : Check if the Index only consists of numeric data (deprecated).
is_categorical : Check if the Index holds categorical data (deprecated).
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
>>> idx = pd.Index(["Apple", "Mango", "Watermelon"])
>>> idx.is_object()  # doctest: +SKIP
True

>>> idx = pd.Index(["Apple", "Mango", 2.0])
>>> idx.is_object()  # doctest: +SKIP
True

>>> idx = pd.Index(["Watermelon", "Orange", "Apple",
...                 "Watermelon"]).astype("category")
>>> idx.is_object()  # doctest: +SKIP
False

>>> idx = pd.Index([1.0, 2.0, 3.0, 4.0])
>>> idx.is_object()  # doctest: +SKIP
False
zE.is_object is deprecated.Use pandas.api.types.is_object_dtype insteadr  )r;  r<  rS  r  r=  r6   rM   r   r   s    r   	is_objectIndex.is_object
  sE    R 	Dz""# $; ;')		
 tzz**r   c                    [         R                  " [        U 5      R                   S3[        [        5       S9  U R                  S;   $ )an  
Check if the Index holds categorical data.

.. deprecated:: 2.0.0
      Use `isinstance(index.dtype, pd.CategoricalDtype)` instead.

Returns
-------
bool
    True if the Index is categorical.

See Also
--------
CategoricalIndex : Index for categorical data.
is_boolean : Check if the Index only consists of booleans (deprecated).
is_integer : Check if the Index only consists of integers (deprecated).
is_floating : Check if the Index is a floating type (deprecated).
is_numeric : Check if the Index only consists of numeric data (deprecated).
is_object : Check if the Index is of the object dtype. (deprecated).
is_interval : Check if the Index holds Interval objects (deprecated).

Examples
--------
>>> idx = pd.Index(["Watermelon", "Orange", "Apple",
...                 "Watermelon"]).astype("category")
>>> idx.is_categorical()  # doctest: +SKIP
True

>>> idx = pd.Index([1, 3, 5, 7])
>>> idx.is_categorical()  # doctest: +SKIP
False

>>> s = pd.Series(["Peter", "Victor", "Elisabeth", "Mar"])
>>> s
0        Peter
1       Victor
2    Elisabeth
3          Mar
dtype: object
>>> s.index.is_categorical()  # doctest: +SKIP
False
zO.is_categorical is deprecated.Use pandas.api.types.is_categorical_dtype insteadr  )categoricalr  r   s    r   is_categoricalIndex.is_categoricalB
  sI    X 	Dz""# $@ @')		
 !!_44r   c                    [         R                  " [        U 5      R                   S3[        [        5       S9  U R                  S;   $ )a  
Check if the Index holds Interval objects.

.. deprecated:: 2.0.0
    Use `isinstance(index.dtype, pd.IntervalDtype)` instead.

Returns
-------
bool
    Whether or not the Index holds Interval objects.

See Also
--------
IntervalIndex : Index for Interval objects.
is_boolean : Check if the Index only consists of booleans (deprecated).
is_integer : Check if the Index only consists of integers (deprecated).
is_floating : Check if the Index is a floating type (deprecated).
is_numeric : Check if the Index only consists of numeric data (deprecated).
is_object : Check if the Index is of the object dtype. (deprecated).
is_categorical : Check if the Index holds categorical data (deprecated).

Examples
--------
>>> idx = pd.Index([pd.Interval(left=0, right=5),
...                 pd.Interval(left=5, right=10)])
>>> idx.is_interval()  # doctest: +SKIP
True

>>> idx = pd.Index([1, 3, 5, 7])
>>> idx.is_interval()  # doctest: +SKIP
False
zI.is_interval is deprecated.Use pandas.api.types.is_interval_dtype insteadr  )intervalr  r   s    r   is_intervalIndex.is_intervalw
  sG    D 	Dz""# $= =')		
 !!\11r   c                     U R                   S;   $ )z&
Whether the type is an integer type.
)r  r   r   r   s    r   _holds_integerIndex._holds_integer
  s    
 !!%AAAr   c                    [         R                  " [        U 5      R                   S3[        [        5       S9  U R                  5       $ )zl
Whether the type is an integer type.

.. deprecated:: 2.0.0
    Use `pandas.api.types.infer_dtype` instead
zG.holds_integer is deprecated. Use pandas.api.types.infer_dtype instead.r  )r;  r<  rS  r  r=  r6   r  r   s    r   holds_integerIndex.holds_integer
  sD     	Dz""# $8 8')		
 ""$$r   c                @    [         R                  " U R                  SS9$ )z
Return a string of the type inferred from the values.

Examples
--------
>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.inferred_type
'integer'
Fskipna)r   infer_dtyper'  r   s    r   r   Index.inferred_type
  s     t||E::r   c                    [        U R                  5      (       a  gU R                  [        :w  a  gU R                  (       a  g[	        [        U R                  5      5      $ )z8
Whether or not the index values only consist of dates.
TF)rQ   r   r+  r^  r   rB   r'  r   s    r   _is_all_datesIndex._is_all_dates
  sE     tzz**ZZ:% ^^ t||!<==r   c                "    [        U [        5      $ )z9
Cached check equivalent to isinstance(self, MultiIndex)
)r  r`   r   s    r   r^  Index._is_multi
  s     $..r   c                \    U R                   U R                  S.n[        [        U 5      U4S 4$ )N)r   r   )r   r   r   rS  )r   r   s     r   
__reduce__Index.__reduce__
  s)    ZZ3DJ?D00r   c                    U R                   n[        U[        R                   5      (       a&  UR                  S;   a  [        $ [        R
                  $ UR                  $ )z-The expected NA value to use with this index.mM)r   r  r%  r(  r   r  na_valuer   r   s     r   r  Index._na_value
  sB     

eRXX&&zzT!
66M~~r   c                    U R                   (       a  [        U 5      $ [        R                  " [	        U 5      [        R
                  S9nUR                  S5        U$ )z
Return if each value is NaN.
r  F)r  rh   r%  emptyr4  bool_fill)r   rY  s     r   _isnanIndex._isnan
  sB    
 : XXc$irxx8FKKMr   c                l    U R                   (       a#  [        U R                  R                  5       5      $ g)z
Return True if there are any NaNs.

Enables various performance speedups.

Returns
-------
bool

Examples
--------
>>> s = pd.Series([1, 2, 3], index=['a', 'b', None])
>>> s
a    1
b    2
None 3
dtype: int64
>>> s.index.hasnans
True
F)r  r   r  r  r   s    r   hasnansIndex.hasnans  s&    , )**r   c                    U R                   $ )aq  
Detect missing values.

Return a boolean same-sized object indicating if the values are NA.
NA values, such as ``None``, :attr:`numpy.NaN` or :attr:`pd.NaT`, get
mapped to ``True`` values.
Everything else get mapped to ``False`` values. Characters such as
empty strings `''` or :attr:`numpy.inf` are not considered NA values.

Returns
-------
numpy.ndarray[bool]
    A boolean array of whether my values are NA.

See Also
--------
Index.notna : Boolean inverse of isna.
Index.dropna : Omit entries with missing values.
isna : Top-level isna.
Series.isna : Detect missing values in Series object.

Examples
--------
Show which entries in a pandas.Index are NA. The result is an
array.

>>> idx = pd.Index([5.2, 6.0, np.nan])
>>> idx
Index([5.2, 6.0, nan], dtype='float64')
>>> idx.isna()
array([False, False,  True])

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

>>> idx = pd.Index(['black', '', 'red', None])
>>> idx
Index(['black', '', 'red', None], dtype='object')
>>> idx.isna()
array([False, False, False,  True])

For datetimes, `NaT` (Not a Time) is considered as an NA value.

>>> idx = pd.DatetimeIndex([pd.Timestamp('1940-04-25'),
...                         pd.Timestamp(''), None, pd.NaT])
>>> idx
DatetimeIndex(['1940-04-25', 'NaT', 'NaT', 'NaT'],
              dtype='datetime64[ns]', freq=None)
>>> idx.isna()
array([False,  True,  True,  True])
)r  r   s    r   rh   
Index.isna  s    j {{r   c                $    U R                  5       ) $ )a  
Detect existing (non-missing) values.

Return a boolean same-sized object indicating if the values are not NA.
Non-missing values get mapped to ``True``. Characters such as empty
strings ``''`` or :attr:`numpy.inf` are not considered NA values.
NA values, such as None or :attr:`numpy.NaN`, get mapped to ``False``
values.

Returns
-------
numpy.ndarray[bool]
    Boolean array to indicate which entries are not NA.

See Also
--------
Index.notnull : Alias of notna.
Index.isna: Inverse of notna.
notna : Top-level notna.

Examples
--------
Show which entries in an Index are not NA. The result is an
array.

>>> idx = pd.Index([5.2, 6.0, np.nan])
>>> idx
Index([5.2, 6.0, nan], dtype='float64')
>>> idx.notna()
array([ True,  True, False])

Empty strings are not considered NA values. None is considered a NA
value.

>>> idx = pd.Index(['black', '', 'red', None])
>>> idx
Index(['black', '', 'red', None], dtype='object')
>>> idx.notna()
array([ True,  True,  True, False])
)rh   r   s    r   notnaIndex.notnaU  s    T 		|r   c                   [        U5      (       d!  [        S[        U5      R                   35      eU[        R
                  La:  [        R                  " S[        U 5      R                   S3[        [        5       S9  OSnU R                  (       a]  U R                  U R                  U5      nUc  [        R                  X0R                  S9$ [!        [        U 5      R                   S35      eU R#                  5       $ )a  
Fill NA/NaN values with the specified value.

Parameters
----------
value : scalar
    Scalar value to use to fill holes (e.g. 0).
    This value cannot be a list-likes.
downcast : dict, default is None
    A dict of item->dtype of what to downcast if possible,
    or the string 'infer' which will try to downcast to an appropriate
    equal type (e.g. float64 to int64 if possible).

    .. deprecated:: 2.1.0

Returns
-------
Index

See Also
--------
DataFrame.fillna : Fill NaN values of a DataFrame.
Series.fillna : Fill NaN Values of a Series.

Examples
--------
>>> idx = pd.Index([np.nan, np.nan, 3])
>>> idx.fillna(0)
Index([0.0, 0.0, 3.0], dtype='float64')
z"'value' must be a scalar, passed: zThe 'downcast' keyword in zb.fillna is deprecated and will be removed in a future version. It was previously silently ignored.r  Nr]  zF.fillna does not support 'downcast' argument values other than 'None'.)rN   r  rS  r  r   r   r;  r<  r=  r6   r  r  r  r   rb  r   rI  r  )r   rl  downcastrA  s       r   fillnaIndex.fillna  s    > @eAUAU@VWXX3>>)MM,T$Z-@-@,A B6 6 +- H<<\\$++u5F ((ii(@@%:&&' (5 5  zz|r   c                    US;  a  [        SU 35      eU R                  (       a<  U R                  U R                  )    n[	        U 5      R                  X R                  S9$ U R                  5       $ )a6  
Return Index without NA/NaN values.

Parameters
----------
how : {'any', 'all'}, default 'any'
    If the Index is a MultiIndex, drop the value when any or all levels
    are NaN.

Returns
-------
Index

Examples
--------
>>> idx = pd.Index([1, np.nan, 3])
>>> idx.dropna()
Index([1.0, 3.0], dtype='float64')
)r  r1  zinvalid how option: r]  )r6  r  r'  r  rS  r9  r   r  )r   r   r  s      r   dropnaIndex.dropna  sb    ( n$3C59::<<t{{l3J:))*99)EEzz|r   c                   > Ub  U R                  U5        U R                  (       a  U R                  5       $ [        TU ]  5       nU R                  U5      $ )a&  
Return unique values in the index.

Unique values are returned in order of appearance, this does NOT sort.

Parameters
----------
level : int or hashable, optional
    Only return values from specified level (for MultiIndex).
    If int, gets the level by integer position, else by level name.

Returns
-------
Index

See Also
--------
unique : Numpy array of unique values in that column.
Series.unique : Return unique values of Series object.

Examples
--------
>>> idx = pd.Index([1, 1, 2, 3, 3])
>>> idx.unique()
Index([1, 2, 3], dtype='int64')
)r  ri  r  superr   r  )r   r   rA  	__class__s      r   r   Index.unique  sI    6 &&u->>::<!!!&))r   rr  c               `   > U R                   (       a  U R                  5       $ [        TU ]  US9$ )a  
Return Index 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.

Returns
-------
Index

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

Examples
--------
Generate an pandas.Index with duplicate values.

>>> idx = pd.Index(['lama', 'cow', 'lama', 'beetle', 'lama', 'hippo'])

The `keep` parameter controls  which duplicate values are removed.
The value 'first' keeps the first occurrence for each
set of duplicated entries. The default value of keep is 'first'.

>>> idx.drop_duplicates(keep='first')
Index(['lama', 'cow', 'beetle', 'hippo'], dtype='object')

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

>>> idx.drop_duplicates(keep='last')
Index(['cow', 'beetle', 'lama', 'hippo'], dtype='object')

The value ``False`` discards all sets of duplicated entries.

>>> idx.drop_duplicates(keep=False)
Index(['cow', 'beetle', 'hippo'], dtype='object')
rr  )ri  r  r"  drop_duplicates)r   rs  r#  s     r   r&  Index.drop_duplicates  s,    \ >>::<w&D&11r   c                    U R                   (       a"  [        R                  " [        U 5      [        S9$ U R                  US9$ )a  
Indicate duplicate index values.

Duplicated values are indicated as ``True`` values in the resulting
array. 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'
    The value or values in a set of duplicates to mark as missing.

    - '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
-------
np.ndarray[bool]

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

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

>>> idx = pd.Index(['lama', 'cow', 'lama', 'beetle', 'lama'])
>>> idx.duplicated()
array([False, False,  True, False,  True])

which is equivalent to

>>> idx.duplicated(keep='first')
array([False, False,  True, False,  True])

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

>>> idx.duplicated(keep='last')
array([ True, False,  True, False, False])

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

>>> idx.duplicated(keep=False)
array([ True, False,  True, False,  True])
r  rr  )ri  r%  zerosr4  r   _duplicated)r   rs  s     r   r   Index.duplicated2  s5    l >>88CIT22T**r   c                
    X-   $ r   r  r  s     r   __iadd__Index.__iadd__p  s
    |r   c                F    [        S[        U 5      R                   S35      e)NzThe truth value of a zC is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().)r6  rS  r  r   s    r   __nonzero__Index.__nonzero__t  s-    #DJ$7$7#8 9C C
 	
r   c                \    [        X5      nU R                  ULa  U R                  U5      $ U $ )z
If the result of a set operation will be self,
return self, unless the name changes, in which
case make a shallow copy of self.
)r   r   r  )r   r   r   s      r   _get_reconciled_name_object!Index._get_reconciled_name_object  s.     "$.99D ;;t$$r   c                .    US;  a  [        SU S35      eg )N)NFTzBThe 'sort' keyword only takes the values of None, True, or False; z was passed.r6  )r   r   s     r   _validate_sort_keywordIndex._validate_sort_keyword  s.    **))-l<  +r   c                    [        U [        5      (       aT  [        U[        5      (       a?  U R                  b2  UR                  b%  U R                  S5      nUR                  S5      nX44$ X4$ )z.
With mismatched timezones, cast both to UTC.
UTC)r  r^   tz
tz_convert)r   r   setopr   rights        r   _dti_setop_align_tzsIndex._dti_setop_align_tzs  sd     t-..5"233#$ ??5)D$$U+E;{r   c                $   U R                  U5        U R                  U5        U R                  U5      u  pU R                  UR                  :w  a  [	        U [
        5      (       a3  [        [        U5      5      (       d  [        U5      S:  a  [        S5      eU R                  US5      u  pU R                  U5      nU R                  USS9nUR                  USS9nUR                  XbS9$ [        U5      (       a  U R                  U5      (       a(  U R                  U5      nUSL a  UR!                  5       $ U$ [        U 5      (       d(  UR                  U 5      nUSL a  UR!                  5       $ U$ U R#                  XS9nU R%                  X5      $ )a  
Form the union of two Index objects.

If the Index objects are incompatible, both Index objects will be
cast to dtype('object') first.

Parameters
----------
other : Index or array-like
sort : bool or None, default None
    Whether to sort the resulting Index.

    * None : Sort the result, except when

      1. `self` and `other` are equal.
      2. `self` or `other` has length 0.
      3. Some values in `self` or `other` cannot be compared.
         A RuntimeWarning is issued in this case.

    * False : do not sort the result.
    * True : Sort the result (which may raise TypeError).

Returns
-------
Index

Examples
--------
Union matching dtypes

>>> idx1 = pd.Index([1, 2, 3, 4])
>>> idx2 = pd.Index([3, 4, 5, 6])
>>> idx1.union(idx2)
Index([1, 2, 3, 4, 5, 6], dtype='int64')

Union mismatched dtypes

>>> idx1 = pd.Index(['a', 'b', 'c', 'd'])
>>> idx2 = pd.Index([1, 2, 3, 4])
>>> idx1.union(idx2)
Index(['a', 'b', 'c', 'd', 1, 2, 3, 4], dtype='object')

MultiIndex case

>>> idx1 = pd.MultiIndex.from_arrays(
...     [[1, 1, 2, 2], ["Red", "Blue", "Red", "Blue"]]
... )
>>> idx1
MultiIndex([(1,  'Red'),
    (1, 'Blue'),
    (2,  'Red'),
    (2, 'Blue')],
   )
>>> idx2 = pd.MultiIndex.from_arrays(
...     [[3, 3, 2, 2], ["Red", "Green", "Red", "Green"]]
... )
>>> idx2
MultiIndex([(3,   'Red'),
    (3, 'Green'),
    (2,   'Red'),
    (2, 'Green')],
   )
>>> idx1.union(idx2)
MultiIndex([(1,  'Blue'),
    (1,   'Red'),
    (2,  'Blue'),
    (2, 'Green'),
    (2,   'Red'),
    (3, 'Green'),
    (3,   'Red')],
   )
>>> idx1.union(idx2, sort=False)
MultiIndex([(1,   'Red'),
    (1,  'Blue'),
    (2,   'Red'),
    (2,  'Blue'),
    (3,   'Red'),
    (3, 'Green'),
    (2, 'Green')],
   )
r   zjCan only union MultiIndex with MultiIndex or Index of tuples, try mi.to_flat_index().union(other) instead.unionFr	  r   T)r7  _assert_can_do_setop_convert_can_do_setopr   r  r`   rM   _unpack_nested_dtyper4  rI  r?  _find_common_type_compatr$  rB  equalsr3  r  _union_wrap_setop_result)r   r   r   result_namer   r   r>  rA  s           r   rB  Index.union  st   f 	##D)!!%(!77>::$4//'(<U(CDDJN)C  33E7CKD11%8E;;u5;1DLLUL3E::e://Ut{{511 55e<Ft|))++MT66t<Ft|))++MU.&&u55r   c                b   U R                   nUR                   nUS;   a{  U R                  (       aj  UR                  (       aY  U R                  (       a  UR                  (       d7  U R                  (       a&  UR                  (       a   U R	                  U5      S   $ UR                  (       d!  [        R                  " X5      n[!        X5      $ U R"                  (       a(  U R%                  U5      n	U	S:H  R'                  5       S   n
O([        R(                  " U R+                  U5      S   5      n
U R,                  (       a!  U R/                  UR1                  U
5      5      nO/[3        U
5      S:  a  UR1                  U
5      n[5        X<45      nOUnU R                  (       a  UR                  (       d  [!        X5      nU$ ! [
        [        4 aa    [        U5      n[        U5      nUR                  U Vs/ s H  owU;  d  M
  UPM     Os  snf sn5        [        R                  " U[        S9s $ f = f)a  
Specific union logic should go here. In subclasses, union behavior
should be overwritten here rather than in `self.union`.

Parameters
----------
other : Index or array-like
sort : False or None, default False
    Whether to sort the resulting index.

    * True : sort the result
    * False : do not sort the result.
    * None : sort the result, except when `self` and `other` are equal
      or when the values cannot be compared.

Returns
-------
Index
NTr   r  r  rF  )r'  r  r  _can_use_libjoinr   r  r   r0  setextendr%  r5  r   ri  r   union_with_duplicates_maybe_try_sort_index_as_uniqueget_indexernonzerounique1dget_indexer_non_uniquer^  r)  r  r4  rT   )r   r   r   lvalsrvals
value_list	value_setr  result_dupsindexermissingrA  
other_diffs                r   rI  Index._union   s   (  L ,,--((U-A-A%%&&

:**51!44 55dBK";55   &&u-G"}--/2GnnT%@%@%G%JKG >>[[G!45F 7|a"ZZ0
&':;++53P3P$V2FS 45 :!%[
  J	!!e"Je	7I1e"JKxx
&99:s$   F= =5H.2	H
?H
&H.-H.c                    [        X5      n[        U[        5      (       a#  UR                  U:w  a  UR	                  U5      nU$ U R                  X#S9nU$ Nr]  )r   r  r   r   r  r  )r   r   rA  r   s       r   rJ  Index._wrap_setop_resulto  sT    !$.fe$${{d"t,  ''':Fr   c                   U R                  U5        U R                  U5        U R                  U5      u  pU R                  UR                  :w  a  U R	                  US5      u  pU R                  U5      (       aY  U R                  (       d   U R                  5       R                  U5      nOU R                  U5      nUSL a  UR                  5       nU$ [        U 5      S:X  d  [        U5      S:X  a  U R                  (       d  UR                  (       a  U SS R                  U5      $ U R                  U5      nU R                  U:X  a7  [        U 5      S:X  a  U SS R                  U5      $ USS R                  U5      $ [        / XSS9$ U R                  U5      (       d3  [!        U ["        5      (       a  U SS R                  U5      $ [        / US9$ U R                  UR                  :w  a@  U R                  U5      nU R%                  USS9nUR%                  USS9nUR'                  XS	9$ U R)                  XS	9nU R+                  X5      $ )
ax  
Form the intersection of two Index objects.

This returns a new Index with elements common to the index and `other`.

Parameters
----------
other : Index or array-like
sort : True, False or None, default False
    Whether to sort the resulting index.

    * None : sort the result, except when `self` and `other` are equal
      or when the values cannot be compared.
    * False : do not sort the result.
    * True : Sort the result (which may raise TypeError).

Returns
-------
Index

Examples
--------
>>> idx1 = pd.Index([1, 2, 3, 4])
>>> idx2 = pd.Index([3, 4, 5, 6])
>>> idx1.intersection(idx2)
Index([3, 4], dtype='int64')
intersectionTr   N)r   r   r]  Fr	  rC  )r7  rD  rE  r   r?  rH  ri  r   r3  r  r4  r^  r  rG  r   _should_comparer  r`   r$  rf  _intersection_wrap_intersection_result)r   r   r   rK  rA  r   thiss          r   rf  Index.intersectiony  s   > 	##D)!!%(!77>::$33E>JKD;;u>>BB5I99%@t|++-Mt9>SZ1_ ~~ BQx{3311%8EzzU" t9>8??;77 !9++K885;;%%e,,$..BQx{33+..ZZ5;;&11%8E;;u5;1DLLUL3E$$U$66##E#5--e<<r   c                   U R                   (       a  UR                   (       a  U R                  (       a  UR                  (       ar   U R                  U5      u  p4n[        U R                  5      (       a  [
        R                  " U5      nO!U R                  U5      nUR                  5       n[        U5      $ U R                  XS9n[        X5      nU$ ! [         a     N(f = f)z<
intersection specialized to the case with matching dtypes.
rC  )r  rO  r   rL   r   r   rW  r  r&  ry   r  _intersection_via_get_indexerrS  )	r   r   r   res_indexerr^  _resrA  r  s	            r   rh  Index._intersection  s    
 ((--%%&&;*.*=*=e*D'a $DJJ//  ..5C!YYw/F 002C5c::777I
$Z6
!  s   C 
C C c                $    U R                  X5      $ r   rJ  r   r   rA  s      r   ri  Index._wrap_intersection_result      &&u55r   c                r   U R                  5       nUR                  5       nUR                  U5      nUS:g  nUR                  UR                  5       S   5      nUSL a  [        R
                  " U5      n[        U[        5      (       a  UR                  U5      nU$ UR                  U5      R                  nU$ )z
Find the intersection of two Indexes using get_indexer.

Returns
-------
np.ndarray or ExtensionArray or MultiIndex
    The returned array will be unique.
r  r   F)	r   get_indexer_forr  rV  r%  r   r  r`   r'  )	r   r   r   left_uniqueright_uniquer^  r  takerrA  s	            r   rm  #Index._intersection_via_get_indexer  s     kkm||~ --l;"}T\\^A./5= GGENE k=11 %%e,F  !%%e,44Fr   c                "   U R                  U5        U R                  U5        U R                  U5      u  pU R                  U5      (       a  U SS R	                  U5      $ [        U5      S:X  a6  U R                  5       R	                  U5      nUSL a  UR                  5       $ U$ U R                  U5      (       d6  U R                  5       R	                  U5      nUSL a  UR                  5       $ U$ U R                  XS9nU R                  X5      $ )a  
Return a new Index with elements of index not in `other`.

This is the set difference of two Index objects.

Parameters
----------
other : Index or array-like
sort : bool or None, default None
    Whether to sort the resulting index. By default, the
    values are attempted to be sorted, but any TypeError from
    incomparable elements is caught by pandas.

    * None : Attempt to sort the result, but catch any TypeErrors
      from comparing incomparable elements.
    * False : Do not sort the result.
    * True : Sort the result (which may raise TypeError).

Returns
-------
Index

Examples
--------
>>> idx1 = pd.Index([2, 1, 3, 4])
>>> idx2 = pd.Index([3, 4, 5, 6])
>>> idx1.difference(idx2)
Index([1, 2], dtype='int64')
>>> idx1.difference(idx2, sort=False)
Index([2, 1], dtype='int64')
Nr   TrC  )r7  rD  rE  rH  r  r4  r   r  rg  _difference_wrap_difference_result)r   r   r   rK  rA  s        r   
differenceIndex.difference  s    B 	##D)!!%(!77> ;;u8??;//u:?[[]))+6Ft|))++M##E**[[]))+6Ft|))++M!!%!3++E::r   c                @   U n[        U [        5      (       a2  U R                  (       a!  UR                  (       a  UR                  5       nUR	                  5       nX1R                  U5      S:H     nUR                  (       a  UOUR	                  5       n[        XB5      nU$ Nr  )r  r\   r  r  r   rx  ri  rS  )r   r   r   rj  the_diffs        r   r~  Index._differenceP  sr    d/00T\\emm;;=D--d3r9:#~~88??3D"82r   c                $    U R                  X5      $ r   rs  rt  s      r   r  Index._wrap_difference_result[  rv  r   c                   U R                  U5        U R                  U5        U R                  U5      u  pUc  UnU R                  UR                  :w  a  U R	                  US5      u  pU R                  U5      (       d  U R                  XS9R                  U5      $ U R                  UR                  :w  aO  U R                  U5      nU R                  USS9nUR                  USS9nUR                  XsS9R                  U5      $ U R                  5       nUR                  5       nUR                  U5      nUR                  US:g  R                  5       S   5      n	[        R                   " [        R"                  " UR$                  5      U	SS9n
UR                  U
5      nUS:H  R                  5       S   nUR                  U5      nUR'                  U5      n[)        X5      nU R*                  (       d  [-        XUR                  S	9$ [/        S
U5      n[1        U5      S:X  a  UR3                  5       R5                  U5      $ UR5                  U5      $ )a  
Compute the symmetric difference of two Index objects.

Parameters
----------
other : Index or array-like
result_name : str
sort : bool or None, default None
    Whether to sort the resulting index. By default, the
    values are attempted to be sorted, but any TypeError from
    incomparable elements is caught by pandas.

    * None : Attempt to sort the result, but catch any TypeErrors
      from comparing incomparable elements.
    * False : Do not sort the result.
    * True : Sort the result (which may raise TypeError).

Returns
-------
Index

Notes
-----
``symmetric_difference`` contains elements that appear in either
``idx1`` or ``idx2`` but not both. Equivalent to the Index created by
``idx1.difference(idx2) | idx2.difference(idx1)`` with duplicates
dropped.

Examples
--------
>>> idx1 = pd.Index([1, 2, 3, 4])
>>> idx2 = pd.Index([2, 3, 4, 5])
>>> idx1.symmetric_difference(idx2)
Index([1, 5], dtype='int64')
symmetric_differencerC  Fr	  r  r   T)assume_uniquer   r   r   )r7  rD  rE  r   r?  rg  rB  r  rG  r$  r  r   rx  r  rV  r%  	setdiff1drw  sizer)  rS  r^  r   r   r4  remove_unused_levelsr  )r   r   rK  r   result_name_updater   rj  thatr^  common_indexerleft_indexer	left_diffright_indexer
right_diffr  rA  s                   r   r  Index.symmetric_difference_  s   H 	##D)!!%($($>$>u$E!,K::$33E;QRKD##E**::e:/66{CCZZ5;;&11%8E;;u5;1D<<E<2D,,T,=DD[QQ{{}&&u- !w"}&=&=&?&BC||IIdii .
 IIl+	 !B//1!4ZZ.
%%j1
 2~~9I9IJJ\95I6{a 557AA+NN##K00r   c                :    [        U5      (       d  [        S5      eg)Nz!Input must be Index or array-likeT)rK   r  r  s     r   rD  Index._assert_can_do_setop  s    E""?@@r   c                    [        U[        5      (       d"  [        XR                  S9nU R                  nX4$ [        X5      nX4$ rc  )r  r   r   r   )r   r   rK  s      r   rE  Index._convert_can_do_setop  sF    %''%ii0E))K !! -T9K!!r   c                z   U R                  U5      n U R                  R                  U5      $ ! [         ag  n[	        U[
        5      (       d6  [	        U[        R                  5      (       a"  [        S U 5       5      (       a  [        U5      e[        U5      UeSnAf[         a    U R                  U5        e f = f)a  
Get integer location, slice or boolean mask for requested label.

Parameters
----------
key : label

Returns
-------
int if unique index, slice if monotonic index, else mask

Examples
--------
>>> unique_index = pd.Index(list('abc'))
>>> unique_index.get_loc('b')
1

>>> monotonic_index = pd.Index(list('abbc'))
>>> monotonic_index.get_loc('b')
slice(1, 3, None)

>>> non_monotonic_index = pd.Index(list('abcb'))
>>> non_monotonic_index.get_loc('b')
array([False,  True, False,  True])
c              3  B   #    U  H  n[        U[        5      v   M     g 7fr   )r  slicer&  s     r   r   Index.get_loc.<locals>.<genexpr>  s     Aj
1e,,jr  N)_maybe_cast_indexerr  get_locr  r  r  r   r   r  r1   r  _check_indexing_error)r   key
casted_keyrC  s       r   r  Index.get_loc  s    4 --c2
	<<''
33 	)*e,,:s||44AjAAA',,3-S( 	 &&s+	s   . 
B:A"B B:c                   [        U5      nUnU R                  U5      nU R                  X#U5        U R                  (       d  [	        U R
                  5      e[        U5      S:X  a#  [        R                  " / [        R                  S9$ U R                  U5      (       d&  U R                  U5      (       d  U R                  XSS9$ [        U R                  [        5      (       a  U R                  UR                  :X  d   eU R                   R#                  UR$                  5      nU R&                  (       aW  UR&                  (       aF  [)        U5      nU R+                  [        R,                  5      nUR)                  5       n	XU'   SXiU) -  '   U$ [        UR                  [        5      (       a  U R#                  UR.                  5      n
[0        R2                  " XR$                  SS9nU R4                  (       dU  U R&                  (       aD  UR&                  (       a3  U R+                  [        R,                  5      nUR)                  5       n	XU	'   [7        U5      $ U R9                  U5      u  pXLd  XLa  UR#                  XX4S9$ U R                  UR                  :X  aB  U R;                  U5      (       a,  [        R<                  " [        U5      [        R                  S9$ U R                  UR                  :w  aW  U R                  U5      (       dA  U R?                  U5      nU RA                  USS	9nURA                  USS	9nURC                  XX4S9$ U RC                  XX45      $ )
a  
Compute indexer and mask for new index given the current index.

The indexer should be then used as an input to ndarray.take to align the
current data to the new index.

Parameters
----------
target : Index
method : {None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'}, optional
    * default: exact matches only.
    * pad / ffill: find the PREVIOUS index value if no exact match.
    * backfill / bfill: use NEXT index value if no exact match
    * nearest: use the NEAREST index value if no exact match. Tied
      distances are broken by preferring the larger index value.
limit : int, optional
    Maximum number of consecutive labels in ``target`` to match for
    inexact matches.
tolerance : optional
    Maximum distance between original and new labels for inexact
    matches. The values of the index at the matching locations must
    satisfy the equation ``abs(index[indexer] - target) <= tolerance``.

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

Returns
-------
np.ndarray[np.intp]
    Integers from 0 to n - 1 indicating that the index at these
    positions matches the corresponding target values. Missing values
    in the target are marked by -1.

Notes
-----
Returns -1 for unmatched values, for further explanation see the
example below.

Examples
--------
>>> index = pd.Index(['c', 'a', 'b'])
>>> index.get_indexer(['a', 'b', 'x'])
array([ 1,  2, -1])

Notice that the return value is an array of locations in ``index``
and ``x`` is marked by -1, as it is not in ``index``.
r   r  Tr  r   r  r  r  limit	toleranceFr	  )"r   _maybe_cast_listlike_indexer_check_indexing_methodrT  r1   _requires_unique_msgr4  r%  r5  intprg  _should_partial_index_get_indexer_non_comparabler  r   rV   r  rU  r   r  rh   r  r  r!  r   take_ndr^  rC   _maybe_downcast_for_indexingrH  rw  rG  r$  _get_indexer)r   targetr  r  r  orig_targetr^  target_nanslocr  categories_indexerpselfptargetr   rj  s                  r   rU  Index.get_indexer  s   t +62226:##F9=$$#D$=$=>>v;!88Bbgg..##F++D4N4Nv4V4V 33FRV3WWdjj"233 ::---ll..v||<G||
 #;/ll266*{{}'*$/1|+,Nfll$455
 "&!1!1&2C2C!Dmm$6QSTGNNt|| ll266*{{} #&w//::6B 5$$e %   ::%$++f*=*=99S[88::%d.H.H.P.P 11&9E;;u5;1D]]5u]5F$$U %     BBr   c                z   Ub  U R                  XA5      nUS;   a  U R                  XX45      nOUS:X  a  U R                  XU5      nOkUR                  (       a/  U R                  (       a  U R                  nUR                  U5      nOUR                  5       nU R                  R                  U5      n[        U5      $ )Npadbackfillnearest)	_convert_tolerance_get_fill_indexer_get_nearest_indexerr^  r  _extract_level_codesr  rU  rC   )r   r  r  r  r  r^  engine
tgt_valuess           r   r  Index._get_indexers  s      //	BI((,,VUNGy //yIGDNN $88
 $668
ll..z:G"7++r   c                    [        U R                  [        5      (       a;  [        UR                  [        5      (       a  gU R                  R	                  U5      $ g)z.
Should we attempt partial-matching indexing?
F)r  r   rY   r   rg  r   r  s     r   r  Index._should_partial_index  sA    
 djj-00&,,6699,,V44r   c                j   US;  a  [        S5      eU R                  (       a%  US:X  a  [        S5      eUS;   a  Ub  [        S5      e[        U R                  [
        [        45      (       a'  Ub$  [        SU S	[        U 5      R                   35      eUc  Ub  [        S
5      eUb  [        S5      egg)zI
Raise if we have a get_indexer `method` that is not supported or valid.
)Nbfillr  r  ffillr  zInvalid fill methodr  zJmethod='nearest' not implemented yet for MultiIndex; see GitHub issue 9365r  Nz,tolerance not implemented yet for MultiIndexzmethod z not yet implemented for zJtolerance argument only valid if doing pad, backfill or nearest reindexingzFlimit argument only valid if doing pad, backfill or nearest reindexing)	r6  r^  rI  r  r   rY   rV   rS  r  )r   r  r  r  s       r   r  Index._check_indexing_method  s     OO 233>>")<  ,,(-F  djj=2B"CDD!)fX%>tDz?R?R>ST  >$ 5    5  ! r   c           
        [         R                  " U5      nUR                  UR                  :w  a  UR                  S:  a  [        S5      e[	        U 5      (       a  [         R
                  " UR                  [         R                  5      (       dy  UR                  S:  a/  [        S[        U 5      R                   SU R                   S35      e[        S[        U 5      R                   SU R                   S[        U5       35      eU$ )NrF  z5list-like tolerance size must match target index sizer   ztolerance argument for z with dtype z1 must contain numeric elements if it is list typez$ must be numeric if it is a scalar: )r%  r.  r  r6  rL   
issubdtyper   numberrG  rS  r  repr)r   r  r  s      r   r  Index._convert_tolerance  s    JJy)	;;)..(Y^^a-?TUUd##BMM)//299,U,U~~! -d4j.A.A-B,zzl"SU 
 )$t**=*=)>l4::, W66:9o5FH  r   c                *   U R                   (       a  U R                  (       d  U R                  (       d  [        S5      eU R	                  U5      R
                  R                  n[        US [        U 5       5      n[        U[        U 5      S  5      nUR                  XrX45      $ U R                  (       a  UR                  (       a  UR                  5       nU R                  5       n	[        U[        R                  5      (       a  [        U	[        R                  5      (       d  [        eUS:X  a  [        R                   " XUS9n
O([        R"                  " XUS9n
OU R%                  XU5      n
Ub"  [        U 5      (       a  U R'                  XU5      n
U
$ )N0index must be monotonic increasing or decreasingr  r  )r^  r  r  r6  r)  r  rY  r   r4  r  r  r  r%  r&  rI  libalgosr  r  _get_fill_indexer_searchsorted_filter_indexer_tolerance)r   r  r  r  r  encodedself_encodedtarget_encodedr  
own_valuesr^  s              r   r  Index._get_fill_indexer  sE    >>00D4P4P !STTkk&)1188G 3t9!56L"73t9;#78N11  ''F,J,J"557M002JmRZZ88
BJJA A *)",,zN #++JUS99&%PG SYY44ViPGr   c                    Ub  [        S[        U5       S35      eUS:X  a  SOSnU R                  U5      nUS:H  nU R                  X   U5      XV'   US:X  a  XV==   S-  ss'   U$ SXU[	        U 5      :H  '   U$ )zj
Fallback pad/backfill get_indexer that works for monotonic decreasing
indexes and non-monotonic targets.
zlimit argument for z; method only well-defined if index and target are monotonicr  r   r>  r  rF  )r6  r  rU  _searchsorted_monotonicr4  )r   r  r  r  sider^  nonexacts          r   r  $Index._get_fill_indexer_searchsorted  s     %d6l^ 44 4 
 4:U? ""6*b= 889I4P6>
 "  -/Gs4y()r   c                   [        U 5      (       d  U R                  US5      $ U R                  USUS9nU R                  USUS9nU R                  X5      nU R                  X5      nU R                  (       a  [
        R                  O[
        R                  n[        R                  " U" Xg5      US:H  -  UU5      n	Ub  U R                  XU5      n	U	$ )z
Get the indexer for the nearest index labels; requires an index with
values that can be subtracted from each other (e.g., not strings or
tuples).
r  r  r  r  )r4  r  rU  _difference_compatr  operatorltler%  wherer  )
r   r  r  r  r  r  left_distancesright_distancesopr^  s
             r   r  Index._get_nearest_indexer  s     4yy))&%88''U'C((5(I00F11&H 88X[[hkk(( ~/"$
  44ViPGr   c                X    U R                  X5      n[        R                  " XC:*  US5      $ r  )r  r%  r  )r   r  r^  r  distances        r   r  Index._filter_indexer_tolerance?  s*     **6;xx-w;;r   c                   [        U R                  [        5      (       aH  [        SU R                  5      R
                  n[        SUR                  5      R
                  nX2   U-
  nOU R                  U   UR                  -
  n[        U5      $ )Nr   )r  r   rZ   r   r   r  r'  abs)r   r  r^  r  r  diffs         r   r  Index._difference_compatJ  sq     djj+..mTZZ8AAJ =FFM&6D <<(6>>9D4yr   c                    U R                  SUR                  S5        U R                  SUR                  S5        U R                  SUR                  S5        g)zb
For positional indexing, a slice must have either int or None
for each of start, stop, and step.

positionalilocN)_validate_indexerr  stopstepr   r  s     r   _validate_positional_slice Index._validate_positional_slice_  sF     	|SYY?|SXXv>|SXXv>r   c                   UR                   UR                  UR                  pTn[        U5      n[        R
                  " U R                  S5      (       aL  US:X  a4  U(       a-  X4:X  d(  US:w  a"  [        R                  " S[        [        5       S9  U R                  X4U5      $ US:X  a|  U(       a  U$ U R                  R                  S;   aY  U R                  SUR                   S5        U R                  SUR                  S5        U R                  SUR                  S5        U$ U=(       a    U R                  nU(       a+   Ub  U R                  U5        Ub  U R                  U5        Sn["        R$                  " U5      (       a  UnU$ U(       a  US	:X  a  ['        S
5      eUnU$ U R                  X4U5      nU$ ! [          a     N[f = f)z
Convert a slice indexer.

By definition, these are labels unless 'iloc' is passed in.
Floats are not allowed as the start, step, or stop of the slice.

Parameters
----------
key : label of the slice bound
kind : {'loc', 'getitem'}
fgetitemr   zThe behavior of obj[i:j] with a float-dtype index is deprecated. In a future version, this will be treated as positional instead of label-based. For label-based slicing, use obj.loc[i:j] insteadr  iur  Fr  zjSlicing a positional slice with .loc is not allowed, Use .loc with labels or .iloc with positions instead.)r  r  r  r}   r   is_np_dtyper   r;  r<  r=  r6   slice_indexerr(  r  _should_fallback_to_positionalr  r  r)  is_null_slicer  )	r   r  r(  r  r  r  is_index_sliceis_positionalr^  s	            r   _convert_slice_indexerIndex._convert_slice_indexeri  s     IIsxxT 337 ??4::s++ y ^EMdVWi
 / "/1 %%e4889
D(&&w		9E&&w)D&&w)D
 'N4+N+N $LL'#LL& % S!!G  u}L  G  ((d;G#  s    *F9 9
GGc           
         SU S[        U 5      R                   SU S[        U5      R                   3nU[        R                  La  [	        U5      Ue[	        U5      e)z+
Raise consistent invalid indexer message.
z
cannot do z indexing on z with these indexers [z
] of type )rS  r  r   r   r  )r   formr  reraiserk  s        r   _raise_invalid_indexerIndex._raise_invalid_indexer  sf     mDJ,?,?+@ AZS	(:(:';= 	 #..(C.g-nr   c                ^    U R                   (       d  [        U5      (       a  [        S5      egg)z
Check if we are allowing reindexing with this particular indexer.

Parameters
----------
indexer : an integer ndarray

Raises
------
ValueError if its a duplicate axis
/cannot reindex on an axis with duplicate labelsN)rT  r4  r6  )r   r^  s     r   _validate_can_reindexIndex._validate_can_reindex  s)     $$WNOO *6$r   c                   [        US5      (       + n[        U5      n[        U[        5      (       d;  [	        U5      S:X  a,  Ub!  U R
                  (       a  U R                  U   nOU nUSS nO[        U5      nUb\  [        U [        5      (       d  [        U[        5      (       a2  Ub  [        S5      eU R                  XSU R
                  (       + S9u  pn	OU R                  U5      (       a  SnOmU R                  (       a  U R                  XXES9nOKU R
                  (       a  [        S5      eU R                  (       d  [        S	5      eU R!                  U5      u  pU R#                  XU5      nX4$ )
aX  
Create index with target's values.

Parameters
----------
target : an iterable
method : {None, 'pad'/'ffill', 'backfill'/'bfill', 'nearest'}, optional
    * default: exact matches only.
    * pad / ffill: find the PREVIOUS index value if no exact match.
    * backfill / bfill: use NEXT index value if no exact match
    * nearest: use the NEAREST index value if no exact match. Tied
      distances are broken by preferring the larger index value.
level : int, optional
    Level of multiindex.
limit : int, optional
    Maximum number of consecutive labels in ``target`` to match for
    inexact matches.
tolerance : int or float, optional
    Maximum distance between original and new labels for inexact
    matches. The values of the index at the matching locations must
    satisfy the equation ``abs(index[indexer] - target) <= tolerance``.

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

Returns
-------
new_index : pd.Index
    Resulting index.
indexer : np.ndarray[np.intp] or None
    Indices of output values in original index.

Raises
------
TypeError
    If ``method`` passed along with ``level``.
ValueError
    If non-unique multi-index
ValueError
    If non-unique index and ``method`` or ``limit`` passed.

See Also
--------
Series.reindex : Conform Series to new index with optional filling logic.
DataFrame.reindex : Conform DataFrame to new index with optional filling logic.

Examples
--------
>>> idx = pd.Index(['car', 'bike', 'train', 'tractor'])
>>> idx
Index(['car', 'bike', 'train', 'tractor'], dtype='object')
>>> idx.reindex(['car', 'bike'])
(Index(['car', 'bike'], dtype='object'), array([0, 1]))
r   r   Nz)Fill method not supported if level passedr>  )r   
keep_orderr  z'cannot handle a non-unique multi-index!r  )r-  ensure_has_lenr  r   r4  r^  r  ensure_indexr`   r  _join_levelrH  rT  rU  r6  ri  rX  _wrap_reindex_result)
r   r  r  r   r  r  preserve_namesr  r^  ro  s
             r   reindexIndex.reindex  sT   F %VV44  '&%((S[A-= T^^kk%(!WF!&)Ft]++z&-/P/P! KLL "&!1!174>>7I "2 "FQ
 {{6""(("..U / G ^^$%NOO$%VWW!%!<!<V!DJG**6NKr   c                (    U R                  X5      nU$ r   )_maybe_preserve_names)r   r  r^  r  s       r   r  Index._wrap_reindex_resultT  s    ++FCr   c                    U(       aJ  UR                   S:X  a:  UR                  U R                  :w  a   UR                  SS9nU R                  Ul        U$ )NrF  Fr  )rz  r   r  )r   r  r  s      r   r  Index._maybe_preserve_namesX  s?    fnn1fkkTYY6N[[e[,F))FKr   c                   [        U5      n[        U5      S:X  a)  U SS [        R                  " / [        R                  S9S4$ U R                  U5      u  p#US:g  nU R                  X$   5      nSn[        U5      (       Gau  [        R                  " [        U5      [        R                  S9n[        U5      nUR                  U5      nXt)    n	U R                  X$   5      R                  n
Xt   n[        R                  " [        U5      4[        S9nXU'   XU	'   [        U 5      (       d$  [        R                  " S[        R                  S9nOUR                  (       aR  [        R                  " [        U5      [        R                  S9n[        R                  " [        U
5      5      Xk'   SXi'   OESX$) '   [        R                  " [        U R                  U5      5      [        R                  S9nSXd) '   [        U [        5      (       d  [        XPR                   S9nO"[#        U 5      R%                  XPR&                  S9nXU4$ )ak  
Create a new index with target's values (move/add/delete values as
necessary) use with non-unique Index and a possibly non-unique target.

Parameters
----------
target : an iterable

Returns
-------
new_index : pd.Index
    Resulting index.
indexer : np.ndarray[np.intp]
    Indices of output values in original index.
new_indexer : np.ndarray[np.intp] or None

r   Nr  r  r]  r  )r  r4  r%  r5  r  rX  r  rw  rC   rY  r  r   ri  r  r`   r   r   rS  r3  r  )r   r  r^  r_  check
new_labelsnew_indexerr(  missing_labelsmissing_indexer
cur_labelscur_indexerr   s                r   _reindex_non_uniqueIndex._reindex_non_unique^  s   * f%v;!8RXXb8$>>66v>2)-7>)B
w<<YYs7|277;F)'2G#[[1N$VnO7>299J -K 3w</@J&0{#*8' t99 ii9 !! iiGBGGD+-99S_+E(/1, #% !iiDIIg,>(?rwwO&(F#$..jyy9IT
..z.LI;..r   r   c                   g r   r  r   r   r   r   r   r   s         r   r   
Index.join       	r   r   c                   g r   r  r,  s         r   r   r-    r.  r   c                   g r   r  r,  s         r   r   r-    r.  r   r   c                  [        U5      nU=(       d    US:H  n[        U [        5      (       aB  [        U[        5      (       a-  U R                  SL UR                  SL -  (       a  [	        S5      eU R
                  (       d>  UR
                  (       d-  U R                  U5      u  pgX`Ld  XqLa  UR                  XrUSUS9$ UcL  U R
                  (       d  UR
                  (       a*  U R                  UR                  :X  a  OU R                  XS9$ Ub2  U R
                  (       d  UR
                  (       a  U R                  XUS9$ [        U 5      S:X  d  [        U5      S:X  a   U R                  XU5      $ U R                  UR                  :w  aA  U R                  U5      nU R                  USS	9n	UR                  USS	9nU	R                  XSS
9$ [        U [         5      (       a~  [        U[         5      (       ai  U R"                  (       dX  U R$                  R'                  UR$                  5      (       d.  [)        UR*                  R-                  U R$                  5      5      n[/        U5        U R0                  (       ae  UR0                  (       aT  U R2                  (       aC  UR2                  (       a2  U R4                  (       d  UR4                  (       a   U R7                  XS9$ U R4                  (       a  UR4                  (       d  U R9                  XUS9$ U R;                  XU5      $ ! [         a     GNf = f! [         a     N/f = f)ak  
Compute join_index and indexers to conform data structures to the new index.

Parameters
----------
other : Index
how : {'left', 'right', 'inner', 'outer'}
level : int or level name, default None
return_indexers : bool, default False
sort : bool, default False
    Sort the join keys lexicographically in the result Index. If False,
    the order of the join keys depends on the join type (how keyword).

Returns
-------
join_index, (left_indexer, right_indexer)

Examples
--------
>>> idx1 = pd.Index([1, 2, 3])
>>> idx2 = pd.Index([4, 5, 6])
>>> idx1.join(idx2, how='outer')
Index([1, 2, 3, 4, 5, 6], dtype='int64')
outerNz0Cannot join tz-naive with tz-aware DatetimeIndexTr   r   r   Fr	  r   r   r   r   )r  r  r^   r;  r  r^  r  r   r  _join_multir  r4  _join_emptyr   rG  r$  r\   orderedr!  rH  r   r'  reorder_categories_validate_join_methodr  rO  ri  _join_monotonic_join_non_unique_join_via_get_indexer)
r   r   r   r   r   r   r  potherr   rj  s
             r   r   r-    s   F U#%sg~d,--*UDT2U2U4EHH$45 RSS~~eoo ==eDME F$7zz5$T "   =dnnzzU[[('''77 $..EOO##Ec#::t9>SZ1_''D99
 ::$11%8E;;u5;1DLLUL3E99UT9BBt0115"566LLOO**5+;+;<< %--::4??KLEc" ((--%%&&5??++E+;; u((d(CC))%d;;G  :  s$   #L( L9 (
L65L69
MMc                h   [        U 5      S:X  d  [        U5      S:X  d   e[        U5        [        U5      (       a8  [        [        SSS.R	                  X"5      5      nUR                  XU5      u  pEnOUS;   a  U(       a3  U R                  (       d"  U R                  5       nU R                  U5      nOS nU R                  5       n[        R                  " [        R                  " S5      [        U5      5      nO5UR                  5       n[        R                  " / [        R                  S9nS nXFU4$ )Nr   r>  r   r   r>  )r   r2  r  r  )r4  r:  r   r(   r   r7  r  argsortr  r  r%  broadcast_tor  r5  )r   r   r   r   r   r   r   s          r   r7  Index._join_empty5  s     4yA~Uq00c"
 u::w6 B F Fs PQC%*%6%6t$%G"Jd%%D88||~!YYt_
!ZZ\
??2772;J@DJ88Bbgg.DD%%r   c                   US:X  a  U(       a  U R                  5       OU nOLUS:X  a  U(       a  UR                  5       OUnO,US:X  a  U R                  XS9nOUS:X  a   U R                  XS9nWU L a  S nOU R                  U5      nXAL a  S nOUR                  U5      nXEU4$ ! [         a1    U R                  U5      n [	        XC5      n N^! [         a      Nkf = ff = f)Nr   r>  innerrC  r2  )r  rf  rB  r  rS  rx  )r   r   r   r   r   lindexerrindexers          r   r=  Index._join_via_get_indexerP  s     &=/3))+JG^04**,%JG^**5*<JG^!ZZZ9
 H++J7HH,,Z8HX--  !ZZ.
!0!BJ  	s*   B" "C>C
CCCCc                "   SSK Jn  SSKJn  [	        [
        R                  " U R                  6 5      n[	        [
        R                  " UR                  6 5      nUR                  nUR                  n[        U5      n	[        U5      n
X-  nU(       d  [        S5      e[        X5      (       a  [        X5      (       a  [        X-
  US9n[        X-
  US9n[        X-   5      (       d  U nUR                  U R                  5      nO"U R                  U5      nUR                  U5      nUR!                  XSS9u  nnnX-   nU" U UUUUU5      u  nnnU" UUUSS	9nUR#                  5       nUS
:X  a  Xl-   nOX]-   nUR                  U5      nUUU4$ [%        ['        U5      5      nSn[        X5      (       a  XpSnSS
S.nUR)                  X"5      nUR                  R                  U5      nU R+                  UUUS9nU(       a  US   US   US   4$ U$ )Nr   r  ) restore_dropped_levels_multijoinz+cannot join with no overlapping index names)r  Tr4  Fr  r>  r   r>  r   r3  r  rF  )r2  r   pandas.core.reshape.mergerJ  r0  r)  not_noner  r   rP  r6  r  r  r4  reorder_levelsr  r   r  nextiterr   r  )r   r   r   r   rJ  self_names_listother_names_listself_names_orderother_names_order
self_namesother_namesoverlapldrop_namesrdrop_namesself_jnlevelsother_jnlevelsjoin_idxr   r   dropped_namesr  r   r  multi_join_idxlevel_orderjl
flip_orderflipr   rA  s                                 r   r6  Index._join_multis  s5   8N s||TZZ89ekk :;*00,22)
*+* JKKd''Ju,I,I !5;KLK !6<MNK {011 $!&!5!5djj!A ${ ;!&!= $1#5#5 $6 $ HdD (5M
 $D$ FE5 (U%%N ,@@BN g~.<-;+::;GN!4--$w-  
d''%J5;W+MD((3$C!!"%!!%C!8!9fQi22r   c                P   SSK Jn  U R                  UR                  :X  d   eU" U R                  UR                  X#S9u  pVUS:H  nU R	                  U5      nUR	                  U5      n	UR                  Xy5      n
[        U
[        5      (       a  US:X  a  U
R                  5       n
XU4$ )Nr   )get_join_indexers_non_uniquer5  r  r2  )	rL  re  r   r'  r  r  r  r`   r  )r   r   r   r   re  left_idx	right_idxr  r\  r>  r   s              r   r<  Index._join_non_unique  s     	K zzU[[(((:LL%--S
 2~99X&

9%%%d2
j-00SG^#::<JY..r   c                   SSK Jn  SS jn[        X5      (       a  [        X5      (       a  [        S5      eXp[        X5      (       + n	U	(       a  XpSSS.n
U
R	                  X35      n[        Xu5      (       d   eUR                  U5      nUR                  U   nUR                  (       d  [        S5      eUR                  XS	S
9u  pnUc:  U(       d  [        U5      S:X  a  SnUnGOU" UR                  SUS-    5      nX   nGO[        U5      n[        R                  " U[        U5      5      nUR                  U   nUUS:g     nUR                  U5      n[!        UR                  5      nUUU'   [!        UR                  5      nUUU'   U(       a{  ["        R$                  " [        U5      ["        R&                  S9n[)        ["        R*                  U5      nUS:g  nUR-                  5       (       d  U Vs/ s H  nUU   PM
     nnUU   nOUS:X  a^  [        U5      S:X  a  SOUR/                  5       nSU-   n[0        R2                  " UU5      u  nnUUS   S nU Vs/ s H  nUU   PM
     nnOqUS:g  nUR-                  5       nU(       d  U Vs/ s H  nUU   PM
     nnU" USUS-    5      nU Vs/ s H  nUU   PM
     nnU(       d  UR5                  5       S   U   nU" UUUR6                  SS9nUb  UR                  UR                  U   5      nOUR                  U   nU	(       a  UUnnUc  SO
[        U5      nUc  SO
[        U5      nUUU4$ s  snf s  snf s  snf s  snf )a1  
The join method *only* affects the level of the resulting
MultiIndex. Otherwise it just exactly aligns the Index data to the
labels of the level in the MultiIndex.

If ```keep_order == True```, the order of the data indexed by the
MultiIndex will not be changed; otherwise, it will tie out
with `other`.
r   r  c                   U S   R                   S:X  a#  [        R                  " S[        R                  S9$ [	        U 5      S:X  a  [        [        U S   5      5      $ U S   SS U S   SS :g  nU SS  H  nXSS USS :g  -  nM     [        R                  " S/US/45      R                  5       S   n[        U S   5      n[        R                  " U[        U5      5      $ )z
Returns sorter for the inner most level while preserving the
order of higher levels.

Parameters
----------
labels : list[np.ndarray]
    Each ndarray has signed integer dtype, not necessarily identical.

Returns
-------
np.ndarray[np.intp]
r   r  rF  Nr  T)r  r%  r  r  r4  r   rC   hstackrV  rA   r   get_level_sorter)r   ticlabstartss       r   _get_leaf_sorter+Index._join_level.<locals>._get_leaf_sorter  s     ay~~"xx116{a-.A&).LMM )CR.F1IabM1Ca|3Bx3qr7** $ YYdV45==?BFvbz*C''-@-HIIr   z9Join on level between two MultiIndex objects is ambiguousr   r>  rK  z8Index._join_level on non-unique index is not implementedTr4  NrF  r  r  Fr  )r   zlist[np.ndarray]returnnpt.NDArray[np.intp])r2  r   r  r  r   r  r  ri  rI  r   r4  r   rC   r   get_reverse_indexerr  r0  r%  rw  r  r   r&  r1  maxr  groupsort_indexerrV  r  )r   r   r   r   r  r   rp  r   r>  ra  rb  	old_level	new_levelleft_lev_indexerright_lev_indexerr  r   rev_indexer	old_codesr{  new_lev_codesr  r  r  rn  max_new_levngroupscountsmask_allr  s                                 r   r  Index._join_level  s    	9	J< d''Ju,I,IWXXe#D55
%5;W+MD((3$C$++++&&u-KK&	%J  :CD :H :
6	%6 #SY!^#!
/

;UQY0GH!/
  33CD112BC	NSK

5)Ii2o.E',,U3MTZZ(I,Iedkk*J )Ju!yyT"''B#BJJ=$*xxzz6? @isTiI @#/#5L A:'*='9Q'>!MDUDUDWK+oG+3+E+E%w,(L&
 $0q	#<L>G His\!2iI HI )B.D#xxzH#:C$D)3SY)	$D#3Ik	4J#KL>G His\!2iI H $'+||~a'8'F#!jj!&	J (-22:3C3CE3JKM&,,U3M*7-L !(D.A,.O 	 ")D/B=/Q 	 <66e !A !I %E !Is   8M!MM"6M'c                   UR                   U R                   :X  d   eU R                  (       a  UR                  (       d   eU R                  U5      (       a  US:X  a  UOU nUS S 4$ U R                  (       a  UR                  (       a  US:X  a  U nS nU R	                  U5      nOUS:X  a  UnUR	                  U 5      nS nOUS:X  a'  U R                  U5      u  punU R                  XqXV5      nOUS:X  a&  U R                  U5      u  punU R                  XqXV5      nOUS:X  a  U R                  U5      u  punOPUS:X  a  UR                  U 5      u  pvnO5US:X  a  U R                  U5      u  punOUS:X  a  U R                  U5      u  punWc   eWc   eU R                  WXU5      nWc  S O
[        U5      nWc  S O
[        U5      nWXV4$ )Nr>  r   rE  r2  )
r   rO  rH  ri  r   r   _wrap_joined_indexr   r   rC   )r   r   r   	ret_indexr   r   r   
join_arrays           r   r;  Index._join_monotonicw  s   
 {{djj((($$)?)???;;u "%TIdD((
 >>eoof}!
007"
11$7)-)<)<U)C&
$!44ZS
)-)<)<U)C&
$!44ZS
f})-););E)B&
$).)<)<T)B&
$)-)<)<U)C&
$)-)<)<U)C&
$######00U$OJ|t)<T)B|t)<T)B4%%r   c                   UR                   U R                   :X  d   e[        U [        5      (       a  U R                  UR                  :X  a  U R                  OS nUS:H  nU R	                  U5      n[        SUR	                  U5      5      nUR                  Xh5      R                  5       n	U	R                  U5      $ [        X5      nU R                  R                  XU R                   S9$ )Nr  r   r  )r   r  r`   r  r  r   r  r  r  r   re  rb  )
r   r   r   r   r   r   r  r\  r>  r   s
             r   r  Index._wrap_joined_index  s     {{djj(((dM**!%u{{!:4::D 2:DyyHuzz$'78E!))$6MMOJ''--%d2D$$00$**0UUr   c                   [        U 5      [        L aa  [        U R                  [        R                  5      =(       d6    [        U R
                  [        [        45      =(       d    U R                  S:H  $ [        U [        [        45      (       + $ )a  
Whether we can use the fastpaths implemented in _libs.join.

This is driven by whether (in monotonic increasing cases that are
guaranteed not to have NAs) we can convert to a np.ndarray without
making a copy. If we cannot, this negates the performance benefit
of using libjoin.
zstring[python])
rS  r   r  r   r%  r'  ro   rp   r_   r`   r   s    r   rO  Index._can_use_libjoin  sl     : 4::rxx0 2dll-@/,RS2::!11 d%5}$EFFFr   c                    [        5       (       aN  U R                  n[        U[        R                  5      (       a!  UR                  5       nSUR                  l        U$ U R                  $ )a  
Return an array representing the data in the Index.

.. warning::

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

Returns
-------
array: numpy.ndarray or ExtensionArray

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

Examples
--------
For :class:`pandas.Index`:

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

For :class:`pandas.IntervalIndex`:

>>> idx = pd.interval_range(start=0, end=5)
>>> idx.values
<IntervalArray>
[(0, 1], (1, 2], (2, 3], (3, 4], (4, 5]]
Length: 5, dtype: interval[int64, right]
F)r   r   r  r%  r&  r  flags	writeable)r   r   s     r   rY  Index.values  sN    L   ::D$

++yy{',

$Kzzr   c                x    U R                   n[        U[        R                  5      (       a  SSKJn  U" U5      nU$ )Nr   )NumpyExtensionArray)r   r  r%  r&  pandas.core.arrays.numpy_r  )r   r5  r  s      r   r5  Index.array  s0     

eRZZ((E'.Er   c                    U R                   $ )a  
The best array representation.

This is an ndarray or ExtensionArray.

``_values`` are consistent between ``Series`` and ``Index``.

It may differ from the public '.values' method.

index             | values          | _values       |
----------------- | --------------- | ------------- |
Index             | ndarray         | ndarray       |
CategoricalIndex  | Categorical     | Categorical   |
DatetimeIndex     | ndarray[M8ns]   | DatetimeArray |
DatetimeIndex[tz] | ndarray[M8ns]   | DatetimeArray |
PeriodIndex       | ndarray[object] | PeriodArray   |
IntervalIndex     | IntervalArray   | IntervalArray |

See Also
--------
values : Values
)r   r   s    r   r'  Index._values  s    0 zzr   c                   U R                   n[        U[        5      (       a  UR                  $ [        U[        5      (       a  U R
                  R                  S;   a  SSKnUR                  R                  nUR                  R                  U5      (       a+  UR                  5       nUR                  R                  S5      $ UR                  R                  U5      (       a+  UR                  5       nUR                  R                  S5      $ [        U 5      [         L a  [        U R                   ["        5      (       a  [        U R                   [$        5      (       dr  [        U R                   [        5      (       a4  ['        U R
                  5      (       a  U R
                  R                  S:w  d  U R                   R)                  [*        5      $ U$ )zT
Get the ndarray or ExtensionArray that we can pass to the IndexEngine
constructor.
r  r   Ni8rP  )r'  r  ru   r  ro   r   r(  r  r  rS  r  r  r  r  r  r  r   rs   rp   rL   r$  r   )r   valsr  r  s       r   r  Index._get_engine_target2  s>   
 ||dK((== d/00TZZ__5L nn))Gxx$$W----/}}))$//%%g....0}}))$//J%4<<88t||_==4<<)<==$TZZ00JJOOs* <<&&v..r   c                V   [        U R                  [        5      (       a  U R                  R                  $ [        U R                  [        5      (       a  U R                  R                  5       $ U R                  5       n[        U[        R                  5      (       d  [        S5      eU$ )zK
Get the ndarray or ExtensionArray that we can pass to the join
functions.
z%_can_use_libjoin should return False.)
r  r'  rp   r   ro   to_numpyr  r%  r&  r6  r  s     r   r   Index._get_join_targetT  s~     dllO44<<%%%&9:: <<((** ((*&"**--DEEr   c                t   [        U R                  [        5      (       aG  [        U R                  5      " U[        R
                  " UR                  [        R                  S95      $ [        U R                  [        [        45      (       a,  [        U R                  5      R                  XR                  S9$ U$ )zc
Cast the ndarray returned from one of the libjoin.foo_indexer functions
back to type(self._data).
r  )r  rY  rp   rS  r%  r)  shaper  ro   ru   r  r   r  s     r   r   Index._from_join_targeth  s{    
 dkk?33$VRXXfll"((-STT&9;%GHH$33F**3MMr   c                Z    U R                  US9nX R                  R                  US9-  nU$ )Nr  )_memory_usager  sizeof)r   r  rA  s      r   memory_usageIndex.memory_usages  s6    ###. 	,,%%4%00r   c                    [        U [        5      (       a  [        S5      e[        R                  " U[
        S9nU R                  U) U5      $ )a  
Replace values where the condition is False.

The replacement is taken from other.

Parameters
----------
cond : bool array-like with the same length as self
    Condition to select the values on.
other : scalar, or array-like, default None
    Replacement if the condition is False.

Returns
-------
pandas.Index
    A copy of self with values replaced from other
    where the condition is False.

See Also
--------
Series.where : Same method for Series.
DataFrame.where : Same method for DataFrame.

Examples
--------
>>> idx = pd.Index(['car', 'bike', 'train', 'tractor'])
>>> idx
Index(['car', 'bike', 'train', 'tractor'], dtype='object')
>>> idx.where(idx.isin(['car', 'train']), 'other')
Index(['car', 'other', 'train', 'other'], dtype='object')
z1.where is not supported for MultiIndex operationsr  )r  r`   rI  r%  r.  r   r  )r   condr   s      r   r  Index.where{  sG    B dM**%C  zz$d+||TE5))r   c                    [        U R                   S[        U[        R                  5      (       d  [        U5      O
[        U5       S35      e)Nz5(...) must be called with a collection of some kind, z was passed)r  r  r  r%  genericr  r   )r   r   s     r   r,  Index._raise_scalar_data_error  sJ    
 ||n '1$

'C'CT$ZTS T
 	
r   c                   U R                   n[        U[        R                   5      (       a  UR                  S;  a   [	        X!5      $ [        U R                  U5      (       d  [        eU$ ! [
         a  n[        UeSnAff = f)z
Check if the value can be inserted into our array without casting,
and convert it to an appropriate native type if necessary.

Raises
------
TypeError
    If the value cannot be inserted into an array of this dtype.
r  N)	r   r  r%  r(  r@   r:   r  r;   r'  )r   rl  r   rC  s       r   _validate_fill_valueIndex._validate_fill_value  sp     

eRXX&&5::T+A)*588 "$,,66O % )S()s   
A+ +
B5A<<Bc                ,    [        U R                  5      $ )z8
Return a boolean if we need a qualified .info display.
)rM   r   r   s    r   _is_memory_usage_qualified Index._is_memory_usage_qualified  s     tzz**r   c                l    [        U5         XR                  ;   $ ! [        [        [        4 a     gf = f)a  
Return a boolean indicating whether the provided key is in the index.

Parameters
----------
key : label
    The key to check if it is present in the index.

Returns
-------
bool
    Whether the key search is in the index.

Raises
------
TypeError
    If the key is not hashable.

See Also
--------
Index.isin : Returns an ndarray of boolean dtype indicating whether the
    list-like key is in the index.

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

>>> 2 in idx
True
>>> 6 in idx
False
F)hashr  OverflowErrorr  r6  r  s     r   __contains__Index.__contains__  s7    F 	S		,,&&y*5 		s    33zClassVar[None]__hash__c                    [        S5      e)Nz)Index does not support mutable operationsr  )r   r  rl  s      r   __setitem__Index.__setitem__  s    CDDr   c                $   U R                   R                  n[        U5      (       d  [        U5      (       a  [        R
                  " U5      nU" U5      $ [        U[        5      (       a  U R                  U5      $ [        R                  " U5      (       a  [        [        USS5      [        5      (       a  UR                  [        SS9nO[        R                  " U[        S9n[        U R                   [        5      (       dI  [#        U5      S:X  a:  [#        U5      [#        U 5      :w  a"  [$        R&                  " S[(        [+        5       S9  U" U5      nUR,                  S	:  a  [/        U5        U R0                  R3                  X0R4                  S
9$ )a  
Override numpy.ndarray's __getitem__ method to work as desired.

This function adds lists and Series as valid boolean indexers
(ndarrays only supports ndarray with dtype=bool).

If resulting ndim != 1, plain ndarray is returned instead of
corresponding `Index` subclass.

r   NF)r   r	  r  r   z~Using a boolean indexer with length 0 on an Index with length greater than 0 is deprecated and will raise in a future version.r  rF  r]  )r   __getitem__rI   rG   r)  cast_scalar_indexerr  r  _getitem_sliceis_bool_indexerr!  rX   r  r   r%  r.  r   r4  r;  r<  r=  r6   rG  r|   re  r9  r   )r   r  r   rA  s       r   r  Index.__getitem__  s.    **((c??hsmm))#.C3<c5!! &&s++s##
 '#w5~FFlll>jjD1djj.99s8q=SXT%:MM* &#3#5 ;;?"6*   ,,V**,EEr   c                .   U R                   U   n[        U 5      R                  X R                  U R                  S9nSU R
                  ;   aH  UR                  SL=(       a    UR                  S:  nUR                  R                  U R                  US9  U$ )z8
Fastpath for __getitem__ when we know we have a slice.
r  r  Nr   )reverse)	r   rS  r9  r   r"  rV  r  r  _update_from_sliced)r   slobjrp  rA  r  s        r   r  Index._getitem_slice1  s|     jjd''**4CSCS'T#jj,?aGNN..t||W.Mr   c                    [        U R                  5      (       d9  [        U R                  5      (       d  [        U R                  [        5      (       a  X;   $ g)a-  
Faster check for ``name in self`` when we know `name` is a Python
identifier (e.g. in NDFrame.__getattr__, which hits this to support
. key lookup). For indexes that can't hold identifiers (everything
but object & categorical) we just return False.

https://github.com/pandas-dev/pandas/issues/19764
F)rM   r   rP   r  rV   )r   r   s     r   $_can_hold_identifiers_and_holds_name*Index._can_hold_identifiers_and_holds_name=  s?     DJJ''tzz**$**&677<r   c                l   U /n[        U[        [        45      (       a  U[        U5      -  nOUR                  U5        U H#  n[        U[        5      (       a  M  [        S5      e   U Vs1 s H  o3R                  iM     nn[        U5      S:  a  SOU R                  nU R                  X%5      $ s  snf )z
Append a collection of Index options together.

Parameters
----------
other : Index or list/tuple of indices

Returns
-------
Index

Examples
--------
>>> idx = pd.Index([1, 2, 3])
>>> idx.append(pd.Index([4]))
Index([1, 2, 3, 4], dtype='int64')
zall inputs must be IndexrF  N)	r  r0  r  r)  r   r  r   r4  _concat)r   r   	to_concatobjr  r   s         r   r)  Index.appendO  s    $ F	edE]++e$I U#Cc5)) :;;  &//YcY/5zA~t499||I,, 0s   ,B1c                ~    U Vs/ s H  o3R                   PM     nn[        U5      n[        R                  XRS9$ s  snf )z%
Concatenate multiple Index objects.
r]  )r'  rT   r   rb  )r   r  r   r  to_concat_valsrA  s         r   r  Index._concats  s=     .77Y))Y7~.   33	 8s   :c                   [        U R                  U5      u  pU(       a  U R                  5       $ U R                  [        :w  a&  [        X R                  5      (       a  U R                  n U R                  U5      nU R                  R                  5       n[        U[         R"                  5      (       a2  [%        XqR'                  5       U5      n[         R                  " XqU5        OUR)                  X5        U R+                  U5      $ ! [        [        [        4 aW  n[        U R                  5      (       a  UeU R                  U5      nU R                  U5      R                  X5      s SnA$ SnAff = f)a]  
Return a new Index of the values set with the mask.

Returns
-------
Index

See Also
--------
numpy.ndarray.putmask : Changes elements of an array
    based on conditional and input values.

Examples
--------
>>> idx1 = pd.Index([1, 2, 3])
>>> idx2 = pd.Index([5, 6, 7])
>>> idx1.putmask([True, False, False], idx2)
Index([5, 2, 3], dtype='int64')
N)rn   r'  r  r   r   rg   r  r  r:   r6  r  rM   rG  r$  r  r  r%  r&  rm   sum_putmaskr  )r   r  rl  noop	convertedrC  r   rY  s           r   r  Index.putmask}  s   ( &dllD9
99;::$9%$L$LNNE	;11%8I ""$fbjj))3FHHJ	RIJJvY/
 OOD(!!&))' ":y9 	;tzz**	 11%8E;;u%--d::	;s   +D	 	E5AE0*E50E5c                   U R                  U5      (       a  g[        U[        5      (       d  g[        U 5      [        U5      :w  a  g[        U R                  [
        5      (       aX  U R                  R                  S:X  a>  UR                  U R                  :w  a$  UR                  U R                  [        5      5      $ [        U R                  5      (       a+  [        UR                  5      (       d  UR                  U 5      $ [        U[        5      (       a  UR                  U 5      $ [        U R                  [        5      (       aP  [        U[        U 5      5      (       d  g[        [        U R                   5      nUR                  UR                   5      $ [        UR                  ["        5      (       a  UR                  U 5      $ [%        U R                  UR                  5      $ )a  
Determine if two Index object are equal.

The things that are being compared are:

* The elements inside the Index object.
* The order of the elements inside the Index object.

Parameters
----------
other : Any
    The other object to compare against.

Returns
-------
bool
    True if "other" is an Index and it has the same elements and order
    as the calling index; False otherwise.

Examples
--------
>>> idx1 = pd.Index([1, 2, 3])
>>> idx1
Index([1, 2, 3], dtype='int64')
>>> idx1.equals(pd.Index([1, 2, 3]))
True

The elements inside are compared

>>> idx2 = pd.Index(["1", "2", "3"])
>>> idx2
Index(['1', '2', '3'], dtype='object')

>>> idx1.equals(idx2)
False

The order is compared

>>> ascending_idx = pd.Index([1, 2, 3])
>>> ascending_idx
Index([1, 2, 3], dtype='int64')
>>> descending_idx = pd.Index([3, 2, 1])
>>> descending_idx
Index([3, 2, 1], dtype='int64')
>>> ascending_idx.equals(descending_idx)
False

The dtype is *not* compared

>>> int64_idx = pd.Index([1, 2, 3], dtype='int64')
>>> int64_idx
Index([1, 2, 3], dtype='int64')
>>> uint64_idx = pd.Index([1, 2, 3], dtype='uint64')
>>> uint64_idx
Index([1, 2, 3], dtype='uint64')
>>> int64_idx.equals(uint64_idx)
True
TFpyarrow_numpy)r  r  r   r4  r   rv   storagerH  r$  r   rM   r`   r'  rs   rS  r   r   rX   rf   )r   r   earrs      r   rH  Index.equals  sL   v 88E??%''t9E
" tzz;//

""o5tzz) <<F 3444::&&u{{/K/K<<%%e]++<<%%dllN33eT$Z00

3D;;u{{++ekk>22<<%%emm<<r   c                   ^ ^ T R                  T5      =(       a^    [        UU 4S jT R                   5       5      =(       a7    [        T 5      [        T5      :H  =(       a    T R                  TR                  :H  $ )a  
Similar to equals, but checks that object attributes and types are also equal.

Returns
-------
bool
    If two Index objects have equal elements and same type True,
    otherwise False.

Examples
--------
>>> idx1 = pd.Index(['1', '2', '3'])
>>> idx2 = pd.Index(['1', '2', '3'])
>>> idx2.identical(idx1)
True

>>> idx1 = pd.Index(['1', '2', '3'], name="A")
>>> idx2 = pd.Index(['1', '2', '3'], name="B")
>>> idx2.identical(idx1)
False
c              3  Z   >#    U  H   n[        TUS 5      [        TUS 5      :H  v   M"     g 7fr   )r!  )r  r  r   r   s     r   r  "Index.identical.<locals>.<genexpr>,  s/      *A a&'%D*AA*s   (+)rH  r1  r   rS  r   r  s   ``r   	identicalIndex.identical  sd    0 KK * ** *
 T
d5k)* 

ekk)	
r   c                   U R                  U5         U R                  U5      n[        U[        5      (       a  UR	                  [        U 5      5      S   nX   $ ! [        [        4 af    U R                  U/SS9nUR                  S:  d  UR                  S:  a  [        S5      eUR                  5       nUS:X  a  U R                  s $  X   $ f = f)a  
Return the label from the index, or, if not present, the previous one.

Assuming that the index is sorted, return the passed index label if it
is in the index, or return the previous index label if the passed one
is not in the index.

Parameters
----------
label : object
    The label up to which the method returns the latest index label.

Returns
-------
object
    The passed label if it is in the index. The previous label if the
    passed label is not in the sorted index or `NaN` if there is no
    such label.

See Also
--------
Series.asof : Return the latest value in a Series up to the
    passed index.
merge_asof : Perform an asof merge (similar to left join but it
    matches on nearest key rather than equal key).
Index.get_loc : An `asof` is a thin wrapper around `get_loc`
    with method='pad'.

Examples
--------
`Index.asof` returns the latest index label up to the passed label.

>>> idx = pd.Index(['2013-12-31', '2014-01-02', '2014-01-03'])
>>> idx.asof('2014-01-01')
'2013-12-31'

If the label is in the index, the method returns the passed label.

>>> idx.asof('2014-01-02')
'2014-01-02'

If all of the labels in the index are later than the passed label,
NaN is returned.

>>> idx.asof('1999-01-02')
nan

If the index is not sorted, an error is raised.

>>> idx_not_sorted = pd.Index(['2013-12-31', '2015-01-02',
...                            '2014-01-03'])
>>> idx_not_sorted.asof('2013-12-31')
Traceback (most recent call last):
ValueError: index must be monotonic increasing or decreasing
r  r  r  rF  z!asof requires scalar valued input)r  r  r  r  r  r4  r  r  rU  rG  r  itemr  )r   ru  r  r^  s       r   asof
Index.asof4  s    r 	$$U+	1,,u%C #u%%kk#d),R0y )$ 		& &&wu&=G||a7<<!#3 CDD,,.Cby~~%  y		&s   A A.CCc                t   U R                   U   R                  UR                   SS9n[        R                  " US:  US-
  S5      n[        R                  " [        U 5      [        R                  S9U   R                  U5      nU R                   UR                  5          nSXCS:H  UR                   U:  -  '   U$ )aR  
Return the locations (indices) of labels in the index.

As in the :meth:`pandas.Index.asof`, if the label (a particular entry in
``where``) is not in the index, the latest index label up to the
passed label is chosen and its index returned.

If all of the labels in the index are later than a label in ``where``,
-1 is returned.

``mask`` is used to ignore ``NA`` values in the index during calculation.

Parameters
----------
where : Index
    An Index consisting of an array of timestamps.
mask : np.ndarray[bool]
    Array of booleans denoting where values in the original
    data are not ``NA``.

Returns
-------
np.ndarray[np.intp]
    An array of locations (indices) of the labels from the index
    which correspond to the return values of :meth:`pandas.Index.asof`
    for every element in ``where``.

See Also
--------
Index.asof : Return the label from the index, or, if not present, the
    previous one.

Examples
--------
>>> idx = pd.date_range('2023-06-01', periods=3, freq='D')
>>> where = pd.DatetimeIndex(['2023-05-30 00:12:00', '2023-06-01 00:00:00',
...                           '2023-06-02 23:59:59'])
>>> mask = np.ones(3, dtype=bool)
>>> idx.asof_locs(where, mask)
array([-1,  0,  1])

We can use ``mask`` to ignore certain values in the index during calculation.

>>> mask[1] = False
>>> idx.asof_locs(where, mask)
array([-1,  0,  0])
r>  r  r   rF  r  r  )	r'  searchsortedr%  r  rw  r4  r  r  argmax)r   r  r  locsrA  first_values         r   	asof_locsIndex.asof_locs  s    j ||D!..MM / 
 xxq$(A.3t9BGG4T:??Ell4;;=1>@	emmk9:;r   )r  r  r  r  c                   g r   r  r   r  r  r  r  s        r   r  Index.sort_values       	r   )r  r  r  c                   g r   r  r  s        r   r  r    r  r   c                   g r   r  r  s        r   r  r    r  r   r  c                   Uc  U(       a  U R                   (       d  U(       df  U R                  (       aU  U(       a>  [        R                  " [	        U 5      [        R
                  S9nU R                  5       U4$ U R                  5       $ [        U [        5      (       d  [        XX4S9nO7[        [        [        X5      5      nUR                  US9nU(       d  USSS2   nU R                  U5      nU(       a  X4$ U$ )a  
Return a sorted copy of the index.

Return a sorted copy of the index, and optionally return the indices
that sorted the index itself.

Parameters
----------
return_indexer : bool, default False
    Should the indices that would sort the index be returned.
ascending : bool, default True
    Should the index values be sorted in an ascending order.
na_position : {'first' or 'last'}, default 'last'
    Argument 'first' puts NaNs at the beginning, 'last' puts NaNs at
    the end.
key : callable, optional
    If not None, apply the key function to the index values
    before sorting. This is similar to the `key` argument in the
    builtin :meth:`sorted` function, with the notable difference that
    this `key` function should be *vectorized*. It should expect an
    ``Index`` and return an ``Index`` of the same shape.

Returns
-------
sorted_index : pandas.Index
    Sorted copy of the index.
indexer : numpy.ndarray, optional
    The indices that the index itself was sorted by.

See Also
--------
Series.sort_values : Sort values of a Series.
DataFrame.sort_values : Sort values in a DataFrame.

Examples
--------
>>> idx = pd.Index([10, 100, 1, 1000])
>>> idx
Index([10, 100, 1, 1000], dtype='int64')

Sort values in ascending order (default behavior).

>>> idx.sort_values()
Index([1, 10, 100, 1000], dtype='int64')

Sort values in descending order, and also get the indices `idx` was
sorted by.

>>> idx.sort_values(ascending=False, return_indexer=True)
(Index([1000, 100, 10, 1], dtype='int64'), array([3, 1, 0, 2]))
Nr  )itemsr  r  r  )r  r  )r  r  r%  rw  r4  r  r  r  r`   r   r   r   r   rA  r  )	r   r  r  r  r  r^  _asr  sorted_indexs	            r   r  r    s    z ;477$">">))CIRWW=yy{G++yy{" $..[C u/:;C++++6C$B$iyy~$$r   c                    [        S5      e)z
Use sort_values instead.
z=cannot sort an Index object in-place, use sort_values insteadr  r   r`  ra  s      r   r   
Index.sort<  s    
 WXXr   c                D    [        S[        U 5      R                   35      e)a3  
Shift index by desired number of time frequency increments.

This method is for shifting the values of datetime-like indexes
by a specified time increment a given number of times.

Parameters
----------
periods : int, default 1
    Number of periods (or increments) to shift by,
    can be positive or negative.
freq : pandas.DateOffset, pandas.Timedelta or str, optional
    Frequency increment to shift by.
    If None, the index is shifted by its own `freq` attribute.
    Offset aliases are valid strings, e.g., 'D', 'W', 'M' etc.

Returns
-------
pandas.Index
    Shifted index.

See Also
--------
Series.shift : Shift values of Series.

Notes
-----
This method is only implemented for datetime-like index classes,
i.e., DatetimeIndex, PeriodIndex and TimedeltaIndex.

Examples
--------
Put the first 5 month starts of 2011 into an index.

>>> month_starts = pd.date_range('1/1/2011', periods=5, freq='MS')
>>> month_starts
DatetimeIndex(['2011-01-01', '2011-02-01', '2011-03-01', '2011-04-01',
               '2011-05-01'],
              dtype='datetime64[ns]', freq='MS')

Shift the index by 10 days.

>>> month_starts.shift(10, freq='D')
DatetimeIndex(['2011-01-11', '2011-02-11', '2011-03-11', '2011-04-11',
               '2011-05-11'],
              dtype='datetime64[ns]', freq=None)

The default value of `freq` is the `freq` attribute of the index,
which is 'MS' (month start) in this example.

>>> month_starts.shift(10)
DatetimeIndex(['2011-11-01', '2011-12-01', '2012-01-01', '2012-02-01',
               '2012-03-01'],
              dtype='datetime64[ns]', freq='MS')
z\This method is only implemented for DatetimeIndex, PeriodIndex and TimedeltaIndex; Got type )rI  rS  r  )r   periodsfreqs      r   shiftIndex.shiftC  s,    p "((,T
(;(;'<>
 	
r   c                :    U R                   R                  " U0 UD6$ )as  
Return the integer indices that would sort the index.

Parameters
----------
*args
    Passed to `numpy.ndarray.argsort`.
**kwargs
    Passed to `numpy.ndarray.argsort`.

Returns
-------
np.ndarray[np.intp]
    Integer indices that would sort the index if used as
    an indexer.

See Also
--------
numpy.argsort : Similar method for NumPy arrays.
Index.sort_values : Return sorted copy of Index.

Examples
--------
>>> idx = pd.Index(['b', 'a', 'd', 'c'])
>>> idx
Index(['b', 'a', 'd', 'c'], dtype='object')

>>> order = idx.argsort()
>>> order
array([1, 0, 3, 2])

>>> idx[order]
Index(['a', 'b', 'c', 'd'], dtype='object')
)r   rA  r  s      r   rA  Index.argsort  s    J zz!!42622r   c                :    [        U5      (       d  [        U5      eg r   )rN   r1   r  s     r   r  Index._check_indexing_error  s    ~~ $C(( r   c                     U R                   S;  $ )z1
Should an integer key be treated as positional?
>   complexr  r  r   r  r   s    r   r  $Index._should_fallback_to_positional  s    
 !! *
 
 	
r   a:  
        Compute indexer and mask for new index given the current index.

        The indexer should be then used as an input to ndarray.take to align the
        current data to the new index.

        Parameters
        ----------
        target : %(target_klass)s

        Returns
        -------
        indexer : np.ndarray[np.intp]
            Integers from 0 to n - 1 indicating that the index at these
            positions matches the corresponding target values. Missing values
            in the target are marked by -1.
        missing : np.ndarray[np.intp]
            An indexer into the target of the values not found.
            These correspond to the -1 in the indexer array.

        Examples
        --------
        >>> index = pd.Index(['c', 'b', 'a', 'b', 'b'])
        >>> index.get_indexer_non_unique(['b', 'b'])
        (array([1, 3, 4, 1, 3, 4]), array([], dtype=int64))

        In the example below there are no matched values.

        >>> index = pd.Index(['c', 'b', 'a', 'b', 'b'])
        >>> index.get_indexer_non_unique(['q', 'r', 't'])
        (array([-1, -1, -1]), array([0, 1, 2]))

        For this reason, the returned ``indexer`` contains only integers equal to -1.
        It demonstrates that there's no match between the index and the ``target``
        values at these positions. The mask [0, 1, 2] in the return value shows that
        the first, second, and third elements are missing.

        Notice that the return value is a tuple contains two items. In the example
        below the first item is an array of locations in ``index``. The second
        item is a mask shows that the first and third elements are missing.

        >>> index = pd.Index(['c', 'b', 'a', 'b', 'b'])
        >>> index.get_indexer_non_unique(['f', 'b', 's'])
        (array([-1,  1,  3,  4, -1]), array([0, 2]))
        rX  c                   [        U5      nU R                  U5      nU R                  U5      (       d'  U R                  U5      (       d  U R	                  US SS9$ U R                  U5      u  p#X Ld  X1La  UR                  U5      $ U R                  UR                  :w  aB  U R                  U5      nU R                  USS9nUR                  USS9nUR                  U5      $ U R                  (       a/  UR                  (       a  U R                  nUR                  U5      nOUR                  5       nU R                  R                  U5      u  p[        U	5      [        U
5      4$ )NFr  r	  )r  r  rg  r  r  r  rX  r   rG  r$  r^  r  r  r  rC   )r   r  r  r  r   rj  r  r  r  r^  r_  s              r   rX  Index.get_indexer_non_unique  sF    f%226:##F++D4N4Nv4V4V 33F4PU3VV::6B 5//88::% 11&9E;;u5;1D==U=3D..t44 >>f..\\F  44V<J224J<<>>zJ"7+-@-IIIr   c                p    U R                   (       a  U R                  U5      $ U R                  U5      u  p#U$ )a+  
Guaranteed return of an indexer even when non-unique.

This dispatches to get_indexer or get_indexer_non_unique
as appropriate.

Returns
-------
np.ndarray[np.intp]
    List of indices.

Examples
--------
>>> idx = pd.Index([np.nan, 'var1', np.nan])
>>> idx.get_indexer_for([np.nan])
array([0, 2])
)rT  rU  rX  )r   r  r^  ro  s       r   rx  Index.get_indexer_for  s5    &   ##F++008
r   c                   Un[        U[        5      (       d  [        R                  " U5      nU R                  (       a&  U R                  U5      nU R                  U5      S   nOU R                  U5      u  p4nU R                  X4U5        U R                  U5      n[        U[        5      (       a  UR                  Ul
        [        R                  " UR                  S5      (       d  [        UR                  [        5      (       aM  [        U[        5      (       d'  [        U[!        U 5      5      (       a  UR"                  c  UR%                  S5      nX44$ )zB
Analogue to get_indexer that raises if any elements are missing.
r   r  N)r  r   r)  r*  rT  rx  r  r)  _raise_if_missingr  r   r   r  r   rW   r0  rS  r  
_with_freq)r   r  	axis_namekeyarrr^  r$  s         r   _get_indexer_strictIndex._get_indexer_strict*  s	    &%((**62F  **62G\\&)!,F+/+C+CF+K(F[v	:7#c5!!((FK??6<<..*LL/3
 3
 #t$$3T
++HH$**40r   c                &   [        U5      S:X  a  gUS:  nUR                  5       nU(       ae  U[        U5      :X  a  [        SU SU S35      e[        [	        U5      UR                  5       S      R                  5       5      n[        U S35      eg)a  
Check that indexer can be used to return a result.

e.g. at least one element was found,
unless the list of keys was actually empty.

Parameters
----------
key : list-like
    Targeted labels (only used to show correct error message).
indexer: array-like of booleans
    Indices corresponding to the key,
    (with -1 indicating not found).
axis_name : str

Raises
------
KeyError
    If at least one key was requested but none was found.
r   Nz	None of [z] are in the []z not in index)r4  r  r  r0  r  rV  r   )r   r  r^  r  missing_masknmissing	not_founds          r   r  Index._raise_if_missingK  s    * s8q= {##%3w<'3%~i[JKK\#.|/C/C/Ea/HIPPRSIi[677 r   c                    g r   r  r   r  r  r   s       r   r  !Index._get_indexer_non_comparablen       	r   c                    g r   r  r  s       r   r  r  t  r  r   c                    g r   r  r  s       r   r  r  z  r  r   c                $   Ub&  [        U5      n[        SU R                   SU 35      eS[        R                  " UR
                  [        R                  S9-  nU(       a  U$ [        R                  " [        U5      [        R                  S9nXV4$ )a  
Called from get_indexer or get_indexer_non_unique when the target
is of a non-comparable dtype.

For get_indexer lookups with method=None, get_indexer is an _equality_
check, so non-comparable dtypes mean we will always have no matches.

For get_indexer lookups with a method, get_indexer is an _inequality_
check, so non-comparable dtypes mean we will always raise TypeError.

Parameters
----------
target : Index
method : str or None
unique : bool, default True
    * True if called from get_indexer.
    * False if called from get_indexer_non_unique.

Raises
------
TypeError
    If doing an inequality check, i.e. method is not None.
zCannot compare dtypes z and r  r  )	rF  r  r   r%  onesr  r  rw  r4  )r   r  r  r   other_dtype
no_matchesr_  s          r   r  r    sz    6 .v6K4TZZLk]STT"''&,,bgg>>
 iiF277;G&&r   c                    U R                   $ )zz
Whether we should treat this as unique for the sake of
get_indexer vs get_indexer_non_unique.

For IntervalIndex compat.
r  r   s    r   rT  Index._index_as_unique  s     ~~r   z8Reindexing only valid with uniquely valued Index objectsc                R   [        U [        5      (       ax  [        U[        5      (       ac  U R                  bT  UR                  bG  [        U R                  UR                  5      (       d"  U R	                  S5      UR	                  S5      4$ GOU R
                  S:X  a)  [        U[        5      (       a   [        U5      " U 5      U4$ U R
                  S:X  a(  [        U[        5      (       a  [        U5      " U 5      U4$ U R                  R                  S:X  aK  UR                  R                  S:X  a1  UR                  5       S:  a  XR                  U R                  5      4$ O=U R                  (       a,  UR                  (       d   [        U 5      R                  U5      n['        U R                  5      (       d-  ['        UR                  5      (       a  UR)                  U 5      u  pX4$ ! [         a    X4s $ f = f! [        [         4 a    [#        U R$                  5      n  Nf = f)z
When dealing with an object-dtype Index and a non-object Index, see
if we can upcast the object-dtype one to improve performance.
r:  date	timedeltaur  r   )r  r^   r;  r   r<  r   rS  r   rd   r   r(  minr$  r^  r3  r  r6  r   r'  rM   r  r  s     r   r  "Index._maybe_downcast_for_indexing  s    d,--*UDT2U2U#HH("477EHH55 u-u/?/?/FFF6)j@P.Q.Q#E{4(%// ;.:eEV3W3W;t$e++ZZ__#(8(8C(?yy{a \\$**555  
 ^^EOO+T
..u5
 tzz**u{{/K/K<<TBKE{3 ' #{"#" z* +T\\*+s$   4G+ G> +G;:G;>%H&%H&c                    [        U5      u  p#U R                  S:X  d  US:X  a0  [        U R                  5      (       d  [        U5      (       a  [        $ [	        U R                  U5      n[        X/U5      nU$ )zS
Implementation of find_common_type that adjusts for Index-specific
special cases.
uint64)r>   r   rO   r+  r=   r<   )r   r  target_dtypero  r   s        r   rG  Index._find_common_type_compat  so     +62 ::!\X%=&tzz226M7 7 "! V4/Fr   c                   UR                   S:X  a  [        U R                  5      (       d*  U R                   S:X  a  [        UR                  5      (       a  g[        U5      nU R	                  U5      =(       d    [        U5      $ )z;
Check if `self == other` can ever have non-False entries.
r   F)r   rD   r   rF  _is_comparable_dtyperM   )r   r   r   s      r   rg  Index._should_compare  sh     9,1J4::1V1V)+0I%++0V0V
 $U+((/I?53IIr   c                    U R                   R                  S:X  a  UR                  S:H  $ [        U R                   5      (       a  [        U5      $ g)z6
Can we compare values of the given dtype to our own?
bT)r   r(  rL   r
  s     r   r/  Index._is_comparable_dtype  sB     ::??c!::$$djj))#E** r   c                   [        U[        5      (       a  UR                  n[        U5      nUR	                  5       nUR                  5        VVs0 s H  u  p4X0R                  U5      _M     nnn[        U5      $ s  snnf )z
Group the index labels by a given array of values.

Parameters
----------
values : array
    Values used to determine the groups.

Returns
-------
dict
    {group name -> group labels}
)r  r`   r'  rq   _reverse_indexerr  r  r   )r   rY  rA  r  r  s        r   rx  Index.groupby  sj    " fm,,^^FV$((* /5lln=nda!YYq\/n=&!! >s   A;c                .   SSK Jn  U R                  XS9nUR                  (       au  [	        US   [
        5      (       a]  [	        X5      (       a  U R                  nO0U R                  (       a  U R                  /[        US   5      -  nOSnUR                  " XES9$ SnUR                  (       d  U R                  n[        R                  " USS9U R                  :H  nU(       a  [        X@R                  US9n[        R!                  XFSU R                  S	9$ )
aN  
Map values using an input mapping or function.

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

Returns
-------
Union[Index, MultiIndex]
    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.

Examples
--------
>>> idx = pd.Index([1, 2, 3])
>>> idx.map({1: 'a', 2: 'b', 3: 'c'})
Index(['a', 'b', 'c'], dtype='object')

Using `map` with a function:

>>> idx = pd.Index([1, 2, 3])
>>> idx.map('I am a {}'.format)
Index(['I am a 1', 'I am a 2', 'I am a 3'], dtype='object')

>>> idx = pd.Index(['a', 'b', 'c'])
>>> idx.map(lambda x: x.upper())
Index(['A', 'B', 'C'], dtype='object')
r   r  )	na_actionNr  Fr  )
same_dtyper  )r2  r   _map_valuesr  r  r  r  r   r4  r3  r   r   r  r   r?   r   rb  )r   mapperr8  r   r  r  r   r9  s           r   r>  	Index.map6  s    F 	9%%f%B
 ??z*Q-??$++

c*Q-&88))*BBJJE
 __Z>$BTBTT
4JJ:J   u499 UUr   c                  [        U [        5      (       av  [        U R                  5       Vs/ s H<  nX2:X  d  Uc   U R	                  U5      R                  U5      OU R	                  U5      PM>     nn[        U 5      R                  U5      $ U  Vs/ s H
  oQ" U5      PM     nn[        X`R                  SS9$ s  snf s  snf )z
Apply function to all values found in index.

This includes transforming multiindex entries separately.
Only apply function to one level of the MultiIndex if level is specified.
F)r   r>  )
r  r`   r#  rz  get_level_valuesr>  rS  from_arraysr   r   )r   funcr   r  rY  r  r  s          r   _transform_indexIndex._transform_indexx  s     dM**
 t||,	 -A : %%a(,,T2**1-. -	   :))&11&*+dT!WdE+YYeDD ,s   AB7B<c                l    Ub  U R                  U5        [        R                  " U R                  U5      $ )a  
Return a boolean array where the index values are in `values`.

Compute boolean array of whether each index value is found in the
passed set of values. The length of the returned boolean array matches
the length of the index.

Parameters
----------
values : set or list-like
    Sought values.
level : str or int, optional
    Name or position of the index level to use (if the index is a
    `MultiIndex`).

Returns
-------
np.ndarray[bool]
    NumPy array of boolean values.

See Also
--------
Series.isin : Same for Series.
DataFrame.isin : Same method for DataFrames.

Notes
-----
In the case of `MultiIndex` you must either specify `values` as a
list-like object containing tuples that are the same length as the
number of levels, or specify `level`. Otherwise it will raise a
``ValueError``.

If `level` is specified:

- if it is the name of one *and only one* index level, use that level;
- otherwise it should be a number indicating level position.

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

Check whether each index value in a list of values.

>>> idx.isin([1, 4])
array([ True, False, False])

>>> midx = pd.MultiIndex.from_arrays([[1,2,3],
...                                  ['red', 'blue', 'green']],
...                                  names=('number', 'color'))
>>> midx
MultiIndex([(1,   'red'),
            (2,  'blue'),
            (3, 'green')],
           names=['number', 'color'])

Check whether the strings in the 'color' level of the MultiIndex
are in a list of colors.

>>> midx.isin(['red', 'orange', 'yellow'], level='color')
array([ True, False, False])

To check across the levels of a MultiIndex, pass a list of tuples:

>>> midx.isin([(1, 'red'), (3, 'red')])
array([ True, False, False])
)r  r   isinr'  r~  s      r   rD  
Index.isin  s.    J &&u-zz$,,//r   c                    [         er   )rI  r  s     r   _get_string_sliceIndex._get_string_slice  s
     "!r   c                    U R                  XUS9u  pE[        U5      (       d  [        S5      e[        U5      (       d  [        S5      e[        XEU5      $ )a  
Compute the slice indexer for input labels and step.

Index needs to be ordered and unique.

Parameters
----------
start : label, default None
    If None, defaults to the beginning.
end : label, default None
    If None, defaults to the end.
step : int, default None

Returns
-------
slice

Raises
------
KeyError : If key does not exist, or key is not unique and index is
    not ordered.

Notes
-----
This function assumes that the data is sorted, so use at your own peril

Examples
--------
This is a method on all index types. For example you can do:

>>> idx = pd.Index(list('abcd'))
>>> idx.slice_indexer(start='b', end='c')
slice(1, 3, None)

>>> idx = pd.MultiIndex.from_arrays([list('abcd'), list('efgh')])
>>> idx.slice_indexer(start='b', end=('c', 'g'))
slice(1, 3, None)
)r  zStart slice bound is non-scalarzEnd slice bound is non-scalar)
slice_locsrN   AssertionErrorr  )r   r  endr  start_slice	end_slices         r   r  Index.slice_indexer  sW    X "&$!G %% !BCC## !@AA[T22r   c                    U$ )z`
If we have a float key and are not a floating index, then try to cast
to an int if equivalent.
r  r  s     r   r  Index._maybe_cast_indexer  s	    
 
r   c                    [        U5      $ )zD
Analogue to maybe_cast_indexer for get_indexer instead of get_loc.
)r  r  s     r   r  "Index._maybe_cast_listlike_indexer  s     F##r   c                ^    [         R                  " U5      (       d  U R                  X5        gg)zb
If we are positional indexer, validate that we have appropriate
typed bounds must be an integer.
N)r   is_int_or_noner  )r   r  r  r(  s       r   r  Index._validate_indexer  s(     !!#&&''2 'r   c                    [        U R                  5      (       a  U R                  U5      $ [        U5      (       d  [	        U5      (       a  X;  a  U R                  SU5        U$ )aY  
This function should be overloaded in subclasses that allow non-trivial
casting on label-slice bounds, e.g. datetime-like indices allowing
strings containing formatted datetimes.

Parameters
----------
label : object
side : {'left', 'right'}

Returns
-------
label : object

Notes
-----
Value of `side` parameter should be validated in caller.
r  )rL   r   r  rG   rI   r  )r   ru  r  s      r   _maybe_cast_slice_boundIndex._maybe_cast_slice_bound+  sS    . DJJ''++E22 UOOz%00e6G''7r   c                    U R                   (       a  U R                  XS9$ U R                  (       a+  U S S S2   R                  XS:X  a  SOSS9n[        U 5      U-
  $ [	        S5      e)Nr  r  r   r>  r  )r  r  r  r4  r6  )r   ru  r  poss       r   r  Index._searchsorted_monotonicK  sn    ''$$U$66)) tt*))v~G6 * C t9s?"KLLr   c                   US;  a  [        SU 35      eUnU R                  X5      n U R                  U5      n[        U[        R                  5      (       az  [        UR                  5      (       d   e[        R                  " UR                  S5      5      n[        U[        R                  5      (       a  [        SU S[        U5       35      e[        U[        5      (       a  US:X  a  UR                  $ UR                   $ US:X  a  US	-   $ U$ ! [         a,  n U R	                  X5      s SnA$ ! [          a    Uef = fSnAff = f)
a  
Calculate slice bound that corresponds to given label.

Returns leftmost (one-past-the-rightmost if ``side=='right'``) position
of given label.

Parameters
----------
label : object
side : {'left', 'right'}

Returns
-------
int
    Index of label.

See Also
--------
Index.get_loc : Get integer location, slice or boolean mask for requested
    label.

Examples
--------
>>> idx = pd.RangeIndex(5)
>>> idx.get_slice_bound(3, 'left')
3

>>> idx.get_slice_bound(3, 'right')
4

If ``label`` is non-unique in the index, an error will be raised.

>>> idx_duplicate = pd.Index(['a', 'b', 'a', 'c', 'd'])
>>> idx_duplicate.get_slice_bound('a', 'left')
Traceback (most recent call last):
KeyError: Cannot get left slice bound for non-unique label: 'a'
r@  z@Invalid value for side kwarg, must be either 'left' or 'right': Nu1zCannot get z# slice bound for non-unique label: r   r>  rF  )r6  rX  r  r  r  r  r%  r&  rE   r   r   maybe_booleans_to_slicer  r  r  r  r  )r   ru  r  original_labelslcrC  s         r   get_slice_boundIndex.get_slice_boundY  sK   N ((&&*V- 
  ,,U9	,,u%C c2::&& !++++--chhtn=C#rzz**!$ (">235 
 c5!!v~yy xxwQw
7  	33E@@ 		s)   D 
E	D4.E	4EEE	c                T   USL =(       d    US:  nU(       d  X!p![        U[        [        45      (       ac  [        U[        [        45      (       aH   [        U5      n[        U5      n[	        UR
                  UR
                  5      (       d  [        S5      e SnUb  U R                  US5      nUc  SnSnUb  U R                  US5      nUc  [        U 5      nU(       d1  US-
  US-
  pxUS:X  a  U[        U 5      -  nUS:X  a  U[        U 5      -  nXx4$ ! [        [        4 a     Nf = f)a  
Compute slice locations for input labels.

Parameters
----------
start : label, default None
    If None, defaults to the beginning.
end : label, default None
    If None, defaults to the end.
step : int, defaults None
    If None, defaults to 1.

Returns
-------
tuple[int, int]

See Also
--------
Index.get_loc : Get location for a single label.

Notes
-----
This method only works if the index is monotonic or unique.

Examples
--------
>>> idx = pd.Index(list('abcd'))
>>> idx.slice_locs(start='b', end='c')
(1, 3)
Nr   z(Both dates must have the same UTC offsetr   r>  rF  r  )
r  r   r   r   r   tzinfor6  r  rb  r4  )	r   r  rL  r  incts_startts_endrM  rN  s	            r   rJ  Index.slice_locs  s<   > dl'dai3 ec8_--*S3/2R2RQ$U+"3 "(//6==AA$%OPP B ..uf=KK	?,,S':ID	I &11_i!m{
 BSY&	b s4y(%%W 	* s   D D'&D'c                    U R                   n[        U[        R                  5      (       a  [        R                  " X!5      nOUR	                  U5      nU R
                  R                  X0R                  S9$ )aH  
Make new Index with passed location(-s) deleted.

Parameters
----------
loc : int or list of int
    Location of item(-s) which will be deleted.
    Use a list of locations to delete more than one value at the same time.

Returns
-------
Index
    Will be same type as self, except for RangeIndex.

See Also
--------
numpy.delete : Delete any rows and column from NumPy array (ndarray).

Examples
--------
>>> idx = pd.Index(['a', 'b', 'c'])
>>> idx.delete(1)
Index(['a', 'c'], dtype='object')

>>> idx = pd.Index(['a', 'b', 'c'])
>>> idx.delete([0, 2])
Index(['b'], dtype='object')
r]  )r'  r  r%  r&  deletere  r9  r   )r   r  rY  r  s       r   rk  Index.delete  sZ    : fbjj))6/Js+J   ,,Zii,HHr   c                   [         R                  " U5      n[        X R                  5      (       a   U R                  [        :w  a  U R
                  nU R                  n [        U[        5      (       a3  UR                  X5      n[        U 5      R                  X@R                  S9$ U R                  U5      n UR                  [        :w  d4  [        U[&        [(        R*                  [(        R,                  45      (       d3  UR                  R                  U5      n[(        R                  " X1U5      nO([(        R                  " X1S5      nUS:  a  UOUS-
  nX'U'   [.        R1                  XpR                  S9n[3        5       (       aI  [5        UR                  5      (       a/  UR                  [        :X  a  UR%                  UR                  5      nU R                  [        :X  a6  UR                  [        :w  a"  [6        R8                  " S[:        [=        5       S9  U$ ! [        [        [         4 a4    U R#                  U5      nU R%                  U5      R                  X5      s $ f = f)a,  
Make new Index inserting new item at location.

Follows Python numpy.insert semantics for negative values.

Parameters
----------
loc : int
item : object

Returns
-------
Index

Examples
--------
>>> idx = pd.Index(['a', 'b', 'c'])
>>> idx.insert(1, 'x')
Index(['a', 'x', 'b', 'c'], dtype='object')
r]  Nr   rF  zThe behavior of Index.insert with object-dtype is deprecated, in a future version this will return an object-dtype Index instead of inferring a non-object dtype. To retain the old behavior, do `idx.insert(loc, item).infer_objects(copy=False)`r  )r   r  rg   r   r   r  r'  r  rs   insertrS  r9  r   r  r  r6  r:   rG  r$  r  r%  
datetime64timedelta64r   rb  r   rP   r;  r<  r=  r6   )	r   r  r  rB  r  r   castedr  r}  s	            r   rn  Index.insert,  s   * $$T* zz22tzzV7K>>Dll	8#~.. ZZ2
Dz--jyy-II006 99j5"--8'
 '
 YY^^D)F3V4J
 3T2J#sQwC"sO
;&((		**  F***Z--.C::CII$7MMQ +- 
Q :'89 	8 11$7E;;u%,,S77	8s   AH &H AI%$I%c                F   [        U[        5      (       d(  U R                  S:X  a  SOSn[        R                  " XS9nU R                  U5      nUS:H  nUR                  5       (       a)  US:w  a  [        X   R                  5        S35      eXE)    nU R                  U5      $ )a  
Make new Index with passed list of labels deleted.

Parameters
----------
labels : array-like or scalar
errors : {'ignore', 'raise'}, default 'raise'
    If 'ignore', suppress error and existing labels are dropped.

Returns
-------
Index
    Will be same type as self, except for RangeIndex.

Raises
------
KeyError
    If not all of the labels are found in the selected axis

Examples
--------
>>> idx = pd.Index(['a', 'b', 'c'])
>>> idx.drop(['a'])
Index(['b', 'c'], dtype='object')
r   Nr  r  ignorez not found in axis)
r  r   r   r)  index_labels_to_arrayrx  r  r  tolistrk  )r   r   errors	arr_dtyper^  r  s         r   drop
Index.dropw  s    < &%(($(JJ($:I..vGF&&v."}88::!&,"5"5"7!88JKLLenG{{7##r   c                   U R                   (       a  [        S5      eU R                  [        :w  a  U(       a  U R	                  5       $ U $ U R
                  n[        SU5      n[        R                  " USS9nU(       a  X2L a  U R	                  5       $ [        X0R                  S9nU(       d=  X2L a9  U R                  b,  U R                  Ul        UR                  R                  U5        U$ )z
If we have an object dtype, try to infer a non-object dtype.

Parameters
----------
copy : bool, default True
    Whether to make a copy in cases where no inference occurs.
z^infer_objects is not implemented for MultiIndex. Use index.to_frame().infer_objects() instead.npt.NDArray[np.object_]T)convert_non_numericr]  )r^  rI  r   r   r  r'  r   r   r_  r   r   r"  rX  )r   r  rY  r  rA  s        r   infer_objectsIndex.infer_objects  s     >>%@  ::"&499;0D0/8.. $

 J(99;z		2
,1A1A1M!%!1!1F226:r   c                R    [        U R                  5       R                  U5      5      $ )aH  
Computes the difference between consecutive values in the Index object.

If periods is greater than 1, computes the difference between values that
are `periods` number of positions apart.

Parameters
----------
periods : int, optional
    The number of positions between the current and previous
    value to compute the difference with. Default is 1.

Returns
-------
Index
    A new Index object with the computed differences.

Examples
--------
>>> import pandas as pd
>>> idx = pd.Index([10, 20, 30, 40, 50])
>>> idx.diff()
Index([nan, 10.0, 10.0, 10.0, 10.0], dtype='float64')

)r   rd  r  )r   r  s     r   r  
Index.diff  s!    6 T^^%**7344r   c                ^    U R                  U R                  5       R                  U5      5      $ )a  
Round each value in the Index to the given number of decimals.

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

Returns
-------
Index
    A new Index with the rounded values.

Examples
--------
>>> import pandas as pd
>>> idx = pd.Index([10.1234, 20.5678, 30.9123, 40.4567, 50.7890])
>>> idx.round(decimals=2)
Index([10.12, 20.57, 30.91, 40.46, 50.79], dtype='float64')

)re  rd  round)r   decimalss     r   r  Index.round  s'    0   !1!7!7!ABBr   c                   U R                  U5      (       a  U[        R                  [        R                  [        R                  1;   a\  [
        R                  " [        U 5      [        S9nU R                  (       a'  [        U [        5      (       d  SX0R                  5       '   U$ U[        R                  L a\  [
        R                  " [        U 5      [        S9nU R                  (       a'  [        U [        5      (       d  SX0R                  5       '   U$ [        U[
        R                  [         ["        [$        45      (       a#  [        U 5      [        U5      :w  a  ['        S5      e[        U[        5      (       d  [)        USS9nO[
        R*                  " U5      n[-        U R.                  5      (       a*  [        U[$        5      (       a  U" U R0                  U5      nU$ [        U R0                  [$        5      (       a  U" U R0                  U5      nU$ [-        U R.                  5      (       a8  [        U [        5      (       d#  [2        R4                  " X R0                  U5      nU$ [2        R6                  " U R0                  X5      nU$ )z1
Wrapper used to dispatch comparison operations.
r  FTzLengths must match to compare)extract_numpy)r  r  eqr  ger%  r  r4  r   r  r  r`   rh   ner)  r&  r   rc   rs   r6  rz   r.  rM   r   r'  rk   comp_method_OBJECT_ARRAYcomparison_op)r   r   r  rB  rA  s        r   _cmp_methodIndex._cmp_method  s    88E??hkk8;;<<ggc$it4$$Zm-L-L',C		$
x{{"hhs4y5$$Zm-L-L'+C		$
ebjj%NKLLQTR
ZR <==%//!%t<EJJu%E4::&&:e^+L+Le,F  n55e,F  TZZ((D-1P1P11"llEJF
  &&t||U?Fr   c                    [         R                  " X5      nU R                  n[        USSS9n[         R                  " XEU5      nU R                  XcS9$ )NT)r  extract_ranger]  )rk   r   r'  rz   
logical_op_construct_result)r   r   r  res_namelvaluesrvaluesr  s          r   _logical_methodIndex._logical_method(  sM    ))$6,,TN^^Gb9
%%j%@@r   c                    [        U[        5      (       a4  [        US   X!S   R                  S9[        US   X!S   R                  S94$ [        XUR                  S9$ )Nr   r  rF  )r  r  r   r   )r   rA  r   s      r   r  Index._construct_result2  sX    fe$$fQid)//BfQid)//B  Vfll;;r   c                   > [        U[        5      (       a2  [        UR                  5      (       a  [	        U5      [        La  [
        $ [        TU ]  X5      $ r   )r  r   rM   r   rS  r  r"  _arith_method)r   r   r  r#  s      r   r  Index._arith_method;  sC    ue$$,,U5(
 "!w$U//r   c                L    U" U R                   5      n[        X R                  S9$ rc  )r'  r   r   )r   r  rA  s      r   _unary_methodIndex._unary_methodH  s    DLL!V)),,r   c                @    U R                  [        R                  5      $ r   )r  r  r  r   s    r   __abs__Index.__abs__M      !!(,,//r   c                @    U R                  [        R                  5      $ r   )r  r  negr   s    r   __neg__Index.__neg__P  r  r   c                @    U R                  [        R                  5      $ r   )r  r  r[  r   s    r   __pos__Index.__pos__S  r  r   c                @    U R                  [        R                  5      $ r   )r  r  invr   s    r   
__invert__Index.__invert__V  s    !!(,,//r   c                    [         R                  " X5        U R                  S5        U R                  n[	        U[
        R                  5      (       d  UR                  S5      $ [
        R                  " U5      $ )a  
Return whether any element is Truthy.

Parameters
----------
*args
    Required for compatibility with numpy.
**kwargs
    Required for compatibility with numpy.

Returns
-------
bool or array-like (if axis is specified)
    A single element array-like may be converted to bool.

See Also
--------
Index.all : Return whether all elements are True.
Series.all : Return whether all elements are True.

Notes
-----
Not a Number (NaN), positive infinity and negative infinity
evaluate to True because these are not equal to zero.

Examples
--------
>>> index = pd.Index([0, 1, 2])
>>> index.any()
True

>>> index = pd.Index([0, 0, 0])
>>> index.any()
False
r  )	r  validate_any_maybe_disable_logical_methodsr'  r  r%  r&  _reducer  r   r`  ra  r  s       r   r  	Index.any]  sX    H 	%++E2||$

++ <<&&vvd|r   c                    [         R                  " X5        U R                  S5        U R                  n[	        U[
        R                  5      (       d  UR                  S5      $ [
        R                  " U5      $ )a  
Return whether all elements are Truthy.

Parameters
----------
*args
    Required for compatibility with numpy.
**kwargs
    Required for compatibility with numpy.

Returns
-------
bool or array-like (if axis is specified)
    A single element array-like may be converted to bool.

See Also
--------
Index.any : Return whether any element in an Index is True.
Series.any : Return whether any element in a Series is True.
Series.all : Return whether all elements in a Series are True.

Notes
-----
Not a Number (NaN), positive infinity and negative infinity
evaluate to True because these are not equal to zero.

Examples
--------
True, because nonzero integers are considered True.

>>> pd.Index([1, 2, 3]).all()
True

False, because ``0`` is considered False.

>>> pd.Index([0, 1, 2]).all()
False
r1  )	r  validate_allr  r'  r  r%  r&  r  r1  r  s       r   r1  	Index.all  sX    N 	%++E2||$

++ <<&&vvd|r   c                    [        U [        5      (       d4  [        U R                  5      (       a-  U R                  R                  S:w  a  [        U5      " U 5        ggg)z;
raise if this Index subclass does not support any or all.
rN  N)r  r`   rQ   r   r(  r   )r   opnames     r   r  $Index._maybe_disable_logical_methods  sI     t]++ $DJJ//DJJOOs4J F#D) 5K/r   c                ~  > [         R                  " X45        [         R                  " U5        U R                  (       ds  U R                  (       ab  U R
                  nU(       a  UR                  5       (       a:  [        R                  " S[        U 5      R                   S3[        [        5       S9  g[        TU ]9  US9$ NzThe behavior of zx.argmax/argmin with skipna=False and NAs, or with all-NAs is deprecated. In a future version this will raise ValueError.r  r  r  )r  validate_argminvalidate_minmax_axisr^  r  r  r1  r;  r<  rS  r  r=  r6   r"  argminr   r  r  r`  ra  r  r#  s         r   r  Index.argmin      
4(
%~~$,,;;DTXXZZ&tDz':':&; <F F "/1 w~V~,,r   c                ~  > [         R                  " X45        [         R                  " U5        U R                  (       ds  U R                  (       ab  U R
                  nU(       a  UR                  5       (       a:  [        R                  " S[        U 5      R                   S3[        [        5       S9  g[        TU ]9  US9$ r  )r  validate_argmaxr  r^  r  r  r1  r;  r<  rS  r  r=  r6   r"  r  r  s         r   r  Index.argmax  r  r   c                   [         R                  " X45        [         R                  " U5        [        U 5      (       d  U R                  $ [        U 5      (       a(  U R
                  (       a  U S   n[        U5      (       d  U$ U R                  (       dE  U R                  (       a4  U R                  nU(       a  UR                  5       (       a  U R                  $ U R                  (       dC  [        U R                  [        R                  5      (       d  U R                  R                  SUS9$ [         R"                  " U R                  US9$ )a  
Return the minimum value of the Index.

Parameters
----------
axis : {None}
    Dummy argument for consistency with Series.
skipna : bool, default True
    Exclude NA/null values when showing the result.
*args, **kwargs
    Additional arguments and keywords for compatibility with NumPy.

Returns
-------
scalar
    Minimum value.

See Also
--------
Index.max : Return the maximum value of the object.
Series.min : Return the minimum value in a Series.
DataFrame.min : Return the minimum values in a DataFrame.

Examples
--------
>>> idx = pd.Index([3, 2, 1])
>>> idx.min()
1

>>> idx = pd.Index(['c', 'b', 'a'])
>>> idx.min()
'a'

For a MultiIndex, the minimum is determined lexicographically.

>>> idx = pd.MultiIndex.from_product([('a', 'b'), (2, 1)])
>>> idx.min()
('a', 1)
r   r(  r   r  r  )r  validate_minr  r4  r  r  rh   r^  r  r  r1  r  r'  r%  r&  r  rj   nanmin)r   r  r  r`  ra  rq  r  s          r   r(  	Index.min  s    P 	%
%4yy>>!t9955GE;;~~$,,;;DTXXZZ~~%~~jrzz&J&J<<''U6'BB}}T\\&99r   c                   [         R                  " X45        [         R                  " U5        [        U 5      (       d  U R                  $ [        U 5      (       a(  U R
                  (       a  U S   n[        U5      (       d  U$ U R                  (       dE  U R                  (       a4  U R                  nU(       a  UR                  5       (       a  U R                  $ U R                  (       dC  [        U R                  [        R                  5      (       d  U R                  R                  SUS9$ [         R"                  " U R                  US9$ )a  
Return the maximum value of the Index.

Parameters
----------
axis : int, optional
    For compatibility with NumPy. Only 0 or None are allowed.
skipna : bool, default True
    Exclude NA/null values when showing the result.
*args, **kwargs
    Additional arguments and keywords for compatibility with NumPy.

Returns
-------
scalar
    Maximum value.

See Also
--------
Index.min : Return the minimum value in an Index.
Series.max : Return the maximum value in a Series.
DataFrame.max : Return the maximum values in a DataFrame.

Examples
--------
>>> idx = pd.Index([3, 2, 1])
>>> idx.max()
3

>>> idx = pd.Index(['c', 'b', 'a'])
>>> idx.max()
'c'

For a MultiIndex, the maximum is determined lexicographically.

>>> idx = pd.MultiIndex.from_product([('a', 'b'), (2, 1)])
>>> idx.max()
('b', 2)
r  ru  r  r  )r  validate_maxr  r4  r  r  rh   r^  r  r  r1  r  r'  r%  r&  r  rj   nanmax)r   r  r  r`  ra  lastr  s          r   ru  	Index.max-  s    R 	%
%4yy>>!t99558D::~~$,,;;DTXXZZ~~%~~jrzz&J&J<<''U6'BB}}T\\&99r   c                    [        U 5      4$ )z
Return a tuple of the shape of the underlying data.

Examples
--------
>>> idx = pd.Index([1, 2, 3])
>>> idx
Index([1, 2, 3], dtype='int64')
>>> idx.shape
(3,)
)r4  r   s    r   r  Index.shapeo  s     D	|r   )r   r   )r   r,   rr  rs  )r   r,   rr  z<tuple[ArrayLike, npt.NDArray[np.intp], npt.NDArray[np.intp]])rr  r   )rr  z5type[libindex.IndexEngine | libindex.ExtensionEngine])NNFNT)r  r   r>  r   rr  r,   )r  r   )r   r$   )NN)rY  r    r   Hashable | Nonerr  r,   )rr  z
type[Self])rr  None)rr  r   )r   r   rr  r,   )rr  r,   )rr  zLlibindex.IndexEngine | libindex.ExtensionEngine | libindex.MaskedIndexEngine)rr  z
set[str_t])rr  ru  )rr  r   )r  znp.ufuncr  str_t)NF)rr  r$   )C)r  r  rr  r,   r   )T)r   TN)r  r"   r  r   rr  r,   )r  r   rr  r   )r  r  rr  r,   )r   r  r  r   rr  r,   )rr  r  )rr  z-list[tuple[str_t, str_t | int | bool | None]])rr  zHashable | Sequence[Hashable])FNr3  )r   r   r@  Callable | Noner=  r  rr  list[str_t])rE  r   r@  r  rr  r  )r<  r  r=  r  rr  r  )r=  r  rQ  r  rr  r|  )r   r  rr  r   )r   r   r   r   rr  r   rr  r   )rl  r   rr  r  )NNF)r  r   rr  list[Hashable])r  z$Hashable | Sequence[Hashable] | Nonerr  r  )rr  r~   )r   Literal[False]rr  r,   )r   Literal[True]rr  r  )r   r   rr  zSelf | NoneF)NTNrq  )r  zbool | list[bool]r  r*   rr  r   )r   )r   r'   )r  z	list[int])rr  npt.NDArray[np.bool_])r  )r   r   rr  r,   )r   r  rr  r,   )rs  r#   rr  r,   )rq  )rs  r#   rr  r  )rr  r   )r   r   r=  r  rr  tuple[Index, Index])r   r   r   bool | None)r   r   rr  r   )r   r   )r   r   r   r   )r   zIndex | MultiIndexrr  zArrayLike | MultiIndex)rr  ztuple[Index, Hashable])NNN)r  ReindexMethod | Noner  
int | Nonerr  rs  )r  r   r  str_t | Noner  r  rr  rs  )r  r   rr  r   )r  r  r  r  rr  r  )r  znp.ndarray | Indexrr  r   )r  r   r  r  r  r  rr  rs  )r  r   r  r  rr  rs  )r  r   r^  rs  rr  rs  )r  r   r^  rs  rr  r    )r  r  rr  r  )r  r  r(  zLiteral['loc', 'getitem'])r  zLiteral['slice', 'positional']r  z lib.NoDefault | None | Exceptionrr  r  )r^  r   rr  r  )NNNN)r  r  r  r  r  zfloat | Nonerr  z)tuple[Index, npt.NDArray[np.intp] | None])r  r   )r  r   r  r   )r  r   rr  z?tuple[Index, npt.NDArray[np.intp], npt.NDArray[np.intp] | None])r   r   r   r(   r   r)   r   r  r   r   rr  Ftuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None])r   r   r   r(   r   r)   r   r  r   r   rr  r   )r   r   r   r(   r   r)   r   r   r   r   rr  NIndex | tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None])r   r   r   r(   r   zLevel | Noner   r   r   r   rr  r  )r   r   r   r(   r   r   rr  r  )r   r   r   r(   )r   F)r   r   r   r(   r   r   rr  z8tuple[Index, npt.NDArray[np.intp], npt.NDArray[np.intp]])r   T)r   r   r   r(   r  r   rr  zKtuple[MultiIndex, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None])r   )r   r   r   r(   rr  r  )
r   r    r   r,   r   rs  r   rs  rr  r,   )rr  r    )rr  rs   )rr  r   )rA  r   rr  r    )r  r   rr  ru  )r  r   rr  r   )r  r  rr  r,   )r   zIndex | Sequence[Index]rr  r   )r  zlist[Index]r   r   rr  r   )r   r   rr  r   )r  r   r  r  rr  rs  )
r  r  r  r   r  r*   r  r  rr  r,   )
r  r  r  r   r  r*   r  r  rr  ztuple[Self, np.ndarray])
r  r   r  r   r  r*   r  r  rr  zSelf | tuple[Self, np.ndarray])FTr  NrF  N)r  ru  )rr  rs  )rr  1tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]])r  r  rr  ztuple[Index, np.ndarray])r  r  rr  r  ).)r  r   r   r  rr  rs  )r  r   r   r  rr  r  )r  r   r   r   rr  zHnpt.NDArray[np.intp] | tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]])r   r   rr  r  )r   r   rr  r   )r   r$   rr  r   )rr  z PrettyDict[Hashable, np.ndarray])r8  zLiteral['ignore'] | None)r  r  )r  r  rL  r  r  r  rr  r  )r  zLiteral['positional', 'slice']r(  zLiteral['getitem', 'iloc']rr  r  )r  r  )r  Literal['left', 'right'])r  r  rr  ru  )rr  ztuple[int, int])r  ru  rr  r   )raise)r   z'Index | np.ndarray | Iterable[Hashable]rw  r&   rr  r   )r  r   rr  r   )rF  )r  ru  rr  r   )r  ru  rr  r,   )r  r  rr  r  rN  )r  r   rr  ru  )r  r   )rr  r-   ("  r  
__module____qualname____firstlineno____doc____pandas_priority__r   r   r   r   r   r   __annotations__r%  r&  rs   r   r   r   r   r   r   r3   r   r   int8r  
Int8Engineint16Int16Engineint32Int32Engineint64Int64Engineuint8UInt8Engineuint16UInt16Engineuint32UInt32Enginer+  UInt64Enginer  Float32Enginefloat64Float64Enginer  r  r  r  r   propertyr  !_supports_partial_string_indexing
_accessorsrl   r   r   r"  r   classmethodr8  r7  r9  rb  re  rm  rj  r   r  r  r  r  rW  r  r  r  r  r  r  r  r  r  r$  r   r2   r   r  r  r  r  r  r  r  r  r  r  r.  r1  rA  rD  rF  r?  rW  r^  ra  rd  r   r|  r   setterr  rx  r{  r  r  r   r  r  r4   rz  r  r  r  r  r  r>  r  r  r  r  r  r  r  ri  r  r  rI   r  r  r  r  r  r  r  r   r   r^  r  r  r  r  rh   isnullr  notnullr  r  r   r&  r   r-  r0  __bool__r3  r7  r?  rB  rI  rJ  rf  rh  ri  rm  r  r~  r  r  rD  rE  r  rU  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r)  r   r   r7  r=  r6  r<  r  r;  r  rO  rY  r5   rw   r5  r'  r  r   r   r  r  r  r,  r  r  r  r  r  r  r  r)  r  r  rH  r  r  r  r  r   r  rA  r  r  rX  rx  r  r  r  rT  r  r  rG  rg  r/  rx  r>  rA  rD  rG  r  r  r  r  rX  r  rb  rJ  rk  rn  ry  r~  r  r  r  r  r  r  r  r  r  r  r  r  r1  r  r  r  r(  ru  r  __static_attributes____classcell__)r#  s   @r   r   r   @  s   1j  8 8 ""	E" " ""	E" " ""	E" " D#&&


WIS  CE8 #d"%hL)&$XK%0 0 	8..
H00
H00
H00
H00
X22
X22
X22
h44
h44
 8 8
!:!:RMN  I	>I I ).%J

.CK "r 	r r 
rh  " )  )L CG&5	 0  "   + +( !. !.L 6@ J"   %) %)N   % % .0	U.0 .0` 

  

 3 3#+J - -      (!F? ?F 	 H  (+<<= D D 	D 
D >D:  0#	 N  *->>?I @I !%(( ( 
	(T # # $ $ 
. 
.   
 
2& 	9 	9 7 7 %)	FF #F 	F
 
F< O

 &*	T T #	T
 
T T,0 
 
 	
 
!
$!= !=L$ =C =C@ !3>>;;(0;	;@   
[[  27+/	 B KO!9!	!F( +/  6 *:6E(+s   (+   (+S   )-e g gR 8;     $VV$481717l    . '+"),
 %,

  ,
\%N )
11 11f 7 7x 
   4 4. 4 4. ?  ?  ?  ?   &  &D !"  !"F )1 )1V )1 )1V 1W 1Wf 1= 1=f .+ .+` 25 25h '2 '2R B B % % ; ; 
>  > /  /1   
 
  4 4 4l F
) )V G#.. 7r >"* "*H 3: 12 12f9+ 9+| 
 
 H
	    $ w6 w6rM^   S= S=j <6 '	 @ ;; ;;z	6O1b  
")V  (, DC %DC 	DC 
DC DCR  $ ,, , 	, 
,: 	 	  !	++ +
 
+ +Z$ PT%*3=	 @ @D%*3=	 B $.	 > << &<
 
< < &:	 ( ? ?Rh 
 58NN	, 2	
 
 ( P P& (, "&o %o
 o  o 
3ob E/E/	HE/ E/T 
 		 		
 	 '	 	 
P	 	 
 *-		 		
 	 (	 	 
	 	 
  #		 		
 	 	 	 
X	 	 
 " %d<d< 	d<
 d< d< d< 
Xd<  d<L &&!(&04&	O& &4  . .!( .04 .	O .  .D V Vp @E//!(/9=/	A/ /* MQR7R7(/R7FJR7	TR7 R7h +12&2&!(2&	O2& 2&hVV V #	V
 #V 
V, G  G8 + +Z 		    2 D  &	 		$	$% & %* %*P 
  
,+'X 
E E2Fh
  ""-H41*fa=F 
 
@ I IV??"7?	?B  *-"%" ' 	
    
  
 "%" & 	
    
!    #"%"  	
    
(  $VH=
  %"(#U U  U   	U 
 U  
(U U n Y Y;
 ;
z%3N) 	
 	
,	  `  !9:=NNO&J	:&J P&JP  .B!8F =@-:	 
 -;	: 
 48-1	Q 
 48%'%'-1%'	Q%' %'N   V
+ +Z  . J J(
 " "4?V ?VD .2 E E&G0 G0R" "&#	4343 43 	43
 
43 43l$ 3,3 )	3
 
3 3@M MQfV& V&p&IPI\ &)$7)$ )$ 
	)$ )$V   > 5 5 58 C C C8*X A A < <0 - -0000+Z.` * * m""**+- - ,-$ m""**+- - ,-$=: =:~>: >:D    r   c                v    SSK Jn  [        U 5      S:X  a  Ub  US   n[        U S   US9$ UR                  " XS9$ )a0  
Construct an index from sequences of data.

A single sequence returns an Index. Many sequences returns a
MultiIndex.

Parameters
----------
sequences : sequence of sequences
names : sequence of str

Returns
-------
index : Index or MultiIndex

Examples
--------
>>> ensure_index_from_sequences([[1, 2, 3]], names=["name"])
Index([1, 2, 3], dtype='int64', name='name')

>>> ensure_index_from_sequences([["a", "a"], ["a", "b"]], names=["L1", "L2"])
MultiIndex([('a', 'a'),
            ('a', 'b')],
           names=['L1', 'L2'])

See Also
--------
ensure_index
r   r  rF  r]  r  )r2  r   r4  r   r?  )	sequencesr  r   s      r   ensure_index_from_sequencesr    sD    < 5
9~!HEYq\..%%i==r   c                   [        U [        5      (       a  U(       a  U R                  5       n U $ [        U [        5      (       a  U R                  n[        XUS9$ [        U 5      (       a  [        U 5      n [        U [        5      (       aj  [        U 5      [        La  [        U 5      n [        U 5      (       a3  [        R                  " U 5      (       a  SSKJn  UR                  " U 5      $ [        XSS9$ [        XS9$ )a  
Ensure that we have an index from some index-like object.

Parameters
----------
index_like : sequence
    An Index or other sequence
copy : bool, default False

Returns
-------
index : Index or MultiIndex

See Also
--------
ensure_index_from_sequences

Examples
--------
>>> ensure_index(['a', 'b'])
Index(['a', 'b'], dtype='object')

>>> ensure_index([('a', 'a'),  ('b', 'c')])
Index([('a', 'a'), ('b', 'c')], dtype='object')

>>> ensure_index([['a', 'a'], ['b', 'c']])
MultiIndex([('a', 'b'),
        ('a', 'c')],
       )
)r   r  r   r  F)r  r>  r	  )r  r   r  rc   r   rJ   r0  rS  r4  r   is_all_arrayliker2  r   r?  )
index_liker  r   r   s       r   r  r    s    > *e$$#*J*i((Z66:*%
*d##
4' j)Jz??s33J??<))*55eDDZ++r   c                T     [        U 5        U $ ! [         a    [        U 5      s $ f = f)z4
If seq is an iterator, put its values into a list.
)r4  r  r0  )seqs    r   r  r    s0    C 
  Cys    ''c                    U (       d  U $ [        U 5      (       aT  [        S U  5       5      (       a=  U  Vs/ s H  oSS PM	     n n[        U 5      (       a  [        S U  5       5      (       a  M=  U $ s  snf )z
Trims zeros and decimal points.

Examples
--------
>>> trim_front([" a", " b"])
['a', 'b']

>>> trim_front([" a", " "])
['a', '']
c              3  0   #    U  H  oS    S:H  v   M     g7f)r    Nr  r&  s     r   r  trim_front.<locals>.<genexpr>  s     <Gqts{Gs   rF  N)r1  )stringsr  s     r   rL  rL    sb     
g,,3<G<<<")*'QQR5'* g,,3<G<<<N +s   A0c                ,    U S;  a  [        SU  35      eg )N)r   r>  rE  r2  zdo not recognize join method r6  r  s    r   r:  r:    s#    888ABB 9r   c                    U c'  [        U[        [        45      (       a  UR                  n [	        U 5      (       d  [        UR                   S35      eU $ )zJ
If no name is passed, then extract it from data, validating hashability.
z.name must be a hashable type)r  r   rc   r   rH   r  r  )r   r  r   s      r   r   r     sN     |
3	(:;; xx t3<<.(EFGGKr   c                     U  Vs/ s H  n[        UR                  5      PM     nn[        U6  Vs/ s H  n1 UkPM	     nn[        S U 5       5      nU$ s  snf s  snf )z
Return common name if all indices agree, otherwise None (level-by-level).

Parameters
----------
indexes : list of Index objects

Returns
-------
list
    A list representing the unanimous 'names' found.
c              3  d   #    U  H&  n[        U5      S :X  a  UR                  5       OSv   M(     g7fr  )r4  r   )r  nss     r   r  &get_unanimous_names.<locals>.<genexpr>'  s%     Iyc"gl"&&(4ys   .0)r  r  r   )indexesr  	name_tupsr  	name_setsr  s         r   get_unanimous_namesr"    s\     *11AqwwI1!,i!89!822!8I9IyIIEL 29s
   AAc                p   U R                   n[        U[        5      (       a  UR                  R                   $ [        U[        5      (       a_  SSKnUR                  R                  UR                  5      (       a1  U SS R                  [	        UR                  R                  5      5      n U R                   $ )z
When checking if our dtype is comparable with another, we need
to unpack CategoricalDtype to look at its categories.dtype.

Parameters
----------
other : Index

Returns
-------
np.dtype or ExtensionDtype
r   N)r   r  rV   r!  rU   r  r  is_dictionarypyarrow_dtyper$  
value_type)r   r   r  s      r   rF  rF  +  s     KKE%)** %%%	E:	&	&88!!%"5"566"1I$$Z0C0C0N0N%OPE;;r   c                    USLa   [         R                  " U 5      n U $ U $ ! [         a6  nUSL a  e [        R                  " U S3[
        [        5       S9   S nAU $ S nAff = f)NFTz3, sort order is undefined for incomparable objects.r  )r   	safe_sortr  r;  r<  RuntimeWarningr6   )rA  r   rC  s      r   rS  rS  F  sm    5	 __V,F M6M  	t|MM%JK+-
 M	s   ! 
A!+AA!r  rO  )r=  rT  rR  rQ  c          	        [        U [        5      (       aa  U R                  R                  R                  S;   a=  [
        R                  " U R                  R                  [        U R                  5      US9n [        U 5      n [        U [        [        45      (       a  U R                  S:X  a%  U R                  X!S9nUR                  [         SS9nU$ / n[#        [%        U 5      5       H;  nXSS24   R                  X!S9nUR'                  UR                  [         SS95        M=     [(        R*                  " U5      $ [        U R                  [,        5      (       a  [/        SU 5      n U R                  X!S9n	U	$ [        U R                  [0        5      (       am  [/        S	U 5      n U R3                  5       n
U(       d*  [(        R4                  " U 5      R                  [6        5      nO[(        R8                  " U [         S
S9nX&U
'   U$ U R                  R                  S:X  a  [        U R                  [:        5      (       d  Uc]  US:X  aW  [3        U 5      n
U(       d  U R                  [6        5      n O[(        R8                  " U SS9n X U
'   U R                  [         SS9n U $ SSKJn  U" U UUUUSS9nURA                  5       n	U	R                  [         SS9n	U	$ [        U [B        5      (       a:  [3        U 5      n
[(        R4                  " U R                  [         5      5      nX-U
'   U$ [3        U 5      n
[D        RF                  " U5      nU R                  [H        :w  as  U(       dl  U(       ae  U R                  [6        5      n U R                  RJ                  [(        R                  " S5      RJ                  -  U:  a  U R                  SU 35      n O[(        R8                  " U SS9n X U
'   U R                  [         SS9n U $ )zX
Convert to types which can be consumed by the standard library's
csv.writer.writerows.
r  r  rF  )r=  rS  Fr	  Nr   r   Tr  r  rO  r   r  r   )FloatArrayFormatter)r=  rR  rQ  rT  fixed_widthU1z<U)&r  rq   r!  r   r(  r   r  r'  rC   _codesry   rr   rt   rG  _format_native_typesr$  r   r#  r4  r)  r%  vstackrZ   r   rY   rh   r.  r   r5  r[   rK  r+  get_result_as_arrayrs   r   word_lenr+  itemsize)rY  rS  r=  rT  rR  rQ  rA  results_convertedr  rp  r  r+  r@  r  r3  s                  r   rV  rV  Z  sC    &+&&6+<+<+B+B+G+G4+O%%.
 ,F3F&=.9::;;!000XF]]6]6FM s6{#AqD\66 7 F $$V]]6]%FG	 $
 yy*++	FLL+	.	.mV,)))Q
	FLL-	0	0ov.{{}ZZ'..s3FXXfF>Ft			c	!*V\\;*O*O GsN<Ds+&9!4L]]6]6FM@'%
	 ++-jjej,
	FN	+	+F|ZZf 56
!4 F|##F+<<:%g(]]3'F||$$rxx~'>'>>IH:7XXfH5FtvE2r   )r   r%   rr  r%   r   r  r  )r  r!   r  r   rr  r   )r  r   rr  r   )r  r   rr  r  r  )r  r   rr  ztuple[Hashable, ...])r   r   rr  r$   )rA  zIndex | ArrayLiker   r  )rY  r    r=  r   rQ  r   rr  r|  )
__future__r   collectionsr   r   r   	itertoolsr   r  typingr   r   r	   r
   r   r   r   r   r   r;  numpyr%  pandas._configr   r   r   pandas._libsr   r   r  r   r  r   r   pandas._libs.internalsr   pandas._libs.join_libsr   r   pandas._libs.libr   r   pandas._libs.tslibsr   r   r   r   pandas._typingr   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   pandas.compat.numpyr/   r  pandas.errorsr0   r1   pandas.util._decoratorsr2   r3   r4   r5   pandas.util._exceptionsr6   r7   pandas.core.dtypes.astyper8   r9   pandas.core.dtypes.castr:   r;   r<   r=   r>   r?   r@   pandas.core.dtypes.commonrA   rB   rC   rD   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   pandas.core.dtypes.concatrT   pandas.core.dtypes.dtypesrU   rV   rW   rX   rY   rZ   r[   pandas.core.dtypes.genericr\   r]   r^   r_   r`   ra   rb   rc   rd   pandas.core.dtypes.inferencere   pandas.core.dtypes.missingrf   rg   rh   pandas.coreri   rj   rk   pandas.core.accessorrl   pandas.core.algorithmscore
algorithmspandas.core.array_algos.putmaskrm   rn   pandas.core.arraysro   rp   rq   rr   rs   rt   pandas.core.arrays.string_ru   rv   pandas.core.baserw   rx   pandas.core.commoncommonr)  pandas.core.constructionry   rz   r{   pandas.core.indexersr|   r}   pandas.core.indexes.frozenr~   pandas.core.missingr   pandas.core.opsr   pandas.core.ops.invalidr   pandas.core.sortingr   r   r   pandas.core.strings.accessorr   pandas.io.formats.printingr   r   r   r   collections.abcr   r   r   rR  r   r   r   r   r   r   __all__	frozenset_unsortable_typesr   r  r   r   r  r   r+  MaskedComplex128EngineMaskedComplex64EngineMaskedFloat64EngineMaskedFloat32EngineMaskedUInt64EngineMaskedUInt32EngineMaskedUInt16EngineMaskedUInt8EngineMaskedInt64EngineMaskedInt32EngineMaskedInt16EngineMaskedInt8EngineMaskedBoolEnginer  r   r   r   r  r  r  rL  r:  r   r"  rF  rS  rV  r  r   r   <module>rs     s   "    ! 
 
 
     3 # #     $ / 
       * 4  
 
 
 6  
 0 & &  !   
 2 9 . 3 
 7    
 )89  % >  &( N 'XXh
(11// x++ x++	
 h)) h)) h)) X'' X'' X'' X'' H%% x(( x33 44  44!" h22#$  22222200000000....5<8!8~pM< ~pBb%>P8,v	&C
 &60 kk 	k k kr   