Ë
    *�£j£ ã                  ó`  — d Z ddlmZ ddlmZ ddlZddlZddlmZm	Z	m
Z
mZmZmZ ddlZddlZddlmZ ddlmZ ddlmc mZ ddlmZmZmZ dd	lmZ dd
lmZ  ddl!m"Z" ddl#m$Z$m%Z% ddl&m'Z' ddl(m)Z)m*Z* ddl+m,Z, ddl-m.Z.m/Z/ ddl0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7 ddl8m9Z9m:Z: ddl;m<Z<m=Z= ddl>m?Z?m@Z@mAZA ddlBmCZC ddlDmEc mFZG ddlHmIZI ddlJmKZK ddlLmMZM ddlNmEc mOZP ddlQmRZRmSZSmTZT ddlUmVZVmWZW ddlXmYZY ddlZm[Z[ erYddl\m]Z]m^Z^ ddl_m`Z` ddlmaZambZb dd lcmdZdmeZe eb G d!„ d"ea«      «       Zfdd#lgmhZh e
d$   Zidd%lgmjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrmsZsmtZt dd&lumvZv d'd(iZwd2d)„Zx	 	 	 	 	 	 	 	 	 	 d3d*„Zy	 d4	 	 	 	 	 d5d+„Zz e%d,«       G d-„ d(eIeMeK«      «       Z{	 	 	 d6	 	 	 	 	 d7d.„Z|ed8d/„«       Z}ed9d0„«       Z}d:d1„Z}y);z
SparseArray data structure
é    )Úannotations)ÚabcN)ÚTYPE_CHECKINGÚAnyÚLiteralÚSelfÚcastÚoverload)Ú
get_option)Úlib)Ú
BlockIndexÚIntIndexÚSparseIndex)ÚNaT)Úfunction)ÚPerformanceWarning)ÚdocÚ
set_module)Úfind_stack_level)Úvalidate_bool_kwargÚvalidate_insert_loc)Úastype_array)Úfind_common_typeÚmaybe_box_datetimelike)Úis_bool_dtypeÚ
is_integerÚis_list_likeÚis_object_dtypeÚ	is_scalarÚis_string_dtypeÚpandas_dtype)ÚDatetimeTZDtypeÚSparseDtype)ÚABCIndexÚ	ABCSeries)ÚisnaÚna_value_for_dtypeÚnotna)Ú	arraylike)ÚOpsMixin)ÚExtensionArray)ÚPandasObject)Úensure_wrapped_if_datetimelikeÚextract_arrayÚsanitize_array)Úcheck_array_indexerÚunpack_tuple_and_ellipses)Úcheck_below_min_count)Úprinting)ÚCallableÚSequence)ÚEllipsisType)ÚProtocolÚtype_check_only)Ú	csc_arrayÚ
csc_matrixc                  ó&   — e Zd Zedd„«       Zdd„Zy)Ú_SparseMatrixLikec                ó   — y ©N© ©Úselfs    úAC:\FundamentalWorkbench\vendor\pandas\core\arrays\sparse\array.pyÚshapez_SparseMatrixLike.shapem   s   € Ø/2ó    c                ó   — y r>   r?   r@   s    rB   Útocscz_SparseMatrixLike.tocsco   s   € °crD   N)Úreturnztuple[int, int])rG   zcsc_array | csc_matrix)Ú__name__Ú
__module__Ú__qualname__ÚpropertyrC   rF   r?   rD   rB   r<   r<   k   s   „ à	Ú2ó 
Ø2Ü9rD   r<   )ÚNumpySorter)ÚintegerÚblock)Ú	ArrayLikeÚ	AstypeArgÚAxisÚAxisIntÚDtypeÚNpDtypeÚPositionalIndexerÚScalarÚScalarIndexerÚSequenceIndexerÚnpt)ÚSeriesÚklassÚSparseArrayc                óÊ   — 	 t        j                  | j                  | j                  j                  ¬«      S # t
        $ r" t        j                  | j                  «      cY S w xY w)a]  
    Create a 0-dim ndarray containing the fill value

    Parameters
    ----------
    arr : SparseArray

    Returns
    -------
    fill_value : ndarray
        0-dim ndarray with just the fill value.

    Notes
    -----
    coerce fill_value to arr dtype if possible
    int64 SparseArray can have NaN as fill_value if there is no missing
    ©Údtype)ÚnpÚasarrayÚ
fill_valuer_   ÚsubtypeÚ
ValueError)Úarrs    rB   Ú	_get_fillrf   Œ   sH   € ð$*Ü�z‰z˜#Ÿ.™.°·	±	×0AÑ0AÔBÐBøÜò *Ü�z‰z˜#Ÿ.™.Ó)Ò)ð*ús   ‚47 ·(A"Á!A"c           	     óª  — |j                  d«      r|dd }| j                  j                  }|j                  j                  }||k7  rlt        ||g«      }t	        || j
                  «      }t	        ||j
                  «      }| j                  |d¬«      } |j                  |d¬«      }|j                  }n|}d}| j                  j                  dk(  s|j                  j                  dk(  r”t        j                  d¬	«      5   || j                  «       |j                  «       «      }	 |t        | «      t        |«      «      }
ddd«       | j                  j                  dk(  r| j                  }�nð|j                  }�nâ| j                  j                  |j                  «      ret        j                  d¬	«      5   || j                  |j                  «      }	 |t        | «      t        |«      «      }
ddd«       | j                  }�nX|d   d
k(  r	|| }} |dd }|dv rd|dk(  r_d|› d�}| j                  j                  t        j                   «      }|j                  j                  t        j                   «      }t"        }n d|› d|› �}| j                  }|j                  }|dv rS|dk(  j%                  «       r@| j                  j&                  dv r(d|› d�}|j                  d«      }|j                  d«      }t)        t*        |«      }t        j                  d¬	«      5   ||| j                  | j
                  ||j                  |j
                  «      \  }	}}
ddd«       |dk(  r,t-        |	d   
d   |¬«      t-        ||	d   ||
d   |¬«      fS |€	j                  }t-        |	
|¬«      S # 1 sw Y   �ŒpxY w# 1 sw Y   �ŒÌxY w# 1 sw Y   ŒrxY w)a4  
    Perform a binary operation between two arrays.

    Parameters
    ----------
    left : Union[SparseArray, ndarray]
    right : Union[SparseArray, ndarray]
    op : Callable
        The binary operation to perform
    name str
        Name of the callable.

    Returns
    -------
    SparseArray
    Ú__é   éþÿÿÿF©ÚcopyNr   Úignore©ÚallÚré   )ÚandÚorÚxorÚboolÚsparse_Ú_uint8Ú_)ÚfloordivÚmodÚiuÚ_float64Úfloat64Údivmodr^   )Ú
startswithr_   rc   r   r#   rb   ÚastypeÚsp_indexÚngapsr`   ÚerrstateÚto_denserf   ÚequalsÚ	sp_valuesÚviewÚuint8ru   ÚanyÚkindÚgetattrÚsplibÚ_wrap_result)ÚleftÚrightÚopÚnameÚltypeÚrtyperc   r_   Úresult_dtypeÚresultÚfillÚindexÚopnameÚleft_sp_valuesÚright_sp_valuesÚ	sparse_ops                   rB   Ú_sparse_array_oprœ   ¤   sW  € ð& ‡��tÔà�A�bˆzˆð �J‰J×Ñ€EØ�K‰K×Ñ€Eà�‚~Ü" E¨5 >Ó2ˆÜ˜G T§_¡_Ó5ˆÜ˜G U×%5Ñ%5Ó6ˆà�{‰{˜5 uˆ{Ó-ˆØ—‘˜U¨�Ó/ˆØ—‘‰àˆð €Là‡}�}×Ñ˜aÒ 5§>¡>×#7Ñ#7¸1Ò#<Ü�[‰[˜XÖ&Ù˜Ÿ™›¨¯©Ó)9Ó:ˆFÙ”i “o¤y°Ó'7Ó8ˆD÷ 'ð �=‰=×Ñ !Ò#Ø—M‘MŠEà—N‘NŠEØ	�‰×	Ñ	˜eŸn™nÔ	-Ü�[‰[˜XÖ&Ù˜Ÿ™¨¯©Ó8ˆFÙ”i “o¤y°Ó'7Ó8ˆD÷ 'ð —‘Šà�‰7�cŠ>Ø �%ˆDØ˜˜�8ˆDàÐ'Ñ'¨E°VªOØ˜t˜f FÐ+ˆFà!Ÿ^™^×0Ñ0´·±Ó:ˆNØ#Ÿo™o×2Ñ2´2·8±8Ó<ˆOÜ‰Là˜t˜f A e WÐ-ˆFØ!Ÿ^™^ˆNØ#Ÿo™oˆOð Ð'Ñ'Ø˜!‘× Ñ Ô"Ø—
‘
—‘ 4Ñ'ð ˜t˜f HÐ-ˆFØ+×2Ñ2°9Ó=ˆNØ-×4Ñ4°YÓ?ˆOäœE 6Ó*ˆ	ä�[‰[˜XÖ&Ù"+ØØ—‘Ø—‘ØØ—‘Ø× Ñ ó#ÑˆF�E˜4÷ 'ð ˆxÒô
 ˜˜v a™y¨%°°a±ÀÔMÜ˜˜v a™y¨%°°a±ÀÔMð
ð 	
ð
 ÐØ—|‘|ˆä˜˜f e¨T¸ÔFÐF÷ 'Ñ&ú÷ 'Ñ&ú÷@ 'Ð&ús%   Ä AN/Æ99N<Ì:O	Î/N9Î<OÏ	Oc                ó¶   — | j                  d«      r| dd } | dv rt        }t        j                  |«      }t	        |«      rt        |«      }t        ||||¬«      S )z.
    wrap op result to have correct dtype
    rh   ri   rj   )ÚeqÚneÚltÚgtÚleÚge)Úsparse_indexrb   r_   )r   ru   r   Úitem_from_zerodimr   r\   )r‘   Údatar¤   rb   r_   s        rB   r�   r�     sa   € ð ‡��tÔà�A�bˆzˆàÐ3Ñ3Üˆä×&Ñ& zÓ2€Jä�UÔä˜*Ó%ˆ
ÜØ˜<°JÀeôð rD   zpandas.arraysc                  óv  — e Zd ZU dZdZej                   eg «      z  Zded<   ded<   ded<   	 	 	 	 	 dS	 	 	 	 	 	 	 dTd„Z	e
	 	 	 	 	 	 	 	 dUd„«       Ze
