
    Mh                   h   S SK Jr  S SKJr  S SKrS SKrS SKJrJrJ	r	J
r
JrJr  S SK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  S SKJrJr  S SKJr  S S	KJ r J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+  S S
K,J-r-  S SK.J/r/  S SK0J1r1  S SK2J3r3  S SK4J5r5J6r6  S SK7J8r8J9r9J:r:J;r;J<r<J=r=  S SK>J?r?J@r@JArAJBrBJCrCJDrD  S SKEJFrFJGrGJHrHJIrIJJrJ  S SKKJLrLJMrMJNrNJOrO  S SKPJQrQJRrRJSrS  S SKTJUrU  S SKVJWs  JXrY  S SKZJ[r[J\r\J]r]J^r^J_r_  S SK`Jara  S SKbJcrcJdrdJere  S SKfJgrg  S SKhJiriJjrjJkrkJlrlJmrmJnrnJoro  S SKpJqrq  S SKrJWs  Jsrt  S SKuJvrv  S SKwJxrxJyry  S SKzJ{r{  S SK|J}r}  \(       a  S SK~JrJr  S S KJr  S S!KJr  \GR
                  " S"5      rS#rS$rSBS% jr " S& S'\q\GR                  5      r " S( S)\5      r " S* S+\5      r " S, S-\5      r " S. S/\5      r " S0 S1\5      r " S2 S3\5      r " S4 S5\5      r " S6 S7\5      rSCS8 jrSDS9 jr SE     SFS: jjrSS;.       SGS< jjrSHS= jr        SIS> jrSESJS? jjrSKSLS@ jjrSCSA jrg)M    )annotations)wrapsN)TYPE_CHECKINGAnyCallableLiteralcastfinal)
get_optionusing_copy_on_writewarn_copy_on_write)NaT	internalslib)BlockPlacementBlockValuesRefs)NA)	ArrayLikeAxisIntDtypeBackendDtypeObjFFillnaOptionsIgnoreRaiseInterpolateOptionsQuantileInterpolationSelfShapenptAbstractMethodError)cache_readonly)find_stack_level)validate_bool_kwarg)astype_array_safeastype_is_view)LossySetitemErrorcan_hold_elementconvert_dtypesfind_result_typemaybe_downcast_to_dtypenp_can_hold_element)is_1d_only_ea_dtypeis_float_dtypeis_integer_dtypeis_list_like	is_scalaris_string_dtype)DatetimeTZDtypeExtensionDtypeIntervalDtypeNumpyEADtypePeriodDtype)ABCDataFrameABCIndexABCNumpyExtensionArray	ABCSeries)is_valid_na_for_dtypeisnana_value_for_dtype)missing)extract_bool_arrayputmask_inplaceputmask_without_repeatsetitem_datetimelike_compatvalidate_putmask)quantile_compat)compare_or_regex_searchreplace_regexshould_use_regex)shift)CategoricalDatetimeArrayExtensionArrayIntervalArrayNumpyExtensionArrayPeriodArrayTimedeltaArray)PandasObject)expressions)ensure_wrapped_if_datetimelikeextract_array)check_setitem_lengths)get_values_for_csv)IterableSequence)Index)NDArrayBackedExtensionArrayobjectaO  Setting a value on a view: behaviour will change in pandas 3.0.
You are mutating a Series or DataFrame object, and currently this mutation will
also have effect on other Series or DataFrame objects that share data with this
object. In pandas 3.0 (with Copy-on-Write), updating one Series or DataFrame object
will never modify another.
a  Setting a value on a view: behaviour will change in pandas 3.0.
Currently, the mutation will also have effect on the object that shares data
with this object. For example, when setting a value in a Series that was
extracted from a column of a DataFrame, that DataFrame will also be updated:

    ser = df["col"]
    ser[0] = 0     <--- in pandas 2, this also updates `df`

In pandas 3.0 (with Copy-on-Write), updating one Series/DataFrame will never
modify another, and thus in the example above, `df` will not be changed.
c                P   ^  [        T 5      SU 4S jj5       n[        [        U5      $ )zd
If we have a multi-column block, split and operate block-wise.  Otherwise
use the original method.
c                   > U R                   S:X  d  U R                  S   S:X  a  T" U /UQ70 UD6$ U R                  " T/UQ70 UD6$ )N   r   )ndimshapesplit_and_operate)selfargskwargsmeths      N/var/www/html/env/lib/python3.13/site-packages/pandas/core/internals/blocks.pynewfuncmaybe_split.<locals>.newfunc   sO    99>TZZ]a/.t.v.. ))$@@@@    returnlist[Block])r   r	   r   )re   rg   s   ` rf   maybe_splitrm      s,     4[A A 7ri   c            	      <   \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   SrSr\\	SVS j5       5       r
\\	SVS j5       5       r\\	SVS j5       5       r\\	SVS j5       5       r\\	S 5       5       r\\	SVS j5       5       r\\SVS j5       5       r\S 5       r\\	S 5       5       r\S 5       r\SWS j5       r\R,                  SXS j5       r\  SY     SZS jj5       r\  SY     S[S jj5       r\S\S j5       r\S]S j5       r\S^S j5       r\S_S j5       r\ S`       SaS  jj5       r\SbS! j5       r\ScS" j5       r\SdS# j5       r \SdS$ j5       r!\SeS% j5       r"\SdS& j5       r#\SdS' j5       r$\S`SfS( jj5       r%\        SgS) j5       r&\\'S`ShS* jj5       5       r(\S+SS,.     SiS- jj5       r)      Sj                 SkS. jjr*\\	SlS/ j5       5       r+\    Sm           SnS0 jj5       r,\S1SS2.   SoS3 jj5       r-\SpSqS4 jj5       r.\SrS5 j5       r/\SsS6 j5       r0\    St       SuS7 jj5       r1\    St     SvS8 jj5       r2\    Sw           SxS9 jj5       r3\   Sy         SzS: jj5       r4S{S; jr5S< r6\S|S= j5       r7S}S> jr8    S~S? jr9S`SS@ jjr:\S\;Rx                  4       SSA jj5       r=    SSB jr>S`SSC jjr? S   ShSD jjr@ S     SSE jjrA     S       SSF jjrBSGSSSSSSSH.               SSI jjrC\SSSJSSSSSK.                 SSL jj5       rD\SSM j5       rESSSN jjrF\ S     SSO jj5       rG\S`SSP jj5       rHSdSQ jrI\SVSR j5       rJ\SSS j5       rKSSST jjrLSUrMg)Block   z
Canonical n-dimensional unit of homogeneous dtype contained in a pandas
data structure

Index-ignorant; let the container take care of that
znp.ndarray | ExtensionArrayvaluesintr_   r   refsr   __init__ Fc                r    U R                   n[        U[        5      (       + =(       d    [        U[        5      $ )zp
We validate dimension for blocks that can hold 2D values, which for now
means numpy dtypes or DatetimeTZDtype.
)dtype
isinstancer4   r3   rb   rw   s     rf   _validate_ndimBlock._validate_ndim   s0     

e^44 

?9
 	
ri   c                <    U R                   R                  [        :H  $ N)rq   rw   
_dtype_objrb   s    rf   	is_objectBlock.is_object   s     {{  J..ri   c                `    [         R                  " U R                  R                  5      (       + $ r}   )r   is_np_dtyperq   rw   r   s    rf   is_extensionBlock.is_extension   s      ??4;;#4#4555ri   c                $    U R                   (       + $ r}   )r   r   s    rf   _can_consolidateBlock._can_consolidate   s     $$$$ri   c                F    U R                   U R                  R                  4$ r}   )r   rw   namer   s    rf   _consolidate_keyBlock._consolidate_key   s     $$djjoo55ri   c                    U R                   n[        U[        R                   5      (       a  UR                  S;  $ UR                  $ )z'
Can we store NA values in this Block?
iub)rw   rx   npkind_can_hold_nary   s     rf   r   Block._can_hold_na   s9     

eRXX&&::U**!!!ri   c                d    U R                   R                  [        R                  " [        5      :H  $ )zN
We can be bool if a) we are bool dtype or b) object dtype with bool objects.
)rq   rw   r   boolr   s    rf   is_boolBlock.is_bool   s!     {{  BHHTN22ri   c                ,    [        U R                  5      $ r}   )external_valuesrq   r   s    rf   r   Block.external_values   s    t{{++ri   c                *    [        U R                  SS9$ )NF)compat)r>   rw   r   s    rf   
fill_valueBlock.fill_value   s     "$**U;;ri   c                z    U R                   [        :w  a&  [        XR                   5      (       a  U R                  nU$ r}   )rw   r~   r<   r   rb   values     rf   _standardize_fill_valueBlock._standardize_fill_value  s-     ::#(=eZZ(P(POOEri   c                    U R                   $ r}   	_mgr_locsr   s    rf   mgr_locsBlock.mgr_locs
  s    ~~ri   c                    Xl         g r}   r   )rb   new_mgr_locss     rf   r   r     s    %ri   Nc                    Uc  U R                   nU R                  (       a  [        XR                  S9n[	        XU R                  US9$ )zU
Create a new block, with type inference propagate any values that are
not specified
r_   	placementr_   rs   )r   r   ensure_block_shaper_   	new_blockrb   rq   r   rs   s       rf   
make_blockBlock.make_block  s=     I'YY?F4994PPri   c                V    Uc  U R                   n[        U 5      " XU R                  US9$ )z2Wrap given values in a block of same type as self.r   )r   typer_   r   s       rf   make_block_same_classBlock.make_block_same_class$  s,     I Dz&DIIDQQri   c                X   [        U 5      R                  nU R                  S:X  a  U S[        U 5       SU R                   3nU$ SR                  U R                   Vs/ s H  n[        U5      PM     sn5      nU SU R                  R                   SU SU R                   3nU$ s  snf )Nr^   z: z dtype: z x z, z	, dtype: )
r   __name__r_   lenrw   joinr`   strr   indexer)rb   r   resultsr`   s        rf   __repr__Block.__repr__4  s     Dz""99>vRD	{(4::,?F
  JJ

;
1A
;<EvR 5 56byUF  <s   B'c                ,    [        U R                  5      $ r}   )r   rq   r   s    rf   __len__Block.__len__@  s    4;;ri   c                    U R                   U   nU R                  U5      nU R                  n[        U 5      " X2U R                  US9$ )z3
Perform __getitem__-like, return result as block.
rs   )r   _slicers   r   r_   )rb   slcr   
new_valuesrs   s        rf   slice_block_columnsBlock.slice_block_columnsD  s@    
 ~~c*[[%
yyDz*DIIDIIri   c                x    U R                   U   nU R                  U5      n[        U 5      " X2U R                  SS9$ zg
Perform __getitem__-like, return result as block.

Only supports slices that preserve dimensionality.
Nr   )r   r   r   r_   )rb   indicesr   r   s       rf   take_block_columnsBlock.take_block_columnsO  s7     ~~g.[[)
Dz*DIIDIIri   c                    U R                  U5      nU(       a  U R                  R                  5       (       a  U R                  OSn[        U 5      " XBU R                  US9$ r   )r   rs   has_referencer   r_   )rb   slicerr   ref_inplace_opr   rs   s         rf   getitem_block_columnsBlock.getitem_block_columns^  sI     [[(
 .$))2I2I2K2KtyyQUDz*DIIDIIri   c                B    [        USS9n[        U R                  U5      $ )z#require the same dtype as ourselvesTextract_numpy)rT   r(   rq   )rb   elements     rf   _can_hold_elementBlock._can_hold_elementk  s!      t<W55ri   c                4    UR                   U R                   :H  $ )z
Should we set self.values[indexer] = value inplace or do we need to cast?

Parameters
----------
value : np.ndarray or ExtensionArray

Returns
-------
bool
rw   r   s     rf   should_storeBlock.should_storeq  s     {{djj((ri   c                `    U" U R                   40 UD6n[        U5      nU R                  U5      $ )zC
apply the function to my values; return a block if we are not
one
)rq   maybe_coerce_values_split_op_result)rb   funcrd   r   s       rf   applyBlock.apply  s2     dkk,V,$V,$$V,,ri   c                    U R                   S:X  d   eU" U R                  5      nU R                  R                   S:X  a  UnOUR                  SS5      nU R                  U5      nU/$ )N   r^   )r_   rq   reshaper   )rb   r   r   
res_valuesnbs        rf   reduceBlock.reduce  s^     yyA~~dkk";;q JA.J__Z(tri   c                n   UR                   S:  a  [        UR                  [        5      (       as  / n[	        U R
                  5       HV  u  p4[        UR                  5      (       d  XUS-    nOX   n[        U5      nU R                  XVS9nUR                  U5        MX     U$ U R                  U5      nU/$ )Nr^   )rq   r   )
r_   rx   rw   r4   	enumerater   r-   r   r   append)	rb   r   nbsilocvalsbpblockr   s	            rf   r   Block._split_op_result  s     ;;?z&,,GG C#DNN3*6<<88!a!e,D!9D#C(tB

5! 4 J__V$tri   c                   U R                   S:X  d   e/ n[        U R                  5       HW  u  p#U R                  [	        X"S-   5         n[        U5      n[        U 5      " XESU R                  S9nUR                  U5        MY     U$ )z4
Split a block into a list of single-column blocks.
r   r^   r   )	r_   r   r   rq   slicer   r   rs   r   )rb   
new_blocksr   ref_locr   r   r   s          rf   _splitBlock._split  sz    
 yyA~~
#DNN3JA;;uQA/D(BdDQTYYGBb! 4 ri   c                    U R                   S:X  a  U R                  S   S:w  d   e/ nU R                  5        H   nU" U/UQ70 UD6nUR                  U5        M"     U$ )z
Split the block and apply func column-by-column.

Parameters
----------
func : Block method
*args
**kwargs

Returns
-------
List[Block]
r   r   r^   )r_   r`   r   extend)rb   r   rc   rd   
res_blocksr   rbss          rf   ra   Block.split_and_operate  sc     yyA~$**Q-1"444
++-Br+D+F+Cc"   ri   c                   [        U R                  R                  U5      nX0R                  :X  a  [        S5      e[	        U5      (       a  [        U R                  R                  5      (       af  [        U5      (       aV  U[        LaM  [        U[        R                  [        R                  45      (       a  [        R                  " U5      (       d  SnO[        U[        R                  5      (       ak  UR                  S:X  a[  [        U R                  R                  5      (       a7  [        UR                  5      (       a  [         R"                  " U5      (       a  SnU(       a=  [$        R&                  " SU SU R                  R                   S3[(        [+        5       S9  U R                  R                  U:X  a&  [        SU S	U R                  R                   S
35      eU R-                  USS9$ )z
coerce the current block to a dtype compat for other
we will return a block, possibly object, and not raise

we can also safely try to coerce to the same dtype
and will receive the same block
z\Something has gone wrong, please report a bug at https://github.com/pandas-dev/pandas/issuesFr^   zrSetting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value 'z' has dtype incompatible with z5, please explicitly cast to a compatible dtype first.
stacklevelzDid not expect new dtype z to equal self.dtype zE. Please report a bug at https://github.com/pandas-dev/pandas/issues.)copy)r*   rq   rw   AssertionErrorr1   r/   r=   r   rx   r   
datetime64timedelta64isnatndarrayr_   r.   r   has_only_ints_or_nanwarningswarnFutureWarningr#   astype)rb   otherwarn_on_upcast	new_dtypes       rf   coerce_to_target_dtypeBlock.coerce_to_target_dtype  s    %T[[%6%6>	

" >  e !2!233US 52==".."ABBrxxPU #Nubjj))

a !2!233u{{++((//"NMM >t{{?P?P>Q RFF +- ;;	) +I;6K;;$$% &?? 
 {{95{11ri   c           
        USL a  U$ U R                   [        :X  a  US:X  a  [        S5      (       a  U$ [        U Vs/ s H  oUR	                  X3(       + S9PM     sn5      nUS:X  aZ  [        U5      [        U5      :w  d   [        S [        Xa5       5       5      (       d"  [        R                  " S[        [        5       S9  U$ Uc  U$ US:X  a  [        S5      S	L a  U$ [        U Vs/ s H  owR                  X#5      PM     sn5      nUS:X  aZ  [        U5      [        U5      :w  d   [        S
 [        X5       5       5      (       a"  [        R                  " S[        [        5       S9  U$ s  snf s  snf )NFfillnafuture.no_silent_downcasting)	using_cowr  c              3  X   #    U  H   u  pUR                   UR                   :H  v   M"     g 7fr}   r   ).0xys      rf   	<genexpr>(Block._maybe_downcast.<locals>.<genexpr>.  s#      63C41AGGqww&3C   (*zDowncasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`r  whereTc              3  X   #    U  H   u  pUR                   UR                   :g  v   M"     g 7fr}   r   )r  leftrights      rf   r  r  M  s#      .=Mkd

ekk)=Mr   a|  Downcasting behavior in Series and DataFrame methods 'where', 'mask', and 'clip' is deprecated. In a future version this will not infer object dtypes or cast all-round floats to integers. Instead call result.infer_objects(copy=False) for object inference, or cast round floats explicitly. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`)rw   r~   r   extend_blocksconvertr   allzipr  r  r  r#   _downcast_2dany)rb   blocksdowncastr  callerblkr   bs           rf   _maybe_downcastBlock._maybe_downcast  so    uM::# !j1O&P&PQWXQW#y}EQWXC !s8s6{*# 636s3C6 3 3 MMP &#3#5	 JMw:.L#MQU#UMf Uf!Df UVC W6{c#h&# .=@=M. + +
 L "/1 
i Y2 !Vs   E*'E/c                    [        U R                  US9n[        U5      nX0R                  L a  U R                  OSnU R	                  X4S9/$ )z[
downcast specialized to 2D case post-validation.

Refactored to allow use of maybe_split.
r   Nr   )r+   rq   r   rs   r   )rb   rw   r  r   rs   s        rf   r)  Block._downcast_2da  sF     -T[[F
(4
&++5tyy4
677ri   Tr  r  c                  U R                   (       d9  U(       d  U(       a  U R                  SS9/$ U(       a  U R                  5       /$ U /$ U R                  S:w  a|  U R                  S   S:w  ai  U R	                  [
        R                  XS9n[        S U 5       5      (       a2  U(       a  U R                  SS9/$ U(       a  U R                  5       /$ U /$ U$ U R                  nUR                  S:X  a  US   n[        R                  " USS	9nS
nU(       a  XTL a  UR                  5       nOXTL a  U R                  n[        XPR                  5      n[        U5      nU R                  XVS9/$ )zb
Attempt to coerce any object types to better types. Return a copy
of the block (if copy = True).
Fdeepr^   r   r4  c              3  R   #    U  H  oR                   R                  S :H  v   M     g7f)ONrw   r   )r  r.  s     rf   r   Block.convert.<locals>.<genexpr>  s     ;FS99>>S(Fs   %'r   T)convert_non_numericNr   )r   r  r_   r`   ra   ro   r&  r'  rq   r   maybe_convert_objectsrs   r   r   r   )rb   r  r  r+  rq   r   rs   s          rf   r&  Block.convertn  sD    ~~I		u	-..$(DIIK=4tf499>djjmq0++D , F ;F;;; II5I122(,		}84&8M;;! AYF.. $

 J(J!99D'
II>
(4

677ri   c	                  ^  U(       a"  T R                   (       a  T R                  SUS9n	OT /n	[        XuXd/5      (       d  U	 V
s/ s H  oR                  US9PM     sn
$ / nU	 H  nUR                  S:X  d  T R
                  S   S:X  a  U/OUR                  5       nU V
s/ s H  n
[        U
R                  UUUUUU5      PM      nn
[        U 4S jU 5       5      (       a   UR                  UR                  US95        M  [        X5       H1  u  pUR                  U
R                  XU
R                  S:g  S95        M3     M     U$ s  sn
f s  sn
f )NFr4  r6  r^   r   c              3  @   >#    U  H  oTR                   :H  v   M     g 7fr}   r   )r  rw   rb   s     rf   r  'Block.convert_dtypes.<locals>.<genexpr>  s     ;F5DJJ&Fs   )rw   r  squeeze)r   r&  r*  r  r_   r`   r   r)   rq   r'  r   r(  r  )rb   r  r  infer_objectsconvert_stringconvert_integerconvert_booleanconvert_floatingdtype_backendblksr/  r  r.  sub_blksdtypesrw   s   `               rf   r)   Block.convert_dtypes  sG    T^^<<Ui<@D6DP
 
 044t!FFF%t44C #AA!1CuH " "A HH"##$!! "   ;F;;;

3888./1

188%AFFaK8PQ 2) , 
3 5s   E %Ec                .    U R                   R                  $ r}   )rq   rw   r   s    rf   rw   Block.dtype  s     {{   ri   c                f   U R                   nU(       aG  UR                  S:X  a7  [        U5      (       a'  UR                  S   S:w  a  [	        S5      eUSSS24   n[        XaX#S9n[        U5      nSnU(       d  U(       d1  [        UR                  UR                  5      (       a  U R                  nU R                  XxS9n	U	R                  U R                  :w  aW  [        SU S	U R                  R                   S
U R                   SU	R                  R                   S
U	R                   S35      eU	$ )a  
Coerce to the new dtype.

Parameters
----------
dtype : np.dtype or ExtensionDtype
copy : bool, default False
    copy if indicated
errors : str, {'raise', 'ignore'}, default 'raise'
    - ``raise`` : allow exceptions to be raised
    - ``ignore`` : suppress exceptions. On error return original object
using_cow: bool, default False
    Signaling if copy on write copy logic is used.
squeeze : bool, default False
    squeeze values to ndim=1 if only one column is given

Returns
-------
Block
r   r   r^   z*Can not squeeze with more than one column.N)r  errorsr   zcannot set astype for copy = [z] for dtype (z [z]) to different shape (z]))rq   r_   r-   r`   
ValueErrorr%   r   r&   rw   rs   r   	TypeErrorr   )
rb   rw   r  rP  r  rB  rq   r   rs   newbs
             rf   r  Block.astype  s
   : v{{a',?,F,F||A!# !MNNAqD\F&v4O
(4
T~fllJDTDT'U'U99Dz5::#0 7JJOO$Btzzl 3JJOO$Btzzl"6 
 ri   nan)na_repquotingc          	     T    [        U R                  UUUUUS9nU R                  U5      $ )z"convert to our native types format)rV  rW  float_formatdate_formatdecimal)rV   rq   r   )rb   rY  rZ  r[  rV  rW  r   s          rf   rV   Block.get_values_for_csv  s5    
 $KK%#
 v&&ri   c                    U R                   nU(       a  UR                  5       nSnOU R                  n[        U 5      " X R                  U R
                  US9$ )zcopy constructorNr   )rq   r  rs   r   r   r_   )rb   r7  rq   rs   s       rf   r  
Block.copy  sE     [[]FD99DDz&NNQUVVri   c                    U(       a2  U(       a+  U R                   R                  5       nU R                  US9nU$ U(       a  U OU R                  5       nU$ )Nr6  )rs   r   r  )rb   r  inplacer7  r.  s        rf   _maybe_copyBlock._maybe_copy%  sF    99**,D)))&C 
 "$tyy{C
ri   c                    S nU(       + nU(       a7  U(       a$  U R                   R                  5       (       a  SnXC4$ U R                   nXC4$ )NT)rs   r   )rb   r  r`  rs   r  s        rf   _get_refs_and_copyBlock._get_refs_and_copy.  sH    {TYY4466 z yyzri   c                6   U R                   n[        U[        5      (       a>  U R                  XS5      n[	        [        UR                   5      nUR                  XSS9  U/$ U R                  U5      (       d2  U(       a  U R                  SS9/$ U(       a  U /$ U R                  5       /$ Uc  [        R                  " Xq5      nUR                  5       (       d2  U(       a  U R                  SS9/$ U(       a  U /$ U R                  5       /$ U R                  U5      (       Ga)  U R                  XS5      n[        UR                   XB5        U(       ao  [        5       (       a`  Ub]  UR                  (       dL  U R                  R                  5       (       a-  [         R"                  " [$        [&        [)        5       S9  SUl        U R*                  (       a  Ubs  [-        S5      SL a  U/n	U	$ UR/                  SUS9n	[1        U	5      S:  d  U	S	   R2                  UR2                  :w  a"  [         R"                  " S
[&        [)        5       S9  U	$ U/n	U	$ U R4                  S:X  d  U R6                  S	   S:X  aY  Ub	  U[8        L a*  U R;                  [<        R2                  " [>        5      5      nOU RA                  U5      nURC                  UUSUS9$ / n	[E        U RG                  5       5       H6  u  pU	RI                  [K        U 5      RC                  UUUSXJU
S-    US95        M8     U	$ )zm
replace the to_replace value with value, possible to create new
blocks here this is just a call to putmask.
T
to_replacer   r`  Fr6  r  r  r4  r^   r     Downcasting behavior in `replace` is deprecated and will be removed in a future version. To retain the old behavior, explicitly call `result.infer_objects(copy=False)`. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`)rh  r   r`  maskrh  r   r`  rj  r  )&rq   rx   rJ   ra  r	   _replacer   r  r?   mask_missingr*  rA   r   warned_alreadyrs   r   r  r  COW_WARNING_GENERAL_MSGr  r#   r   r   r&  r   rw   r_   r`   r   r  r   r[   r  replacer   r   r   r   )rb   rh  r   r`  rj  r  already_warnedrq   r.  r+  r   r   s               rf   rp  Block.replace<  s   & fk** ""96C+szz2FOOzOM5L%%j11
 		u	-..!(v;tyy{m;<'';Dxxzz 		u	-..!(v;tyy{m;##E** ""96CCJJ4&((".&5599**,,MM/%#3#5
 59N1NNu} <=E!UF$ M! ![[ey[IF6{Q&)//SYY*F T *'7'9 M MYY!^tzz!}1}kk"((6"2311%8;;%	    F"4;;=1J&&#-# $!a!e_"+ ' 	 2 Mri   c                   U R                  U5      (       d2  U(       a  U R                  SS9/$ U(       a  U /$ U R                  5       /$ [        R                  " U5      nU R	                  XS5      n[        UR                  XrU5        U(       ao  [        5       (       a`  Ub]  UR                  (       dL  U R                  R                  5       (       a-  [        R                  " [        [        [        5       S9  SUl        UR!                  SUS9n	[#        S5      n
[%        U	5      S:  d  U	S   R&                  UR&                  :w  a)  U
(       d"  [        R                  " S	[        [        5       S9  U	$ )
a  
Replace elements by the given value.

Parameters
----------
to_replace : object or pattern
    Scalar to replace or regular expression to match.
value : object
    Replacement object.
inplace : bool, default False
    Perform inplace modification.
mask : array-like of bool, optional
    True indicate corresponding element is ignored.
using_cow: bool, default False
    Specifying if copy on write is enabled.

Returns
-------
List[Block]
Fr6  r  Tr4  r  r^   r   ri  )r   r  recompilera  rG   rq   r   rn  rs   r   r  r  ro  r  r#   r&  r   r   rw   )rb   rh  r   r`  rj  r  rq  rxr   r   opts              rf   _replace_regexBlock._replace_regex  s&   < %%j11 		u	-..$D67499;-7ZZ
#  4ellBt4 "$$*"11yy&&((+!/1
 15-mm)m<78HqLCFLLEKK7MMH +-
 
ri   c                f  ^^^ U R                   m[        T[        5      (       a>  U R                  XS5      n[	        [        UR                   5      mTR                  XSS9  U/$ [        X5       VV	s/ s H   u  pU R                  U5      (       d  M  X4PM"     n
nn	[        U
5      (       d2  U(       a  U R                  SS9/$ U(       a  U /$ U R                  5       /$ [        U
5      S-
  n[        TR                  5      (       a  [        T5      ) mUUU4S jU
 5       nOU4S jU
 5       nU(       a  [        U5      nU(       a  U /nOU(       a  U OU R                  5       /nU(       ao  [        5       (       a`  Ub]  UR                  (       dL  U R                   R#                  5       (       a-  [$        R&                  " [(        [*        [-        5       S9  SUl        [/        S	5      n[1        [        X5      5       GH  u  nu  u  nnnX:H  n/ n[1        U5       GH  u  nn[        U5      S:X  a  UnO!Un[        U[2        5      (       a   eUUUS-    nUR5                  UUUUTUS
9nU(       al  X:w  ag  U Ha  n[6        R8                  " U5      nUR                   R:                  R=                  UR                   R:                  R?                  U5      5        Mc     U(       d  U(       a  UR@                  (       a  [C        S U 5       5      (       d  / nU Hw  nURE                  U(       + US9n[        U5      S:  d  US   R                  UR                  :w  a"  [$        R&                  " S[*        [-        5       S9  URG                  U5        My     UnURG                  U5        GM     UnGM     U$ s  sn	nf )z*
See BlockManager.replace_list docstring.
Trg  Fr6  r^   c              3  p   >#    U  H+  n[        [        [        [        TUS    TTS95      5      v   M-     g7f)r   )regexrj  N)r@   r	   r   rF   )r  r   na_maskr|  rq   s     rf   r  %Block.replace_list.<locals>.<genexpr>$  sF      
6 A #!/"AaDG  s   36c              3  X   >#    U  H  n[         R                  " TUS    5      v   M!     g7f)r   N)r?   rm  )r  r   rq   s     rf   r  r~  1  s%     GAW))&!A$77s   '*r  r  )rh  r   rj  r`  r|  r  c              3  (   #    U  H  oS L v   M
     g 7fr}   ru   r  r  s     rf   r  r~  v  s     =9aT	9s   r4  r   ri  )$rq   rx   rJ   ra  r	   rl  r(  r   r   r  r2   rw   r=   listr   rn  rs   r   r  r  ro  r  r#   r   r   r   _replace_coerceweakrefrefreferenced_blockspopindexr   r'  r&  r   ) rb   src_list	dest_listr`  r|  r  rq  r.  r  r  pairssrc_lenmasksrbrw  r   srcdestrj  r&  new_rbblk_nummmibr   r/  r  r   res_blk	convertedr}  rq   s        `                         @@rf   replace_listBlock.replace_list  sO    fk** ""96C+szz2FOOx$OO5L  #87
7tq4;Q;QRS;TFQF7 	 
 5zz		u	-..$D67499;-7e*q.6<<(( F|mG
6 
6E HGE KE B!$tyy{3B "$$*"11yy&&((+!/1
 15-78&/E0A&B"A"dTlG"$F
 !*"r7a<AC)#t4444Ggk2A
 ,,"#' -   $%kk!n0044FF44::3? $ =9=== C#)$+OO.7-9 %4 %	 y>A-11C1Cw}}1T$MM!X !.+;+= 

9-# $*$ !Ff%s !.t BC 'CD 	u
s   1N-N-c                l   [        XQ5      (       a  U R                  UUUUS9$ Uc  UR                  5       (       a  U R                  R	                  5       nU R                  [        R                  " [        5      SUS9nXL d  U(       a  U(       d  UR                  5       nODU(       a=  U(       a6  UR                  R	                  5       (       a  U(       a  UR                  5       n[        UR                  X25        U/$ U(       a  U /$ U(       a  U /$ U R                  5       /$ U R                  UUUUUS9$ )a  
Replace value corresponding to the given boolean array with another
value.

Parameters
----------
to_replace : object or pattern
    Scalar to replace or regular expression to match.
value : object
    Replacement object.
mask : np.ndarray[bool]
    True indicate corresponding element is ignored.
inplace : bool, default True
    Perform inplace modification.
regex : bool, default False
    If true, perform regular expression substitution.

Returns
-------
List[Block]
)r`  rj  Fr4  rk  )rH   rx  r*  rs   r   r  r   rw   r[   r  rA   rq   rp  )	rb   rh  r   rj  r`  r|  r  has_refr   s	            rf   r  Block._replace_coerce  s   > E..&&	 '   }88::"ii557GRXXf%5EYWB
iWWY W1F1F1H1HYWWY#BIIt;4K 6M!(v;tyy{m;<<%#    ri   c                    U$ z1
For compatibility with 1D-only ExtensionArrays.
ru   rb   args     rf   _maybe_squeeze_argBlock._maybe_squeeze_arg  s	     
ri   c                    U$ r  ru   )rb   r   s     rf   _unwrap_setitem_indexerBlock._unwrap_setitem_indexer  s	     ri   c                .    U R                   R                  $ r}   )rq   r`   r   s    rf   r`   Block.shape  s    {{   ri   c                     U R                   U   $ r}   rq   )rb   r   s     rf   iget
Block.iget  s     {{1~ri   c                     U R                   U   $ )zreturn a slice of my valuesr  )rb   r   s     rf   r   Block._slice  s    
 {{6""ri   c                l    U(       a  U R                   R                  5       U l         X R                   U'   g)a`  
Modify block values in-place with new item value.

If copy=True, first copy the underlying values in place before modifying
(for Copy-on-Write).

Notes
-----
`set_inplace` never creates a new array or new Block, whereas `setitem`
_may_ create a new array and always creates a new Block.

Caller is responsible for checking values.dtype == self.dtype.
Nrq   r  rb   locsrq   r  s       rf   set_inplaceBlock.set_inplace  s'     ++**,DK"Dri   c                   U R                   nU[        R                  L a  U R                  nSnOSn[        R
                  " XQX&US9n[        U [        5      (       a  U R                  S:X  a  Uc   eUS:X  a  Uc   eUc  U R                  nUR                  U R                  :w  a  U R                  Xs5      $ U R                  Xs5      $ )z>
Take values according to indexer and return them as a block.
FT)axis
allow_fillr   r^   r   )rq   r   
no_defaultr   algostake_ndrx   ExtensionBlockr_   r   rw   r   r   )rb   r   r  r   r   rq   r  r   s           rf   r  Block.take_nd  s     'JJJ ]]$*

 dN++ 		Q<+?@@AI,"677>>Ltzz)??:<<--jGGri   c                    UR                  U R                  R                  US9u  pVUR                  S5      nUR                  U   nX6   n[	        U5      n[        XWS9/nX4$ )a  
Return a list of unstacked blocks of self

Parameters
----------
unstacker : reshape._Unstacker
fill_value : int
    Only used in ExtensionBlock._unstack
new_placement : np.ndarray[np.intp]
allow_fill : bool
needs_masking : np.ndarray[bool]

Returns
-------
blocks : list of Block
    New blocks of unstacked values.
mask : array-like of bool
    The mask of columns of `blocks` we should keep.
r   r   r   )get_new_valuesrq   Tr*  r   new_block_2d)	rb   	unstackerr   new_placementneeds_maskingr   rj  r   r+  s	            rf   _unstackBlock._unstack/  so    4 %33KKMMj 4 

 xx{  \\$'
%+M*z89|ri   c                   U R                  U5      n[        [        R                  U R                  5      nU R
                  S:X  a  UR                  n[        XU5        U R                  [        :w  a
  [        USS9n [        UR                  U5      nU R                  [        :X  a5  XA   n[        R                  " U5      (       a  [        U[        U5      U5      nU R!                  USS9n [        [        R                  U R                  R                  5      n[#        U[        R                  5      (       a$  UR
                  S:X  a  [        U5      S:X  a  US   n XTU'   U $ ! [$        [&        4 a"  n[        U5      (       a  ['        S5      Uee SnAff = f! [(         a$    U R+                  USS	9nUR-                  X5      s $ f = f)
a  
Attempt self.values[indexer] = value, possibly creating a new array.

Parameters
----------
indexer : tuple, list-like, array-like, slice, int
    The subset of self.values to set
value : object
    The value being set
using_cow: bool, default False
    Signaling if CoW is used.

Returns
-------
Block

Notes
-----
`indexer` is a direct slice/positional indexer. `value` must
be a compatible shape.
r   Tr   r`  r^   )r   .z)setting an array element with a sequence.Nr  )r   r	   r   r  rq   r_   r  rU   rw   r~   rT   r,   r   r0   rC   r   ra  rx   rR  rQ  r'   r  setitem)	rb   r   r   r  rq   castedvierrr   s	            rf   r  Block.setitem]  s   . ,,U3bjj$++.99>XXF 	gf5::#!%t<E	(u=F zzZ'_##B'' 9R&QF##It#<D"**dkkmm4F&"**--&++2Bs6{VWGW"(w  z* ''$C ) ! 	.,,U4,HB::g--	.s*   =F E$ $F4FF+GGc                J   Un[        [        R                  U R                  5      n[	        UR
                  U5      u  p[        U[        [        [        45      (       a   eU[        R                  L a  U R                  nU R                  U5      n[        USS9nU(       a  U(       a  U R                  SS9/$ U /$ [!        5       (       a`  Ub]  UR"                  (       dL  U R$                  R'                  5       (       a-  [(        R*                  " [,        [.        [1        5       S9  SUl         [3        UR4                  U5      nU R7                  USS9n [        [        R                  U R                  5      n[9        UR
                  X5        U /$ ! [:         Ga    U R<                  S:X  d  U R>                  S	   S:X  a\  [A        U5      (       d!  U RC                  USS
9RE                  X5      s $ URG                  5       S	   n	U RI                  XU	   US9n
U
/s $ [        U[        R                  5      n/ nU RK                  5       n[M        U5       HI  u  pUnU(       a  USS2XS-   24   nUSS2XS-   24   nU
RE                  UXS9nURO                  U5        MK     Us $ f = f)a  
putmask the data to the block; it is possible that we may create a
new dtype of block

Return the resulting block(s).

Parameters
----------
mask : np.ndarray[bool], SparseArray[bool], or BooleanArray
new : a ndarray/object
using_cow: bool, default False

Returns
-------
List[Block]
Tr   Fr6  Nr  r  r^   r   r  r  )(r	   r   r  rq   rD   r  rx   r9   r;   r8   r   r  r   r   rT   r  r   rn  rs   r   r  r  ro  r  r#   r,   rw   ra  rB   r'   r_   r`   r0   r  putmasknonzeror  r   r   r   )rb   rj  newr  rq  	orig_maskrq   noopr  r   r   is_arrayr   r   r   nsubmaskr  s                     rf   r  Block.putmask  sS   & 	bjj$++.%fhh5
cHi#FGGGG#.. //C**3/Ct4		u	-..6M   *"11yy&&((+!/1
 15-$	"(s;F##It#<D"**dkk2F"688T:6M  	"yyA~A!!3 $C((66D 7 gd() #llnQ/Gg7|yQB4K &c2::6
kkm&s^EAA11u9-'11u95G**Wa*EC%%c* , "!9	"s!   ,A"F AJ".)J"BJ"!J"c           	        UR                   U R                   :X  d   e[        U[        [        [        45      (       a   eU R                   S:H  n[        U5      n[        [        R                  U R                  5      nUnU(       a  UR                  n[        Xb) 5      u  pU	(       a(  U(       a  U R                  SS9/$ U R                  5       /$ U[        R                  L a  U R                  nU R!                  U5      n [#        UR$                  U5      n
U
n['        XhR)                  5       U5      nXLas  [+        U5      (       a;  [-        U5      [-        U5      :  a#  [        R.                  " U) Xa5        [1        S5      eUR                  5       n[        R2                  " XU5        O[+        U5      (       aj  [        U[        R                  5      (       dK  [-        U5      U R4                  S   :X  a/  [        R6                  " U5      R9                  UR4                  5      n[:        R.                  " U) Xa5      n U(       a  UR                  nU RO                  U5      /$ ! [<        [>        [@        4 a    U R                   S:X  d  U R4                  S   S:X  a4  U RC                  U5      nUR/                  XrUS9nU RE                  XUS	S
9s $ [        U[        R                  [F        45      n/ nU RI                  5       n[K        U5       HM  u  nnUnU(       a  USS2UUS-   24   nUSS2UUS-   24   nUR/                  UUX4S9nURM                  U5        MO     Us $ f = f)a/  
evaluate the block; return result block(s) from the result

Parameters
----------
other : a ndarray/object
cond : np.ndarray[bool], SparseArray[bool], or BooleanArray
_downcast : str or None, default "infer"
    Private because we only specify it when calling from fillna.

Returns
-------
List[Block]
r   Fr6  zThis should not be reached; call to np.where above is expected to raise ValueError. Please report a bug at github.com/pandas-dev/pandasr   r^   r   r  r!  r,  r  r-  N)	_downcastr  )(r_   rx   r9   r;   r8   r@   r	   r   r  rq   r  rD   r  r   r  r   r   r,   rw   rC   sumr0   r   r!  NotImplementedErrorr  r`   arrayr   rR   rQ  rR  r'   r  r0  rL   r   r   r   r   )rb   r  condr  r  	transposerq   
orig_othericondr  r  altr   r   r+  r  r   r   r   r   othr  r  s                          rf   r!  Block.where  s   " yyDII%%%eh	<%HIIIIIIN	!$' bjj$++.
XXF&vu5		u	-..IIK= CNN"OOE,,U3D	B )u=FF E-fiik5IC&&3u:F+CHHeVV3-7 
  

6#.
 !''&ubjj99E
djjn4
 HHUO33FLLAE
 %**E66A XXF'((M I'89 	" yyA~A!!3 33E:ZK++)G ,   &ebjj.-IJ
kkm&s^EArC#Aq1q5yL1"1a!a%i<0G((W	 # C %%c* , "!?	"s    I! !A*M BM M c                j   [        US5      nU R                  (       d  SnO-[        U R                  5      n[	        U R                  U5      u  pU(       aI  U(       a  U(       a  U R                  SS9/$ U /$ U R                  U(       + S9n	U	R                  U	/XESS9n
U
$ Ub$  SWUR                  U R                  S-
  5      U:  '   U(       a  U R                  WR                  XUS9n
OU R                  UWR                  ) SS	9n
[        U
 Vs/ s H  nUR                  U/XESS9PM     sn5      $ s  snf )
zm
fillna on the block with the value. If we fail, then convert to
block to hold objects instead and try again
r`  TFr6  r  r  r^   )r  rq  )r  )r$   r   r=   rq   rD   r  r0  cumsumr_   r  r  r!  r%  )rb   r   limitr`  r,  r  rq  r  rj  r   r   r.  s               rf   r  Block.fillnak  sN    &gy9  D$D)$++t<JD II5I122 v YY	MY2((D8 )  
7<DTYY]+e34,,>  C **UTVVGu*=C
 
 	 C ##EH( $  	
 	
s   D0r   r  r`  r  
limit_arear,  r  rq  c                  U R                   (       d2  U(       a  U R                  SS9/$ U(       a  U /$ U R                  5       /$ U R                  Xs5      u  p[        [        U R
                  5      nUS:X  a  UR                  nUR                  UUUU	S9nU	(       do  [        5       (       a`  Ub]  UR                  (       dL  U R                  R                  5       (       a-  [        R                  " [        [        [!        5       S9  SUl	        US:X  a  UR                  n[#        USS9nU R%                  XS9nUR'                  U/XgS	S
9$ )NFr6  r^   )methodr  r  r  r  Tr   r   r  r-  )r   r  rd  r	   rN   array_valuesr  _pad_or_backfillr   rn  rs   r   r  r  ro  r  r#   rT   r   r0  )rb   r  r  r`  r  r  r,  r  rq  r  rs   r   r   datar   s                  rf   pad_or_backfillBlock.pad_or_backfill  s.      		u	-..$D67499;-7,,Y@
 '):):;1966D**!	 + 

 "$$*"11yy&&((+!/1
 15-19#JZt<'''8!!2$H!MMri   forward)r`  r  limit_directionr  r,  r  rq  c       	        .   [        US5      nUS:X  a  [        R                  " U5        U R                  (       d2  U(       a  U R	                  SS9/$ U(       a  U /$ U R	                  5       /$ U R
                  [        :X  a2  U(       a  U R	                  SS9/$ U(       a  U /$ U R	                  5       /$ U R                  X5      u  pU R                  R                  " SUU R                  S-
  UUUUUS.U
D6n[        USS9nU(       do  [        5       (       a`  U	b]  U	R                  (       dL  U R                  R                  5       (       a-  [         R"                  " [$        [&        [)        5       S	9  SU	l        U R+                  XS
9nUR-                  U/XxSS9$ )Nr`  asfreqFr6  r^   )r  r  r  r  r  r  r  Tr   r  r   interpolater  ru   )r$   r?   clean_fill_methodr   r  rw   r~   rd  r  r  r_   rT   r   rn  rs   r   r  r  ro  r  r#   r   r0  )rb   r  r  r`  r  r  r  r,  r  rq  rd   r  rs   r   r  r   s                   rf   r  Block.interpolate  s~    &gy9X%%f-  		u	-..$D67499;-7 ::# 		u	-..$D67499;-7,,Y@
 &&22 	
Q+!	
 	

 Zt< "$$*"11yy&&((+!/1
 15-'''8!!2$M!RRri   c                    [         R                  " U R                  R                  USS9R                  nU R	                  US9/$ )z'return block for the diff of the valuesr   r  r  )r  diffrq   r  r   )rb   r  r   s      rf   r  
Block.diff"  s8    
 ZZqq9;;
z233ri   c                   U R                   S-
  n[        R                  " U5      (       d  U R                  [        :w  a  [        S5      eU R                  U5      n [        U R                  U5      n[        [        R                  U R                  5      n[        XQX45      nU R                  U5      /$ ! [         a#    U R                  U5      nUR                  XS9s $ f = f)z+shift the block by periods, possibly upcastr^   zfill_value must be a scalarr  )r_   r   r1   rw   r~   rQ  r   r,   r	   r   r  rq   rI   r   r'   r  )rb   periodsr   r  r  rq   r   r   s           rf   rI   Block.shift*  s     yy1} }}Z((TZZ:-E :;;11*=
	< )

JF "**dkk2Fv=J..z:;; ! 	<,,Z8B88G8;;	<s   B4 4*C! C!c                    U R                   S:X  d   e[        U5      (       d   e[        U R                  [        R
                  " UR                  5      U5      n[        USS9n[        X0R                  S9$ )z
compute the quantiles of the

Parameters
----------
qs : Index
    The quantiles to be computed in float64.
interpolation : str, default 'linear'
    Type of interpolation.

Returns
-------
Block
r   r   r  )
r_   r0   rE   rq   r   asarray_valuesr   r  r   )rb   qsinterpolationr   s       rf   quantileBlock.quantileK  sa    * yyA~~B bjj.DmT $F3Fnn==ri   c                *   U R                   (       a  U R                  (       a  U R                  U(       + S9$ SnU R                  R	                  U5      nX@R                  L a$  U(       d  UR                  5       nOU R
                  nU R                  XCS9$ )ai  
Rounds the values.
If the block is not of an integer or float dtype, nothing happens.
This is consistent with DataFrame.round behavivor.
(Note: Series.round would raise)

Parameters
----------
decimals: int,
    Number of decimal places to round to.
    Caller is responsible for validating this
using_cow: bool,
    Whether Copy on Write is enabled right now
r6  Nr   )
is_numericr   r  rq   roundrs   r   )rb   decimalsr  rs   rq   s        rf   r  Block.roundi  sv      $,,99i-900
 ""8,[[ 
  yy))&)<<ri   c                X   [        U5      (       d  U/nU R                  S:X  ap  [        [        R                  U R
                  5      n[        R                  " X!5      nU R                  R                  U5      n[        U 5      " X#U R                  S9/$ [        R                  " U5      U R
                  R                  S   :  a  [        e[        R                  " XR
                  R                  S   //5      nU R                  R                  n/ nSnU R                  R                  5       (       a  U R                  OSnU Hc  nXS-   :X  a  OUU R
                  US-   U2SS24   nXFS-   U n	[        U 5      " U[!        U	5      U R                  US9n
UR#                  U
5        UnMe     U$ )zDeletes the locs from the block.

We split the block to avoid copying the underlying data. We create new
blocks for every connected segment of the initial block that is not deleted.
The new blocks point to the initial array.
r^   r   r_   r   r   Nr   )r0   r_   r	   r   r  rq   deleter   r   maxr`   
IndexErrorconcatenateas_arrayrs   r   r   r   )rb   r   rq   r   mgr_locs_arrr   previous_locrs   idxr  r   s              rf   r  Block.delete  su    C  %C99>"**dkk2FYYv+F~~,,S1HJv		JKK66#;$++++A.. nncKK$5$5a$8#9:;~~.."$
 !II3355tyy4CQ&& \A%5%;Q%>?#1$4s;$ZnT&:QU !!"%L   ri   c                    [        U 5      e)(return a boolean if I am possibly a viewr    r   s    rf   is_viewBlock.is_view  s     "$''ri   c                    [        U 5      e)z@
The array that Series.array returns. Always an ExtensionArray.
r    r   s    rf   r  Block.array_values      
 "$''ri   c                    [        U 5      e)zs
return an internal format, currently just the ndarray
this is often overridden to handle to_dense like operations
r    ry   s     rf   
get_valuesBlock.get_values  r  ri   )r   rq   rk   r   )rk   r   )r   r   rk   None)NN)r   BlockPlacement | Noners   BlockValuesRefs | Nonerk   ro   )r   r%  rs   r&  rk   r   )rk   r   )rk   rr   )r   r   rk   r   )r   npt.NDArray[np.intp]rk   r   F)r   r   r   r   r   r   rk   r   )r   r   rk   r   )r   r   rk   r   rj   )r   r   rk   rl   )r  r   rk   ro   )r+  rl   r  r   r-  r   rk   rl   r  r   rk   rl   )r  r   r  r   rk   rl   )TTTTTnumpy_nullable)r  r   r  r   rC  r   rD  r   rE  r   rF  r   rG  r   rH  r   rk   rl   )rk   r   )FraiseFF)rw   r   r  r   rP  r   r  r   rB  r   rk   ro   )rV  r   rk   ro   )T)r7  r   rk   r   )r  r   r`  r   rk   r   )r  r   r`  r   )FNFN)r`  r   rj  znpt.NDArray[np.bool_] | Noner  r   rk   rl   )r`  r   r  r   rk   rl   )FFFN)r  zIterable[Any]r  zSequence[Any]r`  r   r|  r   r  r   rk   rl   )TFF)
rj  npt.NDArray[np.bool_]r`  r   r|  r   r  r   rk   rl   )r  
np.ndarrayrk   r-  rk   r   )r   )int | tuple[int, int] | tuple[slice, int]rk   r-  )r   4slice | npt.NDArray[np.bool_] | npt.NDArray[np.intp]rk   r   rq   r   r  r   rk   r$  )r   r'  r  r   r   r%  rk   ro   r  r'  r  r,  )r  r   rk   ro   FNinferFr  z
str | boolr  r   rk   rl   NFNFNr  
int | Noner`  r   r  r   rk   rl   r  r   r  r   r`  r   r  r9  r  #Literal['inside', 'outside'] | Noner,  Literal['infer'] | Noner  r   rk   rl   )r  r   r  rY   r`  r   r  r9  r  z&Literal['forward', 'backward', 'both']r  r;  r,  r<  r  r   rk   rl   )r  rr   rk   rl   r}   r   rr   r   r   rk   rl   )linear)r  rY   r  r   rk   ro   )r  rr   r  r   rk   r   rk   rL   rw   DtypeObj | Nonerk   r-  )Nr   
__module____qualname____firstlineno____doc____annotations__	__slots__r
  r
   r"   rz   r   r   r   r   r   propertyr   r   r   r   r   setterr   r   r   r   r   r   r   r   r   r   r   r   r   ra   r  r0  rm   r)  r&  r)   rw   r  rV   r  ra  rd  rp  rx  r  r  r  r  r`   r  r   r  r   r  r  r  r  r  r!  r  r  r  r  rI   r  r  r  r  r  r!  __static_attributes__ru   ri   rf   ro   ro      s&	    ('
I
IJ

  
 /  / 6  6 %  % 6  6 "  " 3  3 , , <  <     __& &  ,0'+	Q )Q %	Q
 
Q Q"  ,0'+	R )R %	R
 
R R 	 	     J J J J RW
J
J+9
JKO
J	
J 
J 6 6
 ) )" - -    *    2 42 42l II 	I
 I 
I IV 	8  	8  	,8 ,8 	,8
 
,8 ,8d ## $ $!%&6,, , 	,
 , , , , $, 
,b !  !  %11 1 	1
 1 1 
1 1f CHRV'=@'	' ' 	W 	W     
 -1u 	u +u u 
u un 
 F 	F F 
F FP 
 QQ !Q 	Q
 Q Q 
Q Qf  ; $	;
 ; ; ; 
; ;B ! !#J#	##$ 
 /3>>%H%%H %H ,	%H 
%H %HN* ,	*
 -*\?D BFT"$(T"	T"n OTu)&0u)GKu)	u)t !=
 =
 	=
 =
 
=
F  :>,02N 2N 	2N
 2N 2N 82N *2N 2N 
2Nh   BK:>,0AS #AS 	AS
 AS AS @AS 8AS *AS AS 
AS ASF 4 4<B  08>> -> 
	> >:  =  =J.` ( ( ( (( (ri   ro   c            	      6  ^  \ rS rSr% SrS\S'   \SSS jj5       r\SSS jj5       r\ S     SS	 jj5       r	\ S   SS
 jj5       r
\SU 4S jj5       r\\SS j5       5       r\SSS jj5       r\SSSSSSSS.               SS jj5       rSrU =r$ )EABackedBlocki  z6
Mixin for Block subclasses backed by ExtensionArray.
rL   rq   Nc                    U R                   R                  R                  XS9R                  nU R                  U5      /$ )zk
Shift the block by `periods`.

Dispatches to underlying ExtensionArray and re-boxes in an
ExtensionBlock.
)r   r   )rq   r  rI   r   )rb   r   r   r   s       rf   rI   EABackedBlock.shift  s9     [[]](((PRR
**:677ri   Fc                   UnUnU R                  U5      nU R                  U5      nU R                  nUR                  S:X  a  UR                  n[        XU5         X&U'   U $ ! [        [        4 a|    [        U R                  [        5      (       a#  U R                  USS9nUR                  XE5      s $ [        U [        5      (       a#  U R                  USS9nUR                  XE5      s $ e f = f)a  
Attempt self.values[indexer] = value, possibly creating a new array.

This differs from Block.setitem by not allowing setitem to change
the dtype of the Block.

Parameters
----------
indexer : tuple, list-like, array-like, slice, int
    The subset of self.values to set
value : object
    The value being set
using_cow: bool, default False
    Signaling if CoW is used.

Returns
-------
Block

Notes
-----
`indexer` is a direct slice/positional indexer. `value` must
be a compatible shape.
r   Tr  )r  r  rq   r_   r  rU   rQ  rR  rx   rw   r5   r  r  NDArrayBackedExtensionBlock)rb   r   r   r  orig_indexer
orig_valuerq   r   s           rf   r  EABackedBlock.setitem  s    4 
..w7''.;;! XXFgf5	#7O K I& 	$**m4400D0Qzz,;;D"=>>00D0Qzz,;; 	s   A" "AC.46C.,C.c                r   U R                   R                  n[        U5      nUnUnU R                  U5      nU R                  U5      nU[        R
                  L a  U R                  n[        XR) 5      u  pU	(       a(  U(       a  U R                  SS9/$ U R                  5       /$  UR                  X!5      R                  n
U R7                  U
5      nU/$ ! [        [        4 GaQ    U R                  S:X  d  U R                  S   S:X  a  [        U R                  [         5      (       a4  U R#                  U5      nUR%                  XgUS9nU R'                  XUSS9s $ [        U [(        5      (       a4  U R#                  U5      nUR%                  XgUS9nU R'                  XUSS9s $ e [        U[*        R,                  [.        45      n/ nU R1                  5       n[3        U5       HK  u  nnUnU(       a  US S 2XS-   24   nUS S 2XS-   24   nUR%                  UUUS9nUR5                  U5        MM     Us $ f = f)NFr6  r^   r   r  r!  r  )rq   r  r@   r  r   r  r   rD   r  _whererQ  rR  r_   r`   rx   rw   r5   r  r!  r0  rP  r   r  rL   r   r   r   r   )rb   r  r  r  r  arrr  	orig_condr  r  r   r.  r   r  r   r   r   r  r  r  s                       rf   r!  EABackedBlock.where   s4   
 kkmm!$'
	''.&&t,CNN"OOE&sE2 		u	-..IIK= '	"D022JP ''
3tQ I& %	"yyA~A!!3djj-8855jAC))JY)OC//9W 0    &ABB 55jAC))JY)OC//9W 0  
  &j2::~2NO
kkm&s^EAr"A&q!!e)|4'11u95G((1g(CC%%c* , "!K%	"s!   %C BH6AH6$BH65H6c                   [        U5      nU[        R                  L a  U R                  nUnUnU R	                  U5      nU R	                  U5      nUR                  5       (       d  U(       a  U R                  SS9/$ U /$ [        5       (       a`  Ub]  UR                  (       dL  U R                  R                  5       (       a-  [        R                  " [        [        [        5       S9  SUl        U R!                  USS9n U R"                  nUR$                  S:X  a  UR&                  n UR)                  X5        U /$ ! [*        [,        4 Ga.    U R$                  S:X  d  U R.                  S	   S:X  a{  [1        U R2                  [4        5      (       a#  U R7                  USS
9nUR9                  Xe5      s $ [1        U [:        5      (       a#  U R7                  USS
9nUR9                  Xe5      s $ e [1        U[<        R>                  [@        45      n	/ n
U RC                  5       n[E        U5       HJ  u  pUnU	(       a  USS2XS-   24   nUSS2XS-   24   nUR9                  X5      nU
RG                  U5        ML     U
s $ f = f)z
See Block.putmask.__doc__
Fr6  Nr  Tr  r   r^   r   r  )$r@   r   r  r   r  r*  r  r   rn  rs   r   r  r  ro  r  r#   ra  rq   r_   r  _putmaskrR  rQ  r`   rx   rw   r5   r  r  rP  r   r  rL   r   r   r   )rb   rj  r  r  rq  orig_newr  rq   r.  r  r   r   r   r   r  r  r  s                    rf   r  EABackedBlock.putmaske  s@    "$'#.. //C	%%c*&&t,xxzz		u	-..6M   *"11yy&&((+!/1
 15-	48;;!XXF#	"OOD&F vE :&  	"yyA~A!!3djj-88 55ht5TC;;y;;&ABB 55ht5TC;;y;;  &h^0LM
kkm&s^EA A$QE	\2'11u95G**W0C%%c* , "!A 	"s    (D< <A4I;26I;*BI;:I;c                  > U R                   S:X  aQ  U R                  R                  U5      nU R                  R                  U5      n[	        U 5      " X#U R                   S9/$ U R                  R                   S:X  a  / $ [
        TU ]	  U5      $ )Nr^   r  )r_   rq   r  r   r   super)rb   r   rq   r   	__class__s       rf   r  EABackedBlock.delete  sv     99>[['',F~~,,S1HJv		JKK[["Iw~c""ri   c                    U R                   $ r}   r  r   s    rf   r  EABackedBlock.array_values  s     {{ri   c                    U R                   nU[        :X  a  UR                  [        5      n[        R
                  " U5      R                  U R                  5      $ )zC
return object dtype as boxed values, such as Timestamps/Timedelta
)rq   r~   r  r[   r   r  r   r`   )rb   rw   rq   s      rf   r!  EABackedBlock.get_values  sA    
 !KKJ]]6*Fzz&!))$**55ri   r   r  c                  U R                   n	XS.n
S[        R                  " U	R                  5      R                  ;   a  XZS'   O$Ub!  [        [        U	5      R                   S35      eU	R                  S:X  a-  US:X  a'  U	R                  R                  " S0 U
D6R                  nOU	R                  " S0 U
D6nU R                  U5      /$ )N)r  r  r  z does not implement limit_area (added in pandas 2.2). 3rd-party ExtnsionArray authors need to add this argument to _pad_or_backfill.r   r^   ru   )rq   inspect	signaturer  
parametersr  r   r   r_   r  r   )rb   r  r  r`  r  r  r,  r  rq  rq   rd   r   s               rf   r  EABackedBlock.pad_or_backfill  s     ,2!C7,,V-D-DEPPP#-< #%<(() *A A  ;;!	22<V<>>J00:6:J**:677ri   ru   r}   r=  r(  )r  r   r4  r6  r3  r)  rj   r?  r@  r:  )r   rB  rC  rD  rE  rF  r
   rI   r  r!  r  r  r"   r  r!  r  rJ  __classcell__r_  s   @rf   rL  rL    sW    

8 
8 6 6p NSB&0BGKB	B BH AEK$(K	K KZ 	# 	#    6 6 
  :>,08 8 	8
 8 8 88 *8 8 
8 8ri   rL  c                     ^  \ rS rSr% SrS\S'        S       SU 4S jjjr\SS j5       rSS jr	SSS jjr
S	 rS
 r\SS j5       r\SS j5       r    SS jr\SS j5       r    SS jrSrU =r$ )r  i  z
Block for holding extension types.

Notes
-----
This holds all 3rd-party extension array types. It's also the immediate
parent class for our internal extension types' blocks.

ExtensionArrays are limited to 1-D.
rL   rq   c           	     j  > [        U R                  [        5      (       a  [        TU ]  UUUUUUS9$ U(       aE  U R
                  (       a4  U R                  R                  (       d  U R                  nU R                  nOU R                  XS5      u  p U R                  R	                  US X)S9nU	(       do  [        5       (       a`  Ub]  UR                  (       dL  U R                  R                  5       (       a-  [        R                  " [        [         [#        5       S9  SUl        U R-                  XS9n
U
R/                  U
/XES	S
9$ ! [$         ac    S nU R                  R	                  US US9n[        R                  " S['        U R                  5      R(                   S3[*        [#        5       S9   Nf = f)N)r   r  r`  r,  r  rq  )r   r  r  r  r  T)r   r  r  zExtensionArray.fillna added a 'copy' keyword in pandas 2.1.0. In a future version, ExtensionArray subclasses will need to implement this keyword or an exception will be raised. In the interim, the keyword is ignored by .r   r  )r  r-  )rx   rw   r5   r^  r  r   rq   _hasnars   rd  r   rn  r   r  r  ro  r  r#   rR  r   r   DeprecationWarningr   r0  )rb   r   r  r`  r,  r  rq  rs   r   r  r   r_  s              rf   r  ExtensionBlock.fillna  s    djj-007>!#- "   **4;;3E3E99DJ00DJD!=![[//E 0 
* *,,&2*99yy..00 3)'7'9
 9=5''
'>!!2$h!WWA  ![[//eDPU/V
 I DKK(112!	5
 '/1	s   E A*F21F2c                    U R                   S:X  a  [        U R                  5      4$ [        U R                  5      [        U R                  5      4$ )Nr^   )r_   r   rq   r   r   s    rf   r`   ExtensionBlock.shape=	  s>     99>$&&4>>"C$444ri   c                x   [        U[        5      (       a  Uu  p#[        R                  " U5      (       d  US:w  a  [	        U  S35      e[        U[
        5      (       a/  US:  a  U[        U R                  5      -  nU R                  X3S-    $ U R                  U   $ US:w  a  [	        U  S35      eU R                  $ )Nr   z only contains one itemr^   )rx   tuplecomis_null_slicer  r   r   rq   )rb   r   colr   s       rf   r  ExtensionBlock.igetD	  s     aHC$$S))cQh D6)@!ABB#u%% 73t{{++C {{3q11;;s##Av D6)@!ABB;;ri   c                l    U(       a  U R                   R                  5       U l         X R                   S S & g r}   r  r  s       rf   r  ExtensionBlock.set_inplace`	  s&     ++**,DKAri   c                f   [        U[        R                  [        45      (       aG  UR                  U R
                  R                  S-   :X  a   UR                  S   S:X  d   eUSS2S4   nU$ [        U[        5      (       a/  UR                  S   S:X  d   eUR                  SSS9R                  nU$ )z0
If necessary, squeeze a (N, 1) ndarray to (N,)
r^   Nr   r  )
rx   r   r  rL   r_   rq   r`   r8   _ixsr  r  s     rf   r  !ExtensionBlock._maybe_squeeze_argg	  s     sRZZ899DKK,,q00 99Q<1$$$ ad)C 
 \** 99Q<1$$$((11(%--C
ri   c                .   [        U[        5      (       a  [        U5      S:X  a  [        S U 5       5      (       aU  Uu  p#UR                  S:X  a+  US:H  R                  5       (       a  UR
                  S   S:X  d  [        S5      eUSS2S4   nU$ [        R                  " US   5      (       a  US   S:X  a  US   nU$ [        R                  " US   5      (       a  US   nU$ [        US   5      (       a  US   S   S:X  a  US   nU$ [        S5      eU$ )z_
Adapt a 2D-indexer to our 1D values.

This is intended for 'setitem', not 'iget' or '_slice'.
r   c              3     #    U  H5  n[        U[        R                  5      =(       a    UR                  S :H  v   M7     g7f)r   N)rx   r   r  r_   r  s     rf   r  9ExtensionBlock._unwrap_setitem_indexer.<locals>.<genexpr>	  s+     Ng:a,<1<gs   =?r^   r   zPThis should not be reached. Please report a bug at github.com/pandas-dev/pandas/N)rx   ru  r   r'  sizer`   r  r   
is_integerrv  rw  r0   )rb   r   firstseconds       rf   r  &ExtensionBlock._unwrap_setitem_indexer}	  s-    gu%%#g,!*;
 NgNNN 'KK1$&A+):):)<)<QSTAT-8   1+"  
++
a!!*  ""71:..!!*  gaj))gajmq.@!!* 	 *4  ri   c                    g)z,Extension arrays are never treated as views.Fru   r   s    rf   r  ExtensionBlock.is_view	  s     ri   c                B    U R                   R                  R                  $ r}   )rq   rw   _is_numericr   s    rf   r
  ExtensionBlock.is_numeric	  s    {{  ,,,ri   c                    U R                   S:X  aV  [        U[        5      (       d  [        SU5      e[	        S5      U   n[        U5      (       d  [        SU5      e[        S5      nU R                  U   $ )z
Return a slice of my values.

Parameters
----------
slicer : slice, ndarray[int], or ndarray[bool]
    Valid (non-reducing) indexer for self.values.

Returns
-------
ExtensionArray
r   z+invalid slicing for a 1-ndim ExtensionArrayr^   N)r_   rx   r   r  ranger   rq   )rb   r   new_locss      rf   r   ExtensionBlock._slice	  su    & 99> fe,,$A6  Qx'Hx==$A6  4[F{{6""ri   c                ~    U R                   U   n[        U 5      " X R                  U R                  U R                  S9$ )z>
Perform __getitem__-like specialized to slicing along index.
)r_   rs   )rq   r   r   r_   rs   )rb   r   r   s      rf   slice_block_rowsExtensionBlock.slice_block_rows	  s1     [[(
Dz*nn499499UUri   c                   UR                   u  pVUR                  U   nX6   n[        [        XS5      5       VVV	s/ s H=  u  nu  p[	        U 5      " U R
                  R                  XU   US9[        U	5      SS9PM?     n
nnn	X4$ s  sn	nnf )N)r  r   r   r   )arange_resultr  r   r(  r   rq   taker   )rb   r  r   r  r  r   rj  r   r   placer+  s              rf   r  ExtensionBlock._unstack	  s     %22
  \\$'
%+ (1Z1O'P

 (Q##G J  a(8Z !  u% (Q 	 

 |

s   ABr  r7  r8  r.  )r   r/  r(  r1  r#  )r   r0  rk   rL   )r   r   rk   r   r2  )r   rB  rC  rD  rE  rF  r  r"   r`   r  r  r  r  rH  r  r
  r   r
   r  r  rJ  rj  rk  s   @rf   r  r    s    	 
 !=X =X 	=X =X 
=X =X~ 5 58 ,(T  
 - -&#J&#	&#P V V' ,	'
 -' 'ri   r  c                  n    \ rS rSr% S\S'   Sr\S
S j5       r\SS j5       rSSS jjr	\
S
S	 j5       rSrg)
NumpyBlocki
  r-  rq   ru   c                2    U R                   R                  SL$ r  N)rq   baser   s    rf   r  NumpyBlock.is_view
  s     {{t++ri   c                ,    [        U R                  5      $ r}   )rN   rq   r   s    rf   r  NumpyBlock.array_values
  s    "4;;//ri   Nc                l    U[         :X  a  U R                  R                  [         5      $ U R                  $ r}   )r~   rq   r  ry   s     rf   r!  NumpyBlock.get_values
  s)    J;;%%j11{{ri   c                P    U R                   R                  nUR                  nUS;   $ )Nfciub)rq   rw   r   )rb   rw   r   s      rf   r
  NumpyBlock.is_numeric
  s$    !!zzwri   r#  r?  r}   r@  )r   rB  rC  rD  rF  rG  rH  r  r  r!  r"   r
  rJ  ru   ri   rf   r  r  
  sL    I, , 0 0
  ri   r  c                      \ rS rSrSrSrg)NumericBlocki'
  ru   Nr   rB  rC  rD  rG  rJ  ru   ri   rf   r  r  '
  	     Iri   r  c                      \ rS rSrSrSrg)ObjectBlocki-
  ru   Nr  ru   ri   rf   r  r  -
  r  ri   r  c                  8    \ rS rSr% SrS\S'   \SS j5       rSrg)	rP  i3
  z0
Block backed by an NDArrayBackedExtensionArray
rZ   rq   c                F    U R                   R                  R                  SL$ r  )rq   _ndarrayr  r   s    rf   r  #NDArrayBackedExtensionBlock.is_view:
  s     {{##((44ri   ru   Nr#  )	r   rB  rC  rD  rE  rF  rH  r  rJ  ru   ri   rf   rP  rP  3
  s!     ('5 5ri   rP  c                  ,    \ rS rSr% SrSrSrS\S'   Srg)DatetimeLikeBlockiA
  z*Block for datetime64[ns], timedelta64[ns].ru   FzDatetimeArray | TimedeltaArrayrq   N)	r   rB  rC  rD  rE  rG  r
  rF  rJ  ru   ri   rf   r  r  A
  s    4IJ**ri   r  c                  (    \ rS rSr% SrS\S'   SrSrg)DatetimeTZBlockiI
  z0implement a datetime64 block with a tz attributerK   rq   ru   N)r   rB  rC  rD  rE  rF  rG  rJ  ru   ri   rf   r  r  I
  s    :Iri   r  c                P   [        U [        R                  5      (       aM  [        U 5      n [	        U R
                  R                  [        5      (       a  [        R                  " U [        S9n [        U [        [        45      (       a  U R                  b  U R                  S5      n U $ )a  
Input validation for values passed to __init__. Ensure that
any datetime64/timedelta64 dtypes are in nanoseconds.  Ensure
that we do not have string dtypes.

Parameters
----------
values : np.ndarray or ExtensionArray

Returns
-------
values : np.ndarray or ExtensionArray
r   N)rx   r   r  rS   
issubclassrw   r   r   r  r[   rK   rP   freq
_with_freqr  s    rf   r   r   U
  sv      &"**%%/7fll''--XXfF3F&=.9::v{{?V""4(Mri   c                    [        U [        5      (       a  [        $ [        U [        5      (       a  [        $ [        U [
        5      (       a  [        $ U R                  nUS;   a  [        $ [        $ )z
Find the appropriate Block subclass to use for the given values and dtype.

Parameters
----------
dtype : numpy or pandas dtype

Returns
-------
cls : class, subclass of Block
Mm)
rx   r3   r  r7   rP  r4   r  r   r  r  r:  s     rf   get_block_typer  r
  s[     %))	E;	'	'**	E>	*	* ::Dt|  ri   c                R    [        U R                  5      n[        U 5      n U" U SXS9$ )Nr   r_   r   rs   )r  rw   r   )rq   r   rs   klasss       rf   r  r  
  s+     6<<(E (Fa9@@ri   r   c               :    [        U R                  5      nU" XXS9$ )Nr  )r  rw   )rq   r   r_   rs   r  s        rf   r   r   
  s     6<<(EiCCri   c                   U R                   U:  a  [        SU R                    SU S35      e[        U R                  5      (       dh  U R                   U:w  a  [        SU R                    SU S35      e[	        U5      [	        U 5      :w  a#  [        S[	        U 5       S[	        U5       35      egUS:X  a  [	        U5      S	:w  a  [        S
5      egg)a&  
ndim inference and validation.

Validates that values.ndim and ndim are consistent.
Validates that len(values) and len(placement) are consistent.

Parameters
----------
values : array-like
placement : BlockPlacement
ndim : int

Raises
------
ValueError : the number of dimensions do not match
z0Wrong number of dimensions. values.ndim > ndim [z > ]z1Wrong number of dimensions. values.ndim != ndim [z != zWrong number of items passed z, placement implies r   r^   zneed to splitN)r_   rQ  r-   rw   r   )rq   r   r_   s      rf   
check_ndimr  
  s    $ {{T##);;-s4&;
 	

 v||,,;;$((.}DaA  y>S[(/F} =%%(^$46  )
 
s9~*)) +ri   c                    [        U [        5      (       a3  U R                  5       n U(       a  US:  a  [        R                  " U 5      n [        U[
        5      (       a  UR                  nX4$ )zM
Ensure that we don't allow NumpyExtensionArray / NumpyEADtype in internals.
r^   )rx   r:   to_numpyr   
atleast_2dr6   numpy_dtype)rq   rw   r_   s      rf   extract_pandas_arrayr  
  sU     &011"D1H]]6*F%&&!!=ri   c                .   Uc  / n[        U [        5      (       aD  U  H<  n[        U[        5      (       a  UR                  U5        M+  UR                  U5        M>     U$ [        U [        5      (       d   [        U 5      5       eUR                  U 5        U$ )z.return a new extended blocks, given the result)rx   r  r   r   ro   r   )r   r+  rs      rf   r%  r%  
  s~    ~&$A!T""a a 	  M &%((6$v,6(fMri   c                    U R                   U:  a8  [        U R                  5      (       d  [        SU 5      n U R	                  SS5      n U $ )z2
Reshape if possible to have values.ndim == ndim.
z+np.ndarray | DatetimeArray | TimedeltaArrayr^   r   )r_   r-   rw   r	   r   )rq   r_   s     rf   r   r   
  sC    
 {{T"6<<00 GPF^^Ar*FMri   c                R   [        U [        [        45      (       a  U R                  [        5      $ [        U [
        [        45      (       a  U R                  n [        U [        R                  5      (       a0  [        5       (       a!  U R                  5       n SU R                  l        U $ )a  
The array that Series.values returns (public attribute).

This has some historical constraints, and is overridden in block
subclasses to return the correct array (e.g. period returns
object ndarray and datetimetz a datetime64[ns] ndarray instead of
proper extension array).
F)rx   rO   rM   r  r[   rK   rP   r  r   r  r   viewflags	writeabler  s    rf   r   r     sz     &;677}}V$$	F]N;	<	< &"**%%*=*?*?!& Mri   )re   r   rk   r   )rq   r   rk   r   )rw   r   rk   ztype[Block]r}   )rq   r   r   r   rs   r&  )r   r   r_   rr   rs   r&  rk   ro   )r   r   r_   rr   rk   r$  )rq   r   rw   rA  r_   rr   rk   z!tuple[ArrayLike, DtypeObj | None]rj   )r^   )rq   r   r_   rr   rk   r   )
__future__r   	functoolsr   rf  rt  typingr   r   r   r   r	   r
   r  r  numpyr   pandas._configr   r   r   pandas._libsr   r   libinternalsr   pandas._libs.internalsr   r   pandas._libs.missingr   pandas._typingr   r   r   r   r   r   r   r   r   r   r   r   pandas.errorsr!   pandas.util._decoratorsr"   pandas.util._exceptionsr#   pandas.util._validatorsr$   pandas.core.dtypes.astyper%   r&   pandas.core.dtypes.castr'   r(   r)   r*   r+   r,   pandas.core.dtypes.commonr-   r.   r/   r0   r1   r2   pandas.core.dtypes.dtypesr3   r4   r5   r6   r7   pandas.core.dtypes.genericr8   r9   r:   r;   pandas.core.dtypes.missingr<   r=   r>   pandas.corer?   pandas.core.algorithmscore
algorithmsr  pandas.core.array_algos.putmaskr@   rA   rB   rC   rD    pandas.core.array_algos.quantilerE   pandas.core.array_algos.replacerF   rG   rH   "pandas.core.array_algos.transformsrI   pandas.core.arraysrJ   rK   rL   rM   rN   rO   rP   pandas.core.baserQ   pandas.core.commoncommonrv  pandas.core.computationrR   pandas.core.constructionrS   rT   pandas.core.indexersrU   pandas.core.indexes.baserV   collections.abcrW   rX   pandas.core.apirY   pandas.core.arrays._mixinsrZ   rw   r~   ro  COW_WARNING_SETITEM_MSGrm   ro   rL  r  r  r  r  rP  r  r  r   r  r  r   r  r  r%  r   r   ru   ri   rf   <module>r     sE   "   	      
 $    . 2 4 7        & &  = 
 5   *     / 7 7
 &F XXh
  "[(L,,, [(|8Z8E Z8zZ] Zz 4: * 5- 5+3 +' :< RV
A
A"0
A8N
A$ $(DD 	D
 !D D'*T-58&,  ri   