dVd„«       Z	 dW	 	 	 	 	 dXd„ZdYd„Ze
d	d
dœ	 	 	 	 	 dZd„«       Ze
d[d„«       Zd„ Zed\d„«       Zed]d„«       Zed^d„«       Zed„ «       Zej.                  dYd„«       Zed_d„«       Zed]d„«       Zd`d„Zedad„«       Zed`d„«       Zedbd„«       Zed`d„«       Zd[d „Z	 	 dc	 	 	 	 	 ddd"„Z dedfd#„Z!d$„ Z" e#e$jJ                  «      	 dg	 	 	 dhd%„«       Z%d[d&„Z&d'„ Z'	 di	 	 	 djd(„Z(didkd)„Z)e*dld*„«       Z+e*	 	 	 	 dmd+„«       Z+	 	 	 	 dnd,„Z+d-„ Z,d
d	d.œdod/„Z-dpd]d0„Z.d[d1„Z/	 	 dq	 	 	 	 	 	 	 drd2„Z0d[d3„Z1e
dsd4„«       Z2dcdtd5„Z3dpdud6„Z4d]d7„Z5d8„ Z6dYd9„Z7dvd:„Z8d!d
d;œ	 	 	 	 	 dwd<„Z9dpd=„Z:dxdyd>„Z;	 	 	 dz	 	 	 	 	 	 	 d{d?„Z<dxd|d@„Z=dxd}dA„Z>d	d!dBœd~dC„Z?d	d!dBœd~dD„Z@ddE„ZAd€dF„ZBdid�dG„ZCdid�dH„ZDeEjŒ                  eGj�                  fZId‚dI„ZJdJ„ ZKdƒdK„ZLeLZMdƒdL„ZNdƒdM„ZOdƒdN„ZPdƒdO„ZQdƒdP„ZRd„dQ„ZSd…d†dR„ZTy	)‡r\   ak
  
    An ExtensionArray for storing sparse data.

    SparseArray efficiently stores data with a high frequency of a
    specific fill value (e.g., zeros), saving memory by only retaining
    non-fill elements and their indices. This class is particularly
    useful for large datasets where most values are redundant.

    Parameters
    ----------
    data : array-like or scalar
        A dense array of values to store in the SparseArray. This may contain
        `fill_value`.
    sparse_index : SparseIndex, optional
        Index indicating the locations of sparse elements.
    fill_value : scalar, optional
        Elements in data that are ``fill_value`` are not stored in the
        SparseArray. For memory savings, this should be the most common value
        in `data`. By default, `fill_value` depends on the dtype of `data`:

        =========== ==========
        data.dtype  na_value
        =========== ==========
        float       ``np.nan``
        int         ``0``
        bool        False
        datetime64  ``pd.NaT``
        timedelta64 ``pd.NaT``
        =========== ==========

        The fill value is potentially specified in three ways. In order of
        precedence, these are

        1. The `fill_value` argument
        2. ``dtype.fill_value`` if `fill_value` is None and `dtype` is
           a ``SparseDtype``
        3. ``data.dtype.fill_value`` if `fill_value` is None and `dtype`
           is not a ``SparseDtype`` and `data` is a ``SparseArray``.

    kind : str
        Can be 'integer' or 'block', default is 'integer'.
        The type of storage for sparse locations.

        * 'block': Stores a `block` and `block_length` for each
          contiguous *span* of sparse values. This is best when
          sparse data tends to be clumped together, with large
          regions of ``fill-value`` values between sparse values.
        * 'integer': uses an integer to store the location of
          each sparse value.

    dtype : np.dtype or SparseDtype, optional
        The dtype to use for the SparseArray. For numpy dtypes, this
        determines the dtype of ``self.sp_values``. For SparseDtype,
        this determines ``self.sp_values`` and ``self.fill_value``.
    copy : bool, default False
        Whether to explicitly copy the incoming `data` array.

    Attributes
    ----------
    None

    Methods
    -------
    None

    See Also
    --------
    SparseDtype : Dtype for sparse data.

    Examples
    --------
    >>> from pandas.arrays import SparseArray
    >>> arr = SparseArray([0, 0, 1, 2])
    >>> arr
    [0, 0, 1, 2]
    Fill: 0
    IntIndex
    Indices: array([2, 3], dtype=int32)
    Úsparse_arrayr   Ú_sparse_indexú
np.ndarrayÚ_sparse_valuesr#   Ú_dtypeNFc                ó²  — |€t        |t        «      r|j                  }t        |t        | «      «      r6|€|j                  }|€|j                  }|€|j
                  }|j                  }t        |t        «      r	 t        j                  |«      }t        |t        «      r|€|j                  }|j                  }t        |«      r"t        dt        | «      j                  › d�«      ‚|�t        |«      }|€t        j                  g |¬«      }	 t!        |d ¬«      }|r|j+                  «       }|€.|€|j
                  n|}|€t        j,                  }nt/        |«      }t        |t        | «      «      r1|€/|j0                  }t        j(                  |j                  |¬«      }�n|€Ñt3        |d¬«      }t        |t        j4                  «      s–t        |j
                  t6        «      rgt9        j:                  d|j
                  › d�t<        t?        «       ¬	«       t        j(                  |d
¬«      }|t@        u rt        jB                  dd«      }t        j(                  |«      }tE        ||||¬«      \  }}}nGt        j(                  ||¬«      }tG        |«      |jH                  k7  rtK        dt        |«      › d�«      ‚|| _        || _&        t        |j
                  |«      | _'        y # t        $ r t        |«      }Y �Œnw xY w# t"        $ rK |€Dt        j
                  t$        «      }t        j&                  t        j(                  ||¬«      «      }n‚ Y �Œ:w xY w)NzCannot construct z+ from scalar data. Pass a sequence instead.r^   )r—   T)Úextract_numpyzCreating SparseArray from z^ data loses timezone information. Cast to object before sparse to retain timezone information.©Ú
stacklevelzdatetime64[ns]r   Úns)rŠ   rb   r_   zNon array-like type z' must have the same length as the index)(Ú
isinstancer#   rb   Útyper�   r_   r†   ÚstrÚconstruct_from_stringÚ	TypeErrorr!   rc   r   rH   r`   Úarrayr/   rd   ÚobjectÚ
atleast_1dra   rl   Únanr'   r©   r.   Úndarrayr"   ÚwarningsÚwarnÚUserWarningr   r   Ú
datetime64Ú_make_sparseÚlenÚnpointsÚAssertionErrorr«   r¬   )	rA   r¦   r¤   rb   rŠ   r_   rl   Úfill_value_dtypeÚsparse_valuess	            rB   Ú__init__zSparseArray.__init__  s  € ð Ð¤*¨U´KÔ"@Ø×)Ñ)ˆJä�dœD ›JÔ'àÐ#Ø#Ÿ}™}�ØÐ!Ø!Ÿ_™_�
Øˆ}ØŸ
™
�à—>‘>ˆDô �eœSÔ!ð,Ü#×9Ñ9¸%Ó@�ô �eœ[Ô)ØÐ!Ø"×-Ñ-�
Ø—M‘MˆEä�TŒ?ÜØ#¤D¨£J×$7Ñ$7Ð#8ð 9+ð +óð ð
 ÐÜ  Ó'ˆEð ˆ<ô —8‘8˜B eÔ,ˆDð		Ü! $¨dÔ3ˆDñ à—9‘9“;ˆDàÐØ-2¨]˜tŸzšzÀÐØÐ'ÜŸV™V‘
ä/Ð0@ÓA�
ä�dœD ›JÔ'¨LÐ,@Ø×-Ñ-ˆLô ŸJ™JØ—‘ØôŠMð Ð!Ü  °TÔ:ˆDÜ˜d¤B§J¡JÔ/ä˜dŸj™j¬/Ô:Ü—M‘MØ4°T·Z±Z°Lð AAð Aô $Ü#3Ó#5õô Ÿ:™: dÐ2BÔC�DØ!¤SÑ(Ü%'§]¡]°5¸$Ó%?˜
Ü—z‘z $Ó'�Ü6Bð ØØ%Øô7Ñ3ˆM˜<©ô ŸJ™J t°5Ô9ˆMÜ�=Ó! \×%9Ñ%9Ò9Ü$Ø*¬4°Ó+>Ð*?ð @8ð 8óð ð *ˆÔØ+ˆÔÜ! -×"5Ñ"5°zÓBˆ�øô} ò ,Ü$ UÓ+“ð,ûô< ò 	ð ˆ}ÜŸ™¤Ó(�Ü—}‘}¤R§Z¡Z°¸EÔ%BÓC‘àò ð	ús%   Á;K' ÄL Ë'K?Ë>K?ÌAMÍMc                óZ   — t         j                  | «      }||_        ||_        ||_        |S r>   )r¸   Ú__new__r©   r«   r¬   )Úclsr¨   r¤   r_   Únews        rB   Ú_simple_newzSparseArray._simple_newü  s.   € ô �n‰n˜SÓ!ˆØ(ˆÔØ)ˆÔØˆŒ
Øˆ
rD   c                ó€  — |j                   \  }}|dk7  rt        d|› d�«      ‚|j                  «       }|j                  «        |j                  }|j
                  }t        j                  d|j                  ¬«      j                  «       }t        |j                  |«      }t        ||«      }	| j                  ||	|«      S )a‚  
        Create a SparseArray from a scipy.sparse matrix.

        Parameters
        ----------
        data : scipy.sparse.sp_matrix
            This should be a SciPy sparse matrix where the size
            of the second dimension is 1. In other words, a
            sparse matrix with a single column.

        Returns
        -------
        SparseArray

        Examples
        --------
        >>> import scipy.sparse
        >>> mat = scipy.sparse.coo_matrix((4, 1))
        >>> pd.arrays.SparseArray.from_spmatrix(mat)
        [0.0, 0.0, 0.0, 0.0]
        Fill: 0.0
        IntIndex
        Indices: array([], dtype=int32)
        rq   z''data' must have a single column, not 'Ú'r   r^   )rC   rd   rF   Úsort_indicesr¦   Úindicesr`   r·   r_   Úitemr#   r   rË   )
rÉ   r¦   ÚlengthÚncolÚdata_cscre   ÚidxÚzeror_   r—   s
             rB   Úfrom_spmatrixzSparseArray.from_spmatrix	  s¦   € ð4 —z‘z‰ˆ�à�1Š9ÜÐFÀtÀfÈAÐNÓOÐOð —:‘:“<ˆØ×ÑÔØ�m‰mˆØ×Ñˆä�x‰x˜ §¡Ô+×0Ñ0Ó2ˆÜ˜CŸI™I tÓ,ˆÜ˜ Ó%ˆà�‰˜s E¨5Ó1Ð1rD   c                ó$  — | j                   j                  dk(  r^|du rt        j                  | j                  «      S | j                  }| j
                  r!|j                  «       }d|j                  _        |S |du rt        d«      ‚| j                  }|€¡| j                  j                  j                  dk(  rJ|t        u rBt        j                  | j                  j                  «      d   }t        j                  d|«      }	 t        j                   | j                  j                  t#        |«      «      }t        j(                  | j*                  ||¬«      }| j                  || j                   j,                  <   |S # t$        $ r	 t&        }Y ŒXw xY w)Nr   TFz:Unable to avoid copy while creating an array as requested.ÚMr   r^   )r�   r‚   r`   r·   r†   Ú	_readonlyr‡   ÚflagsÚ	writeablerd   rb   r_   rŠ   r   Údatetime_datar¿   Úresult_typer³   r¶   r¸   ÚfullrC   rÏ   )rA   r_   rl   r•   rb   ÚunitÚouts          rB   Ú	__array__zSparseArray.__array__5  sE  € ð �=‰=×Ñ !Ò#à�t‰|Ü—x‘x §¡Ó/Ð/àŸ™�Ø—>’>Ø#Ÿ[™[›]�FØ-2�F—L‘LÔ*Ø�à�5‰=ÜØLóð ð —_‘_ˆ
àˆ=ð �~‰~×#Ñ#×(Ñ(¨CÒ/ð ¤Ñ$ä×+Ñ+¨D¯N©N×,@Ñ,@ÓAÀ!ÑD�DÜ!#§¡¨u°dÓ!;�JðÜŸ™ t§~¡~×';Ñ';¼TÀ*Ó=MÓN�ô �g‰g�d—j‘j *°EÔ:ˆØ%)§^¡^ˆˆD�M‰M×!Ñ!Ñ"Øˆ
øô ò Ü’ðús   Ä3E= Å=FÆFc                óJ   — | j                   rt        d«      ‚d}t        |«      ‚)NzCannot modify read-only arrayz8SparseArray does not support item assignment via setitem)rÙ   rd   r¶   )rA   ÚkeyÚvalueÚmsgs       rB   Ú__setitem__zSparseArray.__setitem__^  s'   € Ø�>Š>ÜÐ<Ó=Ð=ð IˆÜ˜‹nÐrD   ©r_   rl   c               ó   —  | ||¬«      S ©Nr^   r?   )rÉ   Úscalarsr_   rl   s       rB   Ú_from_sequencezSparseArray._from_sequenceg  s   € ñ �7 %Ô(Ð(rD   c                ó*   —  | ||j                   ¬«      S ré   r^   )rÉ   ÚvaluesÚoriginals      rB   Ú_from_factorizedzSparseArray._from_factorizedm  s   € á�6 §¡Ô0Ð0rD   c                ó8  — t        j                  |t        ¬«      }t        j                  |d¬«      }|j
                  j                  | j
                  j                  k(  rs	 t        | «      j                  || j
                  ¬«      }||k(  t        |«      |j                  «       z  z  j                  «       r|S t        | «      j                  |«      S t        | «      j                  |«      S # t        t        f$ r t        | «      j                  |«      cY S w xY w)Nr^   T)Úconvert_non_numeric)r`   ra   r¸   r   Úmaybe_convert_objectsr_   rŠ   r³   rë   r&   ro   rd   r¶   )rA   rí   r•   Úress       rB   Ú_cast_pointwise_resultz"SparseArray._cast_pointwise_resultq  sâ   € Ü—‘˜F¬&Ô1ˆÜ×*Ñ*¨6ÀtÔLˆØ�<‰<×Ñ §
¡
§¡Ò/ð	9ä˜4“j×/Ñ/°¸d¿j¹jÐ/ÓI�Ø˜F‘]¤t¨F£|°c·h±h³jÑ'@ÑA×FÑFÔHð �JÜ˜D“z×0Ñ0°Ó8Ð8ô
 ˜“:×,Ñ,¨VÓ4Ð4øô	 ¤	Ð*ò 9Ü˜D“z×0Ñ0°Ó8Ò8ð9ús   Á!AC- Â9C- Ã-)DÄDc                ó   — | j                   S )zX
        The SparseIndex containing the location of non- ``fill_value`` points.
        )r©   r@   s    rB   r�   zSparseArray.sp_index†  s   € ð
 ×!Ñ!Ð!rD   c                ó   — | j                   S )ag  
        An ndarray containing the non- ``fill_value`` values.

        This property returns the actual data values stored in the sparse
        representation, excluding the values that are equal to the ``fill_value``.
        The result is an ndarray of the underlying values, preserving the sparse
        structure by omitting the default ``fill_value`` entries.

        See Also
        --------
        Series.sparse.to_dense : Convert a Series from sparse values to dense.
        Series.sparse.fill_value : Elements in `data` that are `fill_value` are
            not stored.
        Series.sparse.density : The percent of non- ``fill_value`` points, as decimal.

        Examples
        --------
        >>> from pandas.arrays import SparseArray
        >>> s = SparseArray([0, 0, 1, 0, 2], fill_value=0)
        >>> s.sp_values
        array([1, 2])
        )r«   r@   s    rB   r†   zSparseArray.sp_values�  s   € ð0 ×"Ñ"Ð"rD   c                ó   — | j                   S r>   )r¬   r@   s    rB   r_   zSparseArray.dtype§  s   € à�{‰{ÐrD   c                ó.   — | j                   j                  S )aÜ  
        Elements in `data` that are `fill_value` are not stored.

        For memory savings, this should be the most common value in the array.

        See Also
        --------
        SparseDtype : Dtype for data stored in :class:`SparseArray`.
        Series.value_counts : Return a Series containing counts of unique values.
        Series.fillna : Fill NA/NaN in a Series with a specified value.

        Examples
        --------
        >>> ser = pd.Series([0, 0, 2, 2, 2], dtype="Sparse[int]")
        >>> ser.sparse.fill_value
        0
        >>> spa_dtype = pd.SparseDtype(dtype=np.int32, fill_value=2)
        >>> ser = pd.Series([0, 0, 2, 2, 2], dtype=spa_dtype)
        >>> ser.sparse.fill_value
        2
        )r_   rb   r@   s    rB   rb   zSparseArray.fill_value«  s   € ð. �z‰z×$Ñ$Ð$rD   c                óN   — t        | j                  j                  |«      | _        y r>   )r#   r_   rc   r¬   )rA   rä   s     rB   rb   zSparseArray.fill_valueÄ  s   € ä! $§*¡*×"4Ñ"4°eÓ<ˆ�rD   c                ó:   — t        | j                  t        «      ryy)zW
        The kind of sparse index for this array. One of {'integer', 'block'}.
        rM   rN   )r²   r�   r   r@   s    rB   rŠ   zSparseArray.kindÈ  s   € ô
 �d—m‘m¤XÔ.ØàrD   c                ó:   — | j                   }t        |«      }||   S r>   )r†   r(   )rA   Úsp_valsÚmasks      rB   Ú_valid_sp_valueszSparseArray._valid_sp_valuesÒ  s   € à—.‘.ˆÜ�W‹~ˆØ�t‰}ÐrD   c                ó.   — | j                   j                  S r>   )r�   rÑ   r@   s    rB   Ú__len__zSparseArray.__len__Ø  s   € Ø�}‰}×#Ñ#Ð#rD   c                ó.   — | j                   j                  S r>   )r¬   Ú_is_na_fill_valuer@   s    rB   Ú_null_fill_valuezSparseArray._null_fill_valueÛ  s   € à�{‰{×,Ñ,Ð,rD   c                ó\   — | j                   j                  | j                  j                  z   S r>   )r†   Únbytesr�   r@   s    rB   r  zSparseArray.nbytesß  s!   € à�~‰~×$Ñ$ t§}¡}×';Ñ';Ñ;Ð;rD   c                ó\   — | j                   j                  | j                   j                  z  S )a…  
        The percent of non- ``fill_value`` points, as decimal.

        See Also
        --------
        DataFrame.sparse.from_spmatrix : Create a new DataFrame from a
            scipy sparse matrix.

        Examples
        --------
        >>> from pandas.arrays import SparseArray
        >>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0)
        >>> s.density
        0.6
        )r�   rÂ   rÑ   r@   s    rB   ÚdensityzSparseArray.densityã  s#   € ð" �}‰}×$Ñ$ t§}¡}×';Ñ';Ñ;Ð;rD   c                ó.   — | j                   j                  S )a0  
        The number of non- ``fill_value`` points.

        This property returns the number of elements in the sparse series that are
        not equal to the ``fill_value``. Sparse data structures store only the
        non-``fill_value`` elements, reducing memory usage when the majority of
        values are the same.

        See Also
        --------
        Series.sparse.to_dense : Convert a Series from sparse values to dense.
        Series.sparse.fill_value : Elements in ``data`` that are ``fill_value`` are
            not stored.
        Series.sparse.density : The percent of non- ``fill_value`` points, as decimal.

        Examples
        --------
        >>> from pandas.arrays import SparseArray
        >>> s = SparseArray([0, 0, 1, 1, 1], fill_value=0)
        >>> s.npoints
        3
        )r�   rÂ   r@   s    rB   rÂ   zSparseArray.npointsö  s   € ð0 �}‰}×$Ñ$Ð$rD   c                óž  — t        t        | j                  «      }| j                  r9t        | «      j	                  t        | j                  «      | j                  |«      S t        j                  t        | «      dt        j                  ¬«      }t        | j                  «      || j                  j                  <    t        | «      |d|¬«      S )NFr^   ©rb   r_   )r#   ru   r  r³   rË   r&   r†   r�   r`   rÞ   rÁ   Úbool_rÏ   )rA   r_   rý   s      rB   r&   zSparseArray.isna  s‘   € ô œD $×"7Ñ"7Ó8ˆØ× Ò Ü˜“:×)Ñ)¬$¨t¯~©~Ó*>ÀÇÁÈuÓUÐUÜ�w‰w”s˜4“y %¬r¯x©xÔ8ˆÜ&*¨4¯>©>Ó&:ˆˆT�]‰]×"Ñ"Ñ#ØŒt�D‹z˜$¨5¸Ô>Ð>rD   Tc                ó2  — |�t        d«      ‚t        j                  t        | j                  «      || j                  «      }| j
                  r"t        | j                  j                  |¬«      }n| j                  }| j                  || j                  |«      S )a@  
        Fill missing values with `value`.

        Parameters
        ----------
        value : scalar
        limit : int, optional
            Not supported for SparseArray, must be None.
        copy: bool, default True
            Ignored for SparseArray.

        Returns
        -------
        SparseArray

        Notes
        -----
        When `value` is specified, the result's ``fill_value`` depends on
        ``self.fill_value``. The goal is to maintain low-memory use.

        If ``self.fill_value`` is NA, the result dtype will be
        ``SparseDtype(self.dtype, fill_value=value)``. This will preserve
        amount of memory used before and after filling.

        When ``self.fill_value`` is not NA, the result dtype will be
        ``self.dtype``. Again, this preserves the amount of memory used.
        zlimit must be None©rb   )rd   r`   Úwherer&   r†   r  r#   r_   rc   rË   r©   )rA   rä   Úlimitrl   Ú
new_valuesÚ	new_dtypes         rB   ÚfillnazSparseArray.fillna  sy   € ðB ÐÜÐ1Ó2Ð2Ü—X‘Xœd 4§>¡>Ó2°E¸4¿>¹>ÓJˆ
à× Ò ä# D§J¡J×$6Ñ$6À5ÔI‰IàŸ
™
ˆIà×Ñ 
¨D×,>Ñ,>À	ÓJÐJrD   c           	     ó6  — t        | «      r|dk(  r| j                  «       S t        |«      r| j                  j                  }t        j                  || j                  j                  «      }|| j                  j                  k7  r&| j                  t        || j                  «      «      }n| }| j                  |gt        t        |«      t        | «      «      z  |j                  ¬«      }|dkD  r	|}|d |  }n|t        |«      d  }|}|j                  ||g«      S )Nr   r^   )rÁ   rl   r&   r_   Úna_valuer`   rÝ   rc   r€   r#   rb   rë   ÚminÚabsÚ_concat_same_type)rA   Úperiodsrb   rc   re   ÚemptyÚaÚbs           rB   ÚshiftzSparseArray.shiftI  sõ   € Ü�4Œy˜G qšLØ—9‘9“;Ðä�
ÔØŸ™×,Ñ,ˆJä—.‘. ¨T¯Z©Z×-?Ñ-?Ó@ˆà�d—j‘j×(Ñ(Ò(à—+‘+œk¨'°4·?±?ÓCÓD‰CàˆCà×#Ñ#ØˆLœ3œs 7›|¬S°«YÓ7Ñ7¸s¿y¹yð $ó 
ˆð �QŠ;ØˆAØ�I�g�X�‰Aà”C˜“L�NÐ#ˆAØˆAØ×$Ñ$ a¨ VÓ,Ð,rD   c                ó:  — t        | «      dk(  s"| j                  j                  t        | «      k(  ry| j                  j                  }t        |«      r|d   dkD  ryt        j
                  t	        j                  |«      df   }||dkD  j                  «          dz   S )zh
        Get the location of the first fill value.

        Returns
        -------
        int
        r   éÿÿÿÿri   rq   )rÁ   r�   rÂ   rÏ   r`   Úr_ÚdiffÚargmax)rA   rÏ   r   s      rB   Ú_first_fill_value_locz!SparseArray._first_fill_value_locd  s…   € ô ˆt‹9˜Š>˜TŸ]™]×2Ñ2´c¸$³iÒ?Øà—-‘-×'Ñ'ˆÜ�7Œ|˜w q™z¨Aš~Øô
 �u‰u”R—W‘W˜WÓ% qÐ(Ñ)ˆØ˜˜q™×(Ñ(Ó*Ñ+¨aÑ/Ð/rD   c                ó¢   — t        j                  | «      }t        j                  | j                  «       «      }t        j                  |||¬«      S )N)Úkeeprý   )r`   ra   r&   ÚalgosÚ
duplicated)rA   r$  rí   rý   s       rB   r&  zSparseArray.duplicatedy  s;   € ô —‘˜DÓ!ˆÜ�z‰z˜$Ÿ)™)›+Ó&ˆÜ×Ñ ¨T¸Ô=Ð=rD   c                ó†  — t        j                  | j                  «      }t        | j                  «      t        | «      k7  r\| j	                  «       }t        t        j                  | j                  d | «      «      }t        j                  ||| j                  «      }t        | «      j                  || j                  ¬«      S ré   )r%  Úuniquer†   rÁ   r"  r`   Úinsertrb   r³   rë   r_   )rA   ÚuniquesÚfill_locÚ
insert_locs       rB   r(  zSparseArray.unique�  s‹   € Ü—,‘,˜tŸ~™~Ó.ˆÜˆt�~‰~Ó¤# d£)Ò+Ø×1Ñ1Ó3ˆHô œUŸ\™\¨$¯.©.¸¸(Ð*CÓDÓEˆJÜ—i‘i ¨°T·_±_ÓEˆGÜ�D‹z×(Ñ(¨¸¿
¹
Ð(ÓCÐCrD   c                óD   — t        j                  | «      | j                  fS r>   )r`   ra   rb   r@   s    rB   Ú_values_for_factorizez!SparseArray._values_for_factorize�  s   € ä�z‰z˜$Ó §¡Ð0Ð0rD   c                ó’   — t        j                  t        j                  | «      |¬«      \  }}t	        || j
                  ¬«      }||fS )N)Úuse_na_sentinelr^   )r%  Ú	factorizer`   ra   r\   r_   )rA   r0  Úcodesr*  Ú
uniques_sps        rB   r1  zSparseArray.factorize“  sA   € ô Ÿ™Ü�J‰J�tÓ¨oô
‰ˆˆwô ! °·
±
Ô;ˆ
Ø�jÐ Ð rD   c                óö  — ddl m}m} t        j                  | j
                  |¬«      \  }}}| j                  j                  }|dkD  rŠ| j                  r|s|| j                  rt        |«      n|| j                  k(  }|j                  «       r||xx   |z  cc<   n8t        j                  |d| j                  «      }t        j                  |d|«      }t        |t        «      s ||d¬«      }	n|}	 |||	d¬«      S )a  
        Returns a Series containing counts of unique values.

        Parameters
        ----------
        dropna : bool, default True
            Don't include counts of NaN, even if NaN is in sp_values.

        Returns
        -------
        counts : Series
        r   )ÚIndexrZ   )ÚdropnaFrk   )r—   rl   )Úpandasr5  rZ   r%  Úvalue_counts_arrayliker†   r�   r‚   r  r&   rb   r‰   r`   r)  r²   r$   )
rA   r6  r5  rZ   ÚkeysÚcountsrx   Úfcountsrý   r—   s
             rB   Úvalue_countszSparseArray.value_counts¢  sÌ   € ÷	
ô
  ×6Ñ6°t·~±~ÈfÔU‰ˆˆf�aØ—-‘-×%Ñ%ˆØ�QŠ; × 5Ò 5¹VØ!%×!6Ò!6”4˜”:¸DÀDÇOÁOÑ<SˆDØ�x‰xŒzØ�t“ Ñ'”ô —y‘y  q¨$¯/©/Ó:�ÜŸ™ 6¨1¨gÓ6�ä˜$¤Ô)Ù˜$ UÔ+‰EàˆEÙ�f E°Ô6Ð6rD   c                 ó   — y r>   r?   ©rA   rã   s     rB   Ú__getitem__zSparseArray.__getitem__Í  s   € Ø69rD   c                 ó   — y r>   r?   r>  s     rB   r?  zSparseArray.__getitem__Ð  s   € ð rD   c                ó”  — t        |t        «      rt        |«      }|du rt        d«      ‚t	        |«      r| j                  |«      S t        |t        «      r| j                  «       |   }�nÁt        |t        «      �rÙ|t        d «      k(  rMt        | «      j                  | j                  | j                  | j                  «      }| j                  |_        |S |j                  �|j                  dk(  �r |j                  €dn|j                  }|dk  r|t!        | «      z  }|j"                  €t!        | «      n|j"                  }|dk  r|t!        | «      z  }| j                  j$                  }t'        j(                  ||k\  ||k  z  «      }| j                  |   }||   j+                  «       }	|dkD  r|	|z  }	t!        t-        t!        | «      «      |   «      }
t/        |
|	| j0                  «      }t        | «      j                  ||| j                  «      S t'        j2                  t!        | «      t&        j4                  ¬«      |   }| j7                  |«      S t9        |«      st;        d«      ‚t        |t<        «      �r	t?        |«      rétA        |jB                  «      r2| j7                  |j                  j$                  |j                     «      S |jB                  s%| j7                  |j                  j$                  «      S t!        | «      }t'        jD                  |dt&        jF                  ¬«      }d||j                  j$                  <   | j7                  t'        j2                  |«      |   «      S t'        jH                  |«      }tK        | |«      }tM        jN                  |«      rZtQ        t&        jR                  |«      }| j7                  t'        j2                  t!        |«      t&        j4                  ¬«      |   «      S tU        |d	«      r| j7                  |«      S t        d
|› d�«      ‚ t        | «      || j0                  ¬«      S )N.zCannot slice with Ellipsisrq   r   r^   zuonly integers, slices (`:`), ellipsis (`...`), numpy.newaxis (`None`) and integer or boolean arrays are valid indicesTFr   zCannot slice with 'rÍ   ©rŠ   )+r²   Útupler1   rd   r   Ú_get_val_atr„   Úslicer³   rË   r†   r�   r_   rÙ   ÚstepÚstartrÁ   ÚstoprÏ   r`   Úflatnonzerorl   ÚrangeÚmake_sparse_indexrŠ   ÚarangeÚint32Útaker   Ú
IndexErrorr\   r   r&   rb   rÞ   r  ra   r0   ÚcomÚis_bool_indexerr	   r»   Úhasattr)rA   rã   Ú
data_slicer•   rG  ÚendrÏ   Ú	keep_indsrü   r�   Únew_lenÚnew_sp_indexÚnrý   s                 rB   r?  zSparseArray.__getitem__Ö  s]  € ô �cœ5Ô!Ü+¨CÓ0ˆCØ�c‰zÜ Ð!=Ó>Ð>ä�cŒ?Ø×#Ñ# CÓ(Ð(Ü˜œUÔ#ØŸ™›¨Ñ-ŠJÜ˜œUÕ#Ø”e˜D“kÒ!ä˜d›×/Ñ/Ø—N‘N D§M¡M°4·:±:ó�ð $(§>¡>�Ô Ø�à�x‰xÐ 3§8¡8¨q£=Ø ŸY™YÐ.™°C·I±I�Ø˜1’9ØœS ›YÑ&�Eà#&§8¡8Ð#3”c˜$”i¸¿¹�Ø˜’7Øœ3˜t›9Ñ$�CàŸ-™-×/Ñ/�ÜŸN™N¨G°uÑ,<ÀÈ3ÁÑ+OÓP�	ØŸ.™.¨Ñ3�à" 9Ñ-×2Ñ2Ó4�ð ˜1’9Ø Ñ%�Hô œe¤C¨£IÓ.¨sÑ3Ó4�Ü0°¸(ÀDÇIÁIÓN�Ü˜D“z×-Ñ-¨g°|ÀTÇZÁZÓPÐPäŸ)™)¤C¨£I´R·X±XÔ>¸sÑC�Ø—y‘y Ó)Ð)ä˜cÔ"ô ðLóð ô ˜#œ{Õ+ô
 ! Ô%Ü˜CŸN™NÔ+Ø#Ÿy™y¨¯©×)=Ñ)=¸c¿m¹mÑ)LÓMÐMØŸ>š>Ø#Ÿy™y¨¯©×)=Ñ)=Ó>Ð>Ü˜D›	�AÜŸ7™7 1 d´"·(±(Ô;�DØ16�D˜Ÿ™×-Ñ-Ñ.ØŸ9™9¤R§Y¡Y¨q£\°$Ñ%7Ó8Ð8äŸ*™* S›/�Cä% d¨CÓ0ˆCä×"Ñ" 3Ô'äœ2Ÿ:™: sÓ+�Ø—y‘y¤§¡¬3¨s«8¼2¿8¹8Ô!DÀSÑ!IÓJÐJÜ˜˜iÔ(Ø—y‘y “~Ð%ä Ð#6°s°e¸1Ð!=Ó>Ð>àŒt�D‹z˜*¨4¯9©9Ô5Ð5rD   c                óæ   — t        |t        | «      «      }| j                  j                  |«      }|dk(  r| j                  S | j
                  |   }t        || j
                  j                  «      }|S )Nr  )r   rÁ   r�   Úlookuprb   r†   r   r_   )rA   ÚlocÚsp_locÚvals       rB   rD  zSparseArray._get_val_at2  s`   € Ü! #¤s¨4£yÓ1ˆà—‘×%Ñ% cÓ*ˆØ�RŠ<Ø—?‘?Ð"à—.‘. Ñ(ˆCÜ(¨¨d¯n©n×.BÑ.BÓCˆCØˆJrD   )Ú
allow_fillrb   c               óŠ  — t        |«      rt        d|› d�«      ‚t        j                  |t        j                  ¬«      }d }|j
                  dk(  r$t        j                  g d¬«      }| j                  }n'|r| j                  ||¬«      }n| j                  |«      S  t        | «      || j                  | j                  |¬«      S )Nz*'indices' must be an array, not a scalar 'z'.r^   r   r¸   r  )rb   rŠ   r_   )r   rd   r`   ra   rM  Úsizer·   r_   Ú_take_with_fillÚ_take_without_fillr³   rb   rŠ   )rA   rÏ   r^  rb   r_   r•   s         rB   rN  zSparseArray.take=  s«   € Ü�WÔÜÐIÈ'ÈÐRTÐUÓVÐVÜ—*‘*˜W¬B¯H©HÔ5ˆàˆØ�<‰<˜1ÒÜ—X‘X˜b¨Ô1ˆFØ—J‘J‰EÙØ×)Ñ)¨'¸jÐ)ÓI‰Fà×*Ñ*¨7Ó3Ð3àŒt�D‹zØ˜tŸ™°T·Y±YÀeô
ð 	
rD   c                óŽ  — |€| j                   j                  }|j                  «       dk  rt        d«      ‚|j	                  «       t        | «      k\  rt        d«      ‚t        | «      dk(  rq|dk(  j                  «       rSt        j                  | j                  t        |«      «      }t        j                  ||¬«      }|j                  |«       |S t        d«      ‚| j                  j                  |«      }|dk(  }|dk(  | z  }| j                  j                   dk(  rR|j                  «       rBt        j"                  |j$                  | j&                  | j                   j(                  ¬«      }|S | j                  j                   dk(  rft        j                  | j                   j(                  t        |«      «      }t        j"                  |j$                  ||¬«      }| j&                  ||<   |S | j                  j+                  |«      }||   dk  }	||   dk  }
|j                   }|	j-                  «       rIt        j                  |t        | j&                  «      «      }|j/                  |«      }| j&                  ||<   |
j-                  «       r5t        j                  |t        |«      «      }|j/                  |«      }|||<   |S )Nr  zKInvalid value in 'indices'. Must be between -1 and the length of the array.ú!out of bounds value in 'indices'.r   r^   ú.cannot do a non-empty take from an empty axes.r
  )r_   r  r  rd   ÚmaxrÁ   rO  ro   r`   rÝ   r†   r³   Ú
empty_liker–   r�   Úlookup_arrayrÂ   rÞ   rC   rb   rc   rN  r‰   r€   )rA   rÏ   rb   r_   ÚtakenÚ
sp_indexerÚnew_fill_indicesÚold_fill_indicesr¬   Úm0Úm1rÝ   s               rB   ra  zSparseArray._take_with_fillO  sX  € ØÐØŸ™×,Ñ,ˆJà�;‰;‹=˜2ÒÜð/óð ð
 �;‰;‹=œC ›IÒ%ÜÐ@ÓAÐAäˆt‹9˜Š>à˜2‘×"Ñ"Ô$ÜŸ™ t§~¡~´t¸JÓ7GÓH�ÜŸ™ g°UÔ;�Ø—
‘
˜:Ô&Ø�ä Ð!QÓRÐRð
 —]‘]×/Ñ/°Ó8ˆ
Ø" b™=ÐØ&¨"Ñ,Ð1AÐ0AÑAÐà�=‰=× Ñ  AÒ%Ð*:×*>Ñ*>Ô*@ä—G‘GØ× Ñ ¨T¯_©_ÀDÇJÁJ×DVÑDVôˆEð@ ˆð9 �]‰]×"Ñ" aÒ'ä—^‘^ D§J¡J×$6Ñ$6¼¸ZÓ8HÓIˆFÜ—G‘G˜J×,Ñ,¸È6ÔRˆEØ&*§o¡oˆEÐ"Ñ#ð0 ˆð- —N‘N×'Ñ'¨
Ó3ˆEð Ð,Ñ-°Ñ1ˆBØÐ,Ñ-°Ñ1ˆBàŸ+™+ˆKà�v‰vŒxÜ Ÿn™n¨[¼$¸t¿¹Ó:OÓP�ØŸ™ [Ó1�Ø*.¯/©/�Ð&Ñ'à�v‰vŒxÜ Ÿn™n¨[¼$¸zÓ:JÓK�ØŸ™ [Ó1�Ø*4�Ð&Ñ'àˆrD   c                ó\  — |dk  }t        | «      }|j                  «       |k\  s|j                  «       | k  r|dk(  rt        d«      ‚t        d«      ‚|j	                  «       r|j                  «       }||xx   |z  cc<   | j                  j                  |«      }|dk7  }| j                  ||      }t        j                  |«      j                  t        j                  d¬«      }t        t        |«      || j                  ¬«      }t        | «      j!                  ||| j"                  ¬«      S )	Nr   re  rd  r  Frk   rB  r^   )rÁ   rf  r  rO  r‰   rl   r�   rh  r†   r`   rI  r€   rM  rK  rŠ   r³   rË   r_   )	rA   rÏ   Úto_shiftrX  rj  Ú
value_maskÚnew_sp_valuesÚvalue_indicesrW  s	            rB   rb  zSparseArray._take_without_fill‘  sý   € Ø˜Q‘;ˆä�‹Iˆà�K‰K‹M˜QÒ G§K¡K£M°Q°BÒ$6Ø�AŠvÜ Ð!QÓRÐRÜÐ@ÓAÐAà�<‰<Œ>Ø—l‘l“nˆGØ�HÓ Ñ"Óà—]‘]×/Ñ/°Ó8ˆ
Ø 2Ñ%ˆ
ØŸ™ z°*Ñ'=Ñ>ˆäŸ™ zÓ2×9Ñ9¼"¿(¹(ÈÐ9ÓOˆä(¬¨W«°}È4Ï9É9ÔUˆÜ�D‹z×%Ñ% m°\ÈÏÉÐ%ÓTÐTrD   c                ó  — t        d«      r&d}t        j                  |t        t	        «       ¬«       t        j                  |«      }t        j                  | | j                  j                  ¬«      j                  |||«      S )NÚperformance_warningsz(searchsorted requires high memory usage.r¯   r^   )
r   r¼   r½   r   r   r`   ra   r_   rc   Úsearchsorted)rA   ÚvÚsideÚsorterrå   s        rB   rv  zSparseArray.searchsorted¨  s_   € ô Ð,Ô-Ø<ˆCÜ�M‰M˜#Ô1Ô>NÓ>PÕQÜ�J‰J�q‹MˆÜ�z‰z˜$ d§j¡j×&8Ñ&8Ô9×FÑFÀqÈ$ÐPVÓWÐWrD   c                ó„   — | j                   j                  «       }| j                  || j                  | j                  «      S r>   )r†   rl   rË   r�   r_   )rA   rí   s     rB   rl   zSparseArray.copy´  s1   € Ø—‘×$Ñ$Ó&ˆØ×Ñ ¨¯©°t·z±zÓBÐBrD   c                ó¤  — |d   j                   }g }d}|r|d   j                  }nd}|dk(  r®g }|D ]p  }|j                  j                  j	                  «       }||z  }||j                  j
                  z  }|j                  |j                  «       |j                  |«       Œr t        j                  |«      }	t        j                  |«      }
t        ||
«      }nìg }g }|D ]—  }|j                  j                  «       }|j                  |j                  «       |j                  |j                  j	                  «       |z   «       |j                  |j                  «       ||j                  j
                  z  }Œ™ t        j                  |«      }	t        j                  |«      }t        j                  |«      }t        |||«      } | |	||¬«      S )Nr   rM   ©r¤   rb   )rb   rŠ   r�   rÏ   rl   rÑ   Úappendr†   r`   Úconcatenater   Úto_block_indexÚblocsÚblengthsr   )rÉ   Ú	to_concatrb   rí   rÑ   Úsp_kindrÏ   re   Úint_idxr¦   Úindices_arrr�   r�  r€  Ú	block_idxÚ	blocs_arrÚblengths_arrs                    rB   r  zSparseArray._concat_same_type¸  sŒ  € à˜q‘\×,Ñ,ˆ
àˆØˆáØ ‘l×'Ñ'‰GàˆGð �iÒØˆGã �ØŸ,™,×.Ñ.×3Ñ3Ó5�Ø˜6Ñ!�Ø˜#Ÿ,™,×-Ñ-Ñ-�à—‘˜cŸm™mÔ,Ø—‘˜wÕ'ð !ô —>‘> &Ó)ˆDÜŸ.™.¨Ó1ˆKÜ ¨Ó4‰Hð ˆHØˆEã �ØŸL™L×7Ñ7Ó9�	à—‘˜cŸm™mÔ,Ø—‘˜YŸ_™_×1Ñ1Ó3°fÑ<Ô=Ø—‘ 	× 2Ñ 2Ô3Ø˜#Ÿ,™,×-Ñ-Ñ-‘ð !ô —>‘> &Ó)ˆDÜŸ™ uÓ-ˆIÜŸ>™>¨(Ó3ˆLä! &¨)°\ÓBˆHá�4 h¸:ÔFÐFrD   c                ó  — || j                   k(  r|s| S | j                  «       S t        |«      }t        |t        «      s.t        j                  | «      }t        |«      }t        ||d¬«      S | j                  j                  |«      }t        |j                  «      }t        t
        j                  |«      }t        | j                  «      }t        |||¬«      }t        j                  |«      }| j                  || j                  |«      S )aN  
        Change the dtype of a SparseArray.

        The output will always be a SparseArray. To convert to a dense
        ndarray with a certain dtype, use :meth:`numpy.asarray`.

        Parameters
        ----------
        dtype : np.dtype or ExtensionDtype
            For SparseDtype, this changes the dtype of
            ``self.sp_values`` and the ``self.fill_value``.

            For other dtypes, this only changes the dtype of
            ``self.sp_values``.

        copy : bool, default True
            Whether to ensure a copy is made, even if not necessary.

        Returns
        -------
        SparseArray

        Examples
        --------
        >>> arr = pd.arrays.SparseArray([0, 0, 1, 2])
        >>> arr
        [0, 0, 1, 2]
        Fill: 0
        IntIndex
        Indices: array([2, 3], dtype=int32)

        >>> arr.astype(pd.SparseDtype(np.dtype("int32")))
        [0, 0, 1, 2]
        Fill: 0
        IntIndex
        Indices: array([2, 3], dtype=int32)

        Using a NumPy dtype with a different kind (e.g. float) will coerce
        just ``self.sp_values``.

        >>> arr.astype(pd.SparseDtype(np.dtype("float64")))
        ... # doctest: +NORMALIZE_WHITESPACE
        [nan, nan, 1.0, 2.0]
        Fill: nan
        IntIndex
        Indices: array([2, 3], dtype=int32)

        Using a SparseDtype, you can also change the fill value as well.

        >>> arr.astype(pd.SparseDtype("float64", fill_value=0.0))
        ... # doctest: +NORMALIZE_WHITESPACE
        [0.0, 0.0, 1.0, 2.0]
        Fill: 0.0
        IntIndex
        Indices: array([2, 3], dtype=int32)
        Frç   rk   )r¬   rl   r!   r²   r#   r`   ra   r-   r   r_   Úupdate_dtypeÚ_subtype_with_strr	   r†   rË   r�   )rA   r_   rl   Úfuture_dtyperí   rc   r†   s          rB   r€   zSparseArray.astypeí  s×   € ðr �D—K‘KÒÙØ�à—y‘y“{Ð"ä# EÓ*ˆÜ˜,¬Ô4ä—Z‘Z Ó%ˆFÜ3°FÓ;ˆFÜ ¨lÀÔGÐGà—
‘
×'Ñ'¨Ó.ˆÜ˜u×6Ñ6Ó7ˆÜ”r—x‘x Ó)ˆÜ/°·±Ó?ˆÜ  ¨°tÔ<ˆ	Ü—J‘J˜yÓ)ˆ	à×Ñ 	¨4¯=©=¸%Ó@Ð@rD   c                óD  ‡‡‡— t        ‰t        j                  t        f«      Š| j                  Š|�t        ‰«      r‰r‰j                  ‰‰«      n ‰‰«      Šˆˆˆfd„}| j                  D �cg c]
  } ||«      ‘Œ }} t        | «      || j                  ‰¬«      S c c}w )af  
        Map categories using an input mapping or function.

        Parameters
        ----------
        mapper : dict, Series, callable
            The correspondence from old values to new.
        na_action : {None, 'ignore'}, default None
            If 'ignore', propagate NA values, without passing them to the
            mapping correspondence.

        Returns
        -------
        SparseArray
            The output array will have the same density as the input.
            The output fill value will be the result of applying the
            mapping to ``self.fill_value``

        Examples
        --------
        >>> arr = pd.arrays.SparseArray([0, 1, 2])
        >>> arr.map(lambda x: x + 10)
        [10, 11, 12]
        Fill: 10
        IntIndex
        Indices: array([1, 2], dtype=int32)

        >>> arr.map({0: 10, 1: 11, 2: 12})
        [10, 11, 12]
        Fill: 10
        IntIndex
        Indices: array([1, 2], dtype=int32)

        >>> arr.map(pd.Series([10, 11, 12], index=[0, 1, 2]))
        [10, 11, 12]
        Fill: 10
        IntIndex
        Indices: array([1, 2], dtype=int32)
        c                ól   •— ‰r‰j                  | d «      n ‰| «      }|‰u s|‰k(  rd}t        |«      ‚|S )Nz-fill value in the sparse values not supported)Úgetrd   )Úsp_valÚ
new_sp_valrå   Úfill_valÚis_mapÚmappers      €€€rB   ÚfunczSparseArray.map.<locals>.funck  s?   ø€ Ù5;˜Ÿ™ F¨DÔ1ÁÈÃˆJà˜XÑ%¨°xÒ)?ØE�Ü  “oÐ%ØÐrD   r|  )
r²   r   ÚMappingr%   rb   r(   r�  r†   r³   r�   )rA   r”  Ú	na_actionr•  Úxr†   r’  r“  s    `    @@rB   ÚmapzSparseArray.map<  sŠ   ú€ ôP ˜F¤S§[¡[´)Ð$<Ó=ˆà—?‘?ˆàÐ¤ h¤Ù9?�v—z‘z (¨HÔ5ÁVÈHÓEUˆHö	ð '+§n¢nÓ5¡n ‘T˜!•W nˆ	Ð5àŒt�D‹z˜)°$·-±-ÈHÔUÐUùò 6s   Á.Bc                óX   — t        j                  | | j                  j                  ¬«      S )zr
        Convert SparseArray to a NumPy array.

        Returns
        -------
        arr : NumPy array
        r^   )r`   ra   r†   r_   r@   s    rB   r„   zSparseArray.to_densew  s   € ô �z‰z˜$ d§n¡n×&:Ñ&:Ô;Ð;rD   c                ó®   — t        j                  || |«      }t        |j                  | j                  ¬«      }t        | «      j                  ||¬«      }|S )Nr  r^   )r`   r  r#   r_   rb   r³   rë   )rA   rý   rä   Únaive_implementationr_   r•   s         rB   Ú_wherezSparseArray._where�  sM   € ô  "Ÿx™x¨¨d°EÓ:ÐÜÐ0×6Ñ6À4Ç?Á?ÔSˆÜ�d“×*Ñ*Ð+?ÀuÐ*ÓMˆØˆrD   c                ó
  — t        |t        «      rX|\  }\  }}t        j                  g «      }|j	                  |«       || _        || _        t        |j                  |«      | _	        y| j                  j                  |«       y)z*Necessary for making this object picklableN)r²   rC  r`   r·   Ú__setstate__r«   r©   r#   r_   r¬   Ú__dict__Úupdate)rA   ÚstateÚnd_staterb   r�   rÅ   s         rB   rŸ  zSparseArray.__setstate__Œ  sl   € ä�eœUÔ#à/4Ñ,ˆHÑ,�z 8ÜŸH™H R›LˆMØ×&Ñ& xÔ0à"/ˆDÔØ!)ˆDÔÜ% m×&9Ñ&9¸:ÓFˆD�Kà�M‰M× Ñ  Õ'rD   c                óœ   — | j                   dk(  r| j                  j                  fS | j                  j                  | j                  dk7     fS )Nr   )rb   r�   rÏ   r†   r@   s    rB   ÚnonzerozSparseArray.nonzeroš  sB   € Ø�?‰?˜aÒØ—M‘M×)Ñ)Ð+Ð+à—M‘M×)Ñ)¨$¯.©.¸AÑ*=Ñ>Ð@Ð@rD   )ÚskipnaÚkeepdimsc               óè   — t        | |d «      }|€t        d|› d| j                  › �«      ‚|r| }n| j                  «       } t        ||«      di |¤Ž}|r t	        | «      |g| j                  ¬«      S |S )Nzcannot perform z with type r^   r?   )r‹   r¶   r_   r6  r³   )rA   r‘   r¦  r§  ÚkwargsÚmethodre   r•   s           rB   Ú_reducezSparseArray._reduce¤  s}   € ô ˜˜t TÓ*ˆàˆ>Ü˜o¨d¨V°;¸t¿z¹z¸lÐKÓLÐLáØ‰Cà—+‘+“-ˆCà#”˜˜dÓ#Ñ- fÑ-ˆáØ”4˜“:˜v˜h¨d¯j©jÔ9Ð9àˆMrD   c                óÔ   — t        j                  ||«       | j                  }t        |«      t        | «      k7  r t	        j
                  | j                  «      sy|j                  «       S )z£
        Tests whether all elements evaluate True

        Returns
        -------
        all : bool

        See Also
        --------
        numpy.all
        F)ÚnvÚvalidate_allr†   rÁ   r`   ro   rb   ©rA   ÚaxisÚargsr©  rí   s        rB   ro   zSparseArray.all¸  sI   € ô 	�‰˜˜fÔ%à—‘ˆäˆv‹;œ#˜d›)Ò#¬B¯F©F°4·?±?Ô,CØà�z‰z‹|ÐrD   c                óð   — t        j                  ||«       | j                  }t        |«      t        | «      k7  r t	        j
                  | j                  «      ry|j                  «       j                  «       S )z¯
        Tests whether at least one of elements evaluate True

        Returns
        -------
        any : bool

        See Also
        --------
        numpy.any
        T)r­  Úvalidate_anyr†   rÁ   r`   r‰   rb   rÐ   r¯  s        rB   r‰   zSparseArray.anyÍ  sR   € ô 	�‰˜˜fÔ%à—‘ˆäˆv‹;œ#˜d›)Ò#¬¯©¨t¯©Ô(?Øà�z‰z‹|× Ñ Ó"Ð"rD   c                óR  — t        j                  ||«       | j                  }|j                  «       }| j                  j
                  dkD  xr | j                   }|r#|s!t        | j                  j                  d¬«      S | j                  r:t        |j                  d|«      r!t        | j                  j                  d¬«      S |S | j                  j
                  }	t        |j                  d||	z
  «      r!t        | j                  j                  d¬«      S || j                  |	z  z   S )a  
        Sum of non-NA/null values

        Parameters
        ----------
        axis : int, default 0
            Not Used. NumPy compatibility.
        min_count : int, default 0
            The required number of valid values to perform the summation. If fewer
            than ``min_count`` valid values are present, the result will be the missing
            value indicator for subarray type.
        *args, **kwargs
            Not Used. NumPy compatibility.

        Returns
        -------
        scalar
        r   F©ÚcompatN)r­  Úvalidate_sumrþ   Úsumr�   r‚   r  r'   r_   rc   r2   rC   rb   )
rA   r°  Ú	min_countr¦  r±  r©  Ú
valid_valsÚsp_sumÚhas_naÚnsparses
             rB   r¸  zSparseArray.sumâ  sï   € ô4 	�‰˜˜fÔ%Ø×*Ñ*ˆ
Ø—‘Ó!ˆØ—‘×$Ñ$ qÑ(ÒF°×1FÑ1FÐ-Fˆá™&Ü% d§j¡j×&8Ñ&8ÀÔGÐGà× Ò Ü$ Z×%5Ñ%5°t¸YÔGÜ)¨$¯*©*×*<Ñ*<ÀUÔKÐKØˆMà—m‘m×)Ñ)ˆGÜ$ Z×%5Ñ%5°t¸YÈÑ=PÔQÜ)¨$¯*©*×*<Ñ*<ÀUÔKÐKØ˜DŸO™O¨gÑ5Ñ5Ð5rD   c                óh  — t        j                  ||«       |�|| j                  k\  rt        d|› d�«      ‚| j                  s7t        | j                  «       t        j                  ¬«      j                  «       S t        | j                  j                  «       | j                  | j                  ¬«      S )a   
        Cumulative sum of non-NA/null values.

        When performing the cumulative summation, any non-NA/null values will
        be skipped. The resulting SparseArray will preserve the locations of
        NaN values, but the fill value will be `np.nan` regardless.

        Parameters
        ----------
        axis : int or None
            Axis over which to perform the cumulative summation. If None,
            perform cumulative summation over flattened array.

        Returns
        -------
        cumsum : SparseArray
        zaxis(=z) out of boundsr  r|  )r­  Úvalidate_cumsumÚndimrd   r  r\   r„   r`   rº   Úcumsumr†   r�   rb   )rA   r°  r±  r©  s       rB   rÁ  zSparseArray.cumsum  s�   € ô$ 	×Ñ˜4 Ô(àÐ ¨¯	©	Ò 1Ü˜v d V¨?Ð;Ó<Ð<à×$Ò$Ü˜tŸ}™}›¼2¿6¹6ÔB×IÑIÓKÐKäØ�N‰N×!Ñ!Ó#ØŸ™Ø—‘ô
ð 	
rD   c                óú   — t        j                  ||«       | j                  }|j                  «       }t	        |«      }| j
                  r||z  S | j                  j                  }|| j                  |z  z   ||z   z  S )zb
        Mean of non-NA/null values

        Returns
        -------
        mean : float
        )	r­  Úvalidate_meanrþ   r¸  rÁ   r  r�   r‚   rb   )rA   r°  r±  r©  rº  r»  Úctr½  s           rB   ÚmeanzSparseArray.mean.  ss   € ô 	×Ñ˜˜vÔ&Ø×*Ñ*ˆ
Ø—‘Ó!ˆÜ�‹_ˆà× Ò Ø˜B‘;Ðà—m‘m×)Ñ)ˆGØ˜TŸ_™_¨wÑ6Ñ6¸2À¹<ÑHÐHrD   )r°  r¦  c               óh   — t        j                  || j                  «       | j                  d|¬«      S )a4  
        Max of array values, ignoring NA values if specified.

        Parameters
        ----------
        axis : int, default 0
            Not Used. NumPy compatibility.
        skipna : bool, default True
            Whether to ignore NA values.

        Returns
        -------
        scalar
        rf  ©r¦  ©r­  Úvalidate_minmax_axisrÀ  Ú_min_max©rA   r°  r¦  s      rB   rf  zSparseArray.maxA  ó+   € ô 	×Ñ  d§i¡iÔ0Ø�}‰}˜U¨6ˆ}Ó2Ð2rD   c               óh   — t        j                  || j                  «       | j                  d|¬«      S )a4  
        Min of array values, ignoring NA values if specified.

        Parameters
        ----------
        axis : int, default 0
            Not Used. NumPy compatibility.
        skipna : bool, default True
            Whether to ignore NA values.

        Returns
        -------
        scalar
        r  rÇ  rÈ  rË  s      rB   r  zSparseArray.minS  rÌ  rD   c                óÒ  — | j                   }| j                   xr | j                  j                  dkD  }t	        |«      dkD  rw t        ||«      «       }|r$|dk(  rt        nt        } ||| j                  «      S |r|S | j                  j                  dk(  r|S t        | j                  j                  d¬«      S |r| j                  S t        | j                  j                  d¬«      S )zº
        Min/max of non-NA/null values

        Parameters
        ----------
        kind : {"min", "max"}
        skipna : bool

        Returns
        -------
        scalar
        r   rf  Frµ  )rþ   r  r�   r‚   rÁ   r‹   rf  r  rb   r'   r_   rc   )rA   rŠ   r¦  rº  Úhas_nonnull_fill_valsÚ
sp_min_maxr•  s          rB   rÊ  zSparseArray._min_maxe  sÏ   € ð ×*Ñ*ˆ
Ø$(×$9Ñ$9Ð 9Ò U¸d¿m¹m×>QÑ>QÐTUÑ>UÐäˆz‹?˜QÒØ2œ ¨TÓ2Ó4ˆJñ %Ø" ešm•s´�Ù˜J¨¯©Ó8Ð8ÙØ!Ð!Ø—‘×$Ñ$¨Ò)à!Ð!ä)¨$¯*©*×*<Ñ*<ÀUÔKÐKÙ"Ø—?‘?Ð"ä% d§j¡j×&8Ñ&8ÀÔGÐGrD   c                ó  — | j                   }| j                  j                  }t        j                  t        |«      «      }|dk(  rt        j                  nt        j                  }t        j                  |j                  d   «      }||    }||    }| ||«         }	||	   }
t        | j                  «      r|
S |dk(  r| |
   | j                  k  r|
S |dk(  r| |
   | j                  kD  r|
S | j                  «       }|dk(  r|
S |S )Nr!  r   Úargminr  )r«   r©   rÏ   r`   ra   r&   r!  rÒ  rL  rC   rb   r"  )rA   rŠ   rí   r—   rý   r•  rÔ   Únon_nansÚnon_nan_idxÚ
_candidateÚ	candidateÚ_locs               rB   Ú_argmin_argmaxzSparseArray._argmin_argmaxˆ  sö   € Ø×$Ñ$ˆØ×"Ñ"×*Ñ*ˆÜ�z‰zœ$˜v›,Ó'ˆØ  HÒ,Œr�yŠy´"·)±)ˆä�i‰i˜Ÿ™ Q™Ó(ˆØ˜4˜%‘=ˆØ˜4˜%‘jˆà ¡ h£Ñ0ˆ
Ø˜*Ñ%ˆ	ä�—‘Ô ØÐØ�8Ò  Y¡°$·/±/Ò AØÐØ�8Ò  Y¡°$·/±/Ò AØÐØ×)Ñ)Ó+ˆØ�2Š:àÐàˆKrD   c                ón   — t        |d«       |s| j                  rt        d«      ‚| j                  d«      S )Nr¦  ú)Encountered an NA value with skipna=Falser!  ©r   Ú_hasnard   rØ  ©rA   r¦  s     rB   r!  zSparseArray.argmax¢  ó2   € Ü˜F HÔ-Ù˜$Ÿ+š+ÜÐHÓIÐIØ×"Ñ" 8Ó,Ð,rD   c                ón   — t        |d«       |s| j                  rt        d«      ‚| j                  d«      S )Nr¦  rÚ  rÒ  rÛ  rÝ  s     rB   rÒ  zSparseArray.argmin¨  rÞ  rD   c                ó¶  ‡ — |j                  dd«      }||z   D ])  }t        |g ‰ j                  ¢t        ‘­«      rŒ#t        c S  t        j                  ‰ ||g|¢­i |¤Ž}|t        ur|S d|v rt        j                  ‰ ||g|¢­i |¤Ž}|S |dk(  r%t        j                  ‰ ||g|¢­i |¤Ž}|t        ur|S t        |«      dk(  r£ t        ||«      ‰ j                  fi |¤Ž}	 t        ||«      ‰ j                  fi |¤Ž}
|j                  dkD  r"t        ˆ fd„t        |	|
d¬«      D «       «      }|S |dk(  r|	S ‰ j!                  |	‰ j"                  t%        |	j&                  |
«      «      S t        d„ |D «       «      } t        ||«      |i |¤Ž}|rt        |«      dk(  r|d	   }|S |j                  dkD  rt        ˆ fd
„|D «       «      S |dk(  ry  t)        ‰ «      |«      S )Nrà   r?   Úreducerq   c           	   3  ó†   •K  — | ]8  \  }}‰j                  |‰j                  t        |j                  |«      «      –— Œ: y ­wr>   )rË   r�   r#   r_   )Ú.0Úsp_valueÚfvrA   s      €rB   Ú	<genexpr>z.SparseArray.__array_ufunc__.<locals>.<genexpr>Ø  sD   øè ø€ ð ñ )P™˜ "ð ×$Ñ$Ø  $§-¡-´¸X¿^¹^ÈRÓ1P÷ñ )Pùs   ƒ>AT)Ústrictc              3  óF   K  — | ]  }t        j                  |«      –— Œ y ­wr>   )r`   ra   )rã  r˜  s     rB   ræ  z.SparseArray.__array_ufunc__.<locals>.<genexpr>ç  s   è ø€ Ð9±&¨Qœ2Ÿ:™: aŸ=±&ùs   ‚!r   c              3  ó@   •K  — | ]  } t        ‰«      |«      –— Œ y ­wr>   )r³   )rã  r˜  rA   s     €rB   ræ  z.SparseArray.__array_ufunc__.<locals>.<genexpr>ï  s   øè ø€ Ð7±¨1˜œ˜d› AŸ±ùs   ƒÚat)r�  r²   Ú_HANDLED_TYPESr\   ÚNotImplementedr)   Ú!maybe_dispatch_ufunc_to_dunder_opÚdispatch_ufunc_with_outÚdispatch_reduction_ufuncrÁ   r‹   r†   rb   ÚnoutrC  ÚziprË   r�   r#   r_   r³   )rA   Úufuncrª  Úinputsr©  rà   r˜  r•   ró   r†   rb   ÚarraysÚ
new_inputss   `            rB   Ú__array_ufunc__zSparseArray.__array_ufunc__´  s  ø€ Ø�j‰j˜ Ó#ˆà˜#”ˆAÜ˜aÐ!D 4×#6Ñ#6Ð!D¼Ñ!DÕEÜ%Ò%ð ô
 ×<Ñ<Ø�%˜ð
Ø"(ò
Ø,2ñ
ˆð œÑ'ØˆMà�F‰?ä×3Ñ3Ø�e˜VðØ&,òØ06ñˆCð ˆJà�XÒÜ×7Ñ7Ø�e˜VðØ&,òØ06ñˆFð œ^Ñ+à�äˆv‹;˜!Òà.œ  vÓ.¨t¯~©~ÑHÀÑHˆIØ/œ ¨Ó/°·±ÑJÀ6ÑJˆJà�z‰z˜AŠ~äó ô ),¨I°zÈ$Õ(Oó	ó �ð �Ø˜8Ò#à Ð à×#Ñ#Ø˜4Ÿ=™=¬+°i·o±oÀzÓ*Róð ô Ñ9±&Ó9Ó9ˆ
Ø'”˜ Ó'¨Ð>°vÑ>ˆÙÜ�3‹x˜1Š}Ø˜!‘f�ØˆJà�:‰:˜Š>ÜÓ7±Ó7Ó7Ð7Ø�tŠ^àà”4˜“:˜fÓ%Ð%rD   c           	     ó^  — |j                   }t        |t        «      rt        | |||«      S t	        |«      r®t        j                  d¬«      5   |t        | «      t        j                  |«      «      } || j                  |«      }d d d «       |dk(  r:\  }}\  }}	t        ||| j                  |«      t        ||| j                  |	«      fS t        || j                  «      S t        j                  |«      }t        j                  d¬«      5  t        | «      t        |«      k7  r#t        dt        | «      › dt        |«      › �«      ‚t        |t        «      s%t        |dd «      }
t        || j                  |
¬«      }t        | |||«      cd d d «       S # 1 sw Y   �ŒxY w# 1 sw Y   y xY w)Nrm   rn   r~   zlength mismatch: z vs. r_   r
  )rH   r²   r\   rœ   r   r`   rƒ   rf   ra   r†   r�   r�   rÁ   rÃ   r‹   rb   )rA   Úotherr�   Úop_namer–   r•   rŽ   r�   ÚlfillÚrfillr_   s              rB   Ú_arith_methodzSparseArray._arith_methodú  so  € Ø—+‘+ˆä�eœ[Ô)Ü# D¨%°°WÓ=Ð=ä�uÔÜ—‘ Ö*Ùœ) D›/¬2¯:©:°eÓ+<Ó=�Ù˜DŸN™N¨EÓ2�÷ +ð ˜(Ò"Ø$‘��eØ#‘��uä  ¨$°·±¸uÓEÜ  ¨%°·±ÀÓFðð ô
   ¨°·±ÀÓEÐEô —J‘J˜uÓ%ˆEÜ—‘ Ö*Ü�t“9¤ E£
Ò*Ü(Ø+¬C°«I¨;°e¼CÀ»J¸<ÐHóð ô " %¬Ô5Ü# E¨7°DÓ9�EÜ'¨¸$¿/¹/ÐQVÔW�EÜ'¨¨e°R¸ÓA÷ +Ñ*÷! +Ñ*ú÷  +Ð*ús   Á9FÄA=F#ÆF Æ#F,c                óÐ  — t        |«      s*t        |t        | «      «      st        j                  |«      }t        |t        j
                  «      rt        || j                  ¬«      }t        |t        «      rct        | «      t        |«      k7  r#t        dt        | «      › dt        |«      › �«      ‚|j                  j                  d«      }t        | |||«      S  || j                  |«      }t        j                  t        | «      |t        j                  ¬«      } || j                  |«      || j                   j"                  <    t        | «      ||t        j                  ¬«      S )Nr  z operands have mismatched length z and rx   r^   r
  )r   r²   r³   r`   ra   r»   r\   rb   rÁ   rd   rH   Ústriprœ   rÞ   r  r†   r�   rÏ   )rA   rø  r�   rù  rb   r•   s         rB   Ú_cmp_methodzSparseArray._cmp_method  s  € Ü˜Ô¬
°5¼$¸t»*Ô(Eä—J‘J˜uÓ%ˆEä�eœRŸZ™ZÔ(ä °$·/±/ÔBˆEä�eœ[Ô)Ü�4‹yœC ›JÒ&Ü Ø6´s¸4³y°kÀÄsÈ5ÃzÀlÐSóð ð —k‘k×'Ñ'¨Ó,ˆGÜ# D¨%°°WÓ=Ð=ñ ˜DŸO™O¨UÓ3ˆJÜ—W‘WœS ›Y¨
¼"¿(¹(ÔCˆFÙ,.¨t¯~©~¸uÓ,EˆF�4—=‘=×(Ñ(Ñ)à”4˜“:ØØ%Ü—h‘hôð rD   c                óÂ  —  |t        j                  | j                  «      «      j                  «       }t	        | j
                  j                  |«      }t        | j                  «      s|| j                  k(  rB || j                  «      }t        | «      j                  || j                  | j
                  «      S  t        | «       || j                  «       «      |¬«      S ré   )r`   r·   rb   rÐ   r#   r_   rc   r&   r†   r³   rË   r�   r„   )rA   r�   rb   r_   rí   s        rB   Ú_unary_methodzSparseArray._unary_method:  sž   € ÙœŸ™ §¡Ó1Ó2×7Ñ7Ó9ˆ
Ü˜DŸJ™J×.Ñ.°
Ó;ˆô �—‘Ô  J°$·/±/Ò$AÙ˜Ÿ™Ó'ˆFÜ˜“:×)Ñ)¨&°$·-±-ÀÇÁÓLÐLàŒt�D‹z™"˜TŸ]™]›_Ó-°UÔ;Ð;rD   c                ó@   — | j                  t        j                  «      S r>   )r  ÚoperatorÚposr@   s    rB   Ú__pos__zSparseArray.__pos__E  ó   € Ø×!Ñ!¤(§,¡,Ó/Ð/rD   c                ó@   — | j                  t        j                  «      S r>   )r  r  Únegr@   s    rB   Ú__neg__zSparseArray.__neg__H  r  rD   c                ó@   — | j                  t        j                  «      S r>   )r  r  Úinvertr@   s    rB   Ú
__invert__zSparseArray.__invert__K  s   € Ø×!Ñ!¤(§/¡/Ó2Ð2rD   c                ó@   — | j                  t        j                  «      S r>   )r  r  r  r@   s    rB   Ú__abs__zSparseArray.__abs__N  r  rD   c                ó¼   — t        j                  | «      }t        j                  | j                  «      }t        j                  | j                  «      }|› d|› d|› �S )Nz
Fill: Ú
)r3   Úpprint_thingrb   r�   )rA   Úpp_strÚpp_fillÚpp_indexs       rB   Ú__repr__zSparseArray.__repr__T  sQ   € Ü×&Ñ& tÓ,ˆÜ×'Ñ'¨¯©Ó8ˆÜ×(Ñ(¨¯©Ó7ˆØ�˜ ' ¨"¨X¨JÐ7Ð7rD   c                 ó   — y r>   r?   )rA   Úboxeds     rB   Ú
_formatterzSparseArray._formatter\  s   € ð rD   )NNrM   NF)rŠ   ÚSparseIndexKindr_   úDtype | Nonerl   ru   rG   ÚNone)r¨   rª   r¤   r   r_   r#   rG   r   )r¦   r<   rG   r   )NN)r_   zNpDtype | Nonerl   zbool | NonerG   rª   )rG   r  )r_   r  rl   ru   rG   r   )rG   r   )rG   r   )rG   rª   )rG   r#   )rG   r  )rG   Úint)rG   ru   )rG   Úfloat)NT)r  z
int | Nonerl   ru   rG   r   )rq   N)r  r  rG   r   )Úfirst)r$  zLiteral['first', 'last', False]rG   znpt.NDArray[np.bool_])T)r0  ru   rG   ztuple[np.ndarray, SparseArray])r6  ru   rG   rZ   )rã   rW   rG   r   )rã   z0SequenceIndexer | tuple[int | EllipsisType, ...]rG   r   )rã   z2PositionalIndexer | tuple[int | EllipsisType, ...]rG   z
Self | Any)r^  ru   rG   r   r>   )rŽ   N)rw  zArrayLike | objectrx  zLiteral['left', 'right']ry  zNumpySorter | NonerG   znpt.NDArray[np.intp] | np.intp)r‚  zSequence[Self]rG   r   )r_   zAstypeArg | Nonerl   ru   )r—  zLiteral['ignore'] | NonerG   r   )rG   ztuple[npt.NDArray[np.int32]])r‘   r´   r¦  ru   r§  ru   )r   )r°  rR   rG   ru   )r   r   T)r°  rR   r¹  r  r¦  ru   rG   rV   )r°  rR   rG   r\   )r°  rQ   )r°  zAxisInt | Noner¦  ru   )rŠ   zLiteral['min', 'max']r¦  ru   rG   rV   )rŠ   zLiteral['argmin', 'argmax']rG   r  )r¦  ru   rG   r  )rò  znp.ufuncrª  r´   )rG   r\   )rG   r´   )F)r  ru   rG   r  )UrH   rI   rJ   Ú__doc__Ú_subtypr,   Ú_hidden_attrsÚ	frozensetÚ__annotations__rÆ   ÚclassmethodrË   rÖ   rá   ræ   rë   rï   rô   rK   r�   r†   r_   rb   ÚsetterrŠ   rþ   r   r  r  r  rÂ   r&   r  r  r"  r   r+   r&  r(  r.  r1  r<  r
   r?  rD  rN  ra  rb  rv  rl   r  r€   r™  r„   r�  rŸ  r¥  r«  ro   r‰   r¸  rÁ  rÅ  rf  r  rÊ  rØ  r!  rÒ  r`   r»   ÚnumbersÚNumberrë  rö  rü  rÿ  Ú_logical_methodr  r  r	  r  r  r  r  r?   rD   rB   r\   r\   '  s�  … ñNð` €GØ ×.Ñ.±¸2³Ñ>€MØÓØÓØÓð
 ØØ )Ø"Øð{Cð
 ð{Cð ð{Cð ð{Cð 
ó{Cðz ð
à ð
ð "ð
ð ð	
ð
 
ò
ó ð
ð ò)2ó ð)2ðX AEð'Ø#ð'Ø2=ð'à	ó'óRð à/3À%ñ)Ø ,ð)Ø;?ð)à	ò)ó ð)ð
 ò1ó ð1ò5ð* ò"ó ð"ð ò#ó ð#ð2 òó ðð ñ%ó ð%ð0 ×Ñò=ó ð=ð òó ðð òó ðó
$ð ò-ó ð-ð ò<ó ð<ð ò<ó ð<ð$ ò%ó ð%ó6?ð !Øð	+Kð ð+Kð ð	+Kð
 
ó+KôZ-ò60ñ* 	ˆ×	"Ñ	"Ó#à6=ð>Ø3ð>à	ò>ó $ð>óDò1ð !%ð!àð!ð 
(ó!ô&7ðV Ú9ó Ø9àðà=ðð 
òó ðð
Z6à?ðZ6ð 
óZ6òx	ð 38ÀDõ 
ô$@óDUð4 *0Ø%)ð	
Xàð
Xð 'ð
Xð #ð	
Xð
 
(ó
XóCð ò2Gó ð2GôhMAô^9Vóv<òó(óAð ,0À%ñØðØ$(ðØ;?óó(ô*#ð. ØØð	*6àð*6ð ð*6ð ð	*6ð 
ó*6ôX
ô@Ið& -1Àõ 3ð$ -1Àõ 3ó$!HóFô4-ô-ð —j‘j '§.¡.Ð1€Nó@&òLBóBð: "€Oó	<ó0ó0ó3ó0ó8õrD   c                óÌ  — t        | t        j                  «      sJ ‚| j                  dkD  rt	        d«      ‚|€t        | j                  «      }t        |«      rt        | «      }n[t        | j                  «      r| j                  t        «      } t        | j                  «      rt        j                  | |«      }n| |k7  }t        | «      }|t        |«      k7  r|j                   j"                  }n0|j%                  «       d   j                  t        j&                  «      }t)        |||«      }| |   }|�-t+        |«      }t-        ||¬«      }t        j.                  |«      }|||fS )a@  
    Convert ndarray to sparse format

    Parameters
    ----------
    arr : ndarray
    kind : {'block', 'integer'}
    fill_value : NaN or another value
    dtype : np.dtype, optional
    copy : bool, default False

    Returns
    -------
    (sparse_values, index, fill_value) : (ndarray, SparseIndex, Scalar)
    rq   zexpected dimension <= 1 datar   r^   )r²   r`   r»   rÀ  r¶   r'   r_   r&   r(   r    r€   r¸   r   rŒ   Úmake_mask_object_ndarrayrÁ   r�   rÏ   r¥  rM  rK  r-   r   ra   )	re   rŠ   rb   r_   rý   rÑ   rÏ   r—   Úsparsified_valuess	            rB   rÀ   rÀ   b  s4  € ô* �cœ2Ÿ:™:Ô&Ð&Ð&à
‡x�x�!‚|ÜÐ6Ó7Ð7àÐÜ'¨¯	©	Ó2ˆ
äˆJÔÜ�S‹z‰ô ˜3Ÿ9™9Ô%Ø—*‘*œVÓ$ˆCä˜3Ÿ9™9Ô%ô ×1Ñ1°#°zÓB‰Dà˜*Ñ$ˆDä�‹X€FØ”�T“Òà—-‘-×'Ñ'‰à—,‘,“. Ñ#×*Ñ*¬2¯8©8Ó4ˆä˜f g¨tÓ4€EØ˜D™	ÐØÐÜ:Ð;LÓMÐÜ(Ð):À%ÔHÐÜŸJ™JÐ'8Ó9Ðð ˜e ZÐ/Ð/rD   c                 ó   — y r>   r?   ©rÑ   rÏ   rŠ   s      rB   rK  rK     ó   € ØSVrD   c                 ó   — y r>   r?   r-  s      rB   rK  rK  ¤  r.  rD   c                ó–   — |dk(  r't        j                  |«      \  }}t        | ||«      }|S |dk(  rt        | |«      }|S t	        d«      ‚)NrN   rM   zmust be block or integer type)rŒ   Ú
get_blocksr   r   rd   )rÑ   rÏ   rŠ   ÚlocsÚlensr—   s         rB   rK  rK  ¨  s]   € àˆw‚Ü×%Ñ% gÓ.‰
ˆˆdÜ˜6 4¨Ó.ˆð
 €Lð	 
�Ò	Ü˜ Ó)ˆð €Lô Ð8Ó9Ð9rD   )re   r\   rG   rª   )
rŽ   r\   r�   r\   r�   r4   r‘   r´   rG   r\   r>   )r‘   r´   r_   r  rG   r\   )rN   NN)re   rª   rŠ   r  r_   znp.dtype | None)rÑ   r  rŠ   zLiteral['block']rG   r   )rÑ   r  rŠ   zLiteral['integer']rG   r   )rÑ   r  rŠ   r  rG   r   )~r  Ú
__future__r   Úcollectionsr   r&  r  Útypingr   r   r   r   r	   r
   r¼   Únumpyr`   Úpandas._config.configr   Úpandas._libsr   Úpandas._libs.sparseÚ_libsÚsparserŒ   r   r   r   Úpandas._libs.tslibsr   Úpandas.compat.numpyr   r­  Úpandas.errorsr   Úpandas.util._decoratorsr   r   Úpandas.util._exceptionsr   Úpandas.util._validatorsr   r   Úpandas.core.dtypes.astyper   Úpandas.core.dtypes.castr   r   Úpandas.core.dtypes.commonr   r   r   r   r   r    r!   Úpandas.core.dtypes.dtypesr"   r#   Úpandas.core.dtypes.genericr$   r%   Úpandas.core.dtypes.missingr&   r'   r(   Úpandas.corer)   Úpandas.core.algorithmsÚcoreÚ
algorithmsr%  Úpandas.core.arrayliker*   Úpandas.core.arraysr+   Úpandas.core.baser,   Úpandas.core.commonÚcommonrP  Úpandas.core.constructionr-   r.   r/   Úpandas.core.indexersr0   r1   Úpandas.core.nanopsr2   Úpandas.io.formatsr3   Úcollections.abcr4   r5   Útypesr6   r7   r8   Úscipy.sparser9   r:   r<   Úpandas._typingrL   r  rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   r7  rZ   Ú_sparray_doc_kwargsrf   rœ   r�   r\   rÀ   rK  r?   rD   rB   Ú<module>r[     sû  ðñõ #å Û Û ÷÷ ó ã å ,å ß #Ð #÷ñ õ
 $Ý .Ý ,÷õ 5÷õ
 3÷÷÷ ñ ÷÷÷ñ õ "ß &Ð &Ý *Ý -Ý )ß  Ð  ÷ñ ÷
õ 5å &á÷õ #÷÷
ð
 ô:˜Hó :ó ð:õ
 +àÐ0Ñ1€O÷÷ ÷ ñ õ ð  Ð.Ð ó*ð0iGØ
ðiGØ)ðiGØ/7ðiGØ?BðiGàóiGðZ FJðØ
ðØ6Bðàóñ. ˆOÓôw�(˜L¨.ó wó ðwðx1 $ØØ!ð	;0Ø	ð;0à
ð;0ð ó	;0ð| 
Ú Vó 
Ø Vð 
Ú Vó 
Ø Vô	rD   