
    OwgÄ                    ^   d Z ddlmZ ddlmZ ddlmZmZ ddlZ	ddlm
Z
 ddlmZ ddlmZ dd	lmZ dd
lmZmZmZmZmZ ddlmZmZmZmZmZ ddlmZ ddlm Z m!Z! ddl"m#Z#m$Z% ddl&m'Z' ddl(m)Z) ddl*m+Z,m-Z-m.Z.m/Z/m0Z0 ddl1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8 ddl9m:Z:m;Z; ddl<m=Z=m>Z>m?Z?m@Z@ ddlAmBZBmCZCmDZDmEZE erddlFmGZGmHZH ddlImJZJmKZKmLZLmMZM ddddd	 	 	 	 	 	 	 	 	 	 	 d3dZN	 	 	 	 	 	 	 	 	 	 d4dZOd5d6dZP	 	 	 	 	 	 	 	 d7dZQ	 	 	 	 	 	 	 	 d8dZRdddd 	 	 	 	 	 	 	 	 	 d9d!ZS	 	 	 	 	 	 	 	 	 	 d:d"ZTd;d#ZUd5d<d$ZVd=d%ZW	 	 	 	 	 	 d>d&ZXd?d'ZY	 	 	 	 	 	 	 	 	 	 d@d(ZZd?d)Z[	 	 	 	 	 	 	 	 	 	 dAd*Z\d+ Z]	 dB	 	 	 	 	 dCd,Z^dDd-Z_	 	 	 	 	 	 dEd.Z`	 	 	 	 	 	 dFd/Za	 	 	 	 	 	 	 	 dGd0Zb	 	 	 	 	 	 dHd1Zc	 	 dI	 	 	 	 	 	 	 	 	 dJd2Zdy)Kz~
Functions for preparing various inputs passed to the DataFrame or Series
constructors before passing them to a BlockManager.
    )annotations)abc)TYPE_CHECKINGAnyN)ma)using_pyarrow_string_dtype)lib)astype_is_view)"construct_1d_arraylike_from_scalardict_compatmaybe_cast_to_datetimemaybe_convert_platformmaybe_infer_to_datetimelike)is_1d_only_ea_dtypeis_integer_dtypeis_list_likeis_named_tupleis_object_dtype)ExtensionDtype)ABCDataFrame	ABCSeries)
algorithmscommon)ExtensionArray)StringDtype)arrayensure_wrapped_if_datetimelikeextract_arrayrange_to_ndarraysanitize_array)DatetimeIndexIndexTimedeltaIndexdefault_indexensure_indexget_objs_combined_axisunion_indexes)ArrayManagerSingleArrayManager)BlockPlacementensure_block_shape	new_blocknew_block_2d)BlockManagerSingleBlockManager create_block_manager_from_blocks'create_block_manager_from_column_arrays)HashableSequence)	ArrayLikeDtypeObjManagernptT)dtypeverify_integritytypconsolidatec               J   |r*|t        |       }nt        |      }t        | ||      \  } }nt        |      }| D cg c]  }t        |d       } }dgt	        |       z  }| D ]S  }	t        |	t        j                  t        f      r'|	j                  dk7  st	        |	      t	        |      k7  sJt        d       t        |      }t	        |      t	        |       k7  rt        d      ||g}
|dk(  rt        | |
||      S |d	k(  rt        | ||g      S t        d
| d      c c}w )zs
    Segregate Series based on type and coerce into matrices.

    Needs to handle a lot of exceptional cases.
    NTextract_numpy   zYArrays must be 1-dimensional np.ndarray or ExtensionArray with length matching len(index)z#len(arrays) must match len(columns)block)r;   refsr   2'typ' needs to be one of {'block', 'array'}, got '')_extract_indexr%   _homogenizer   len
isinstancenpndarrayr   ndim
ValueErrorr1   r(   )arrayscolumnsindexr8   r9   r:   r;   rA   xarraxess              Y/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/core/internals/construction.pyarrays_to_mgrrS   `   sD    ="6*E 'E #65%8 U#@FG1-6GGvF#  		CsRZZ$@A88q=s8s5z) 6 		 7#G
7|s6{">?? UD
g~6Dk
 	
 
FUG$455OPSuTUVWW= Hs   D c                ,   t        j                  |       }|t        t        |            }nt	        |      }|t	        |      }t        ||      \  }}t        |||t        |            \  }}||}t        |||||      }	|r|	j                         }	|	S )zA
    Extract from a masked rec array and create the manager.
    r8   r:   )	r   getdatar$   rF   r%   	to_arraysreorder_arraysrS   copy)
datarN   rM   r8   rY   r:   fdatarL   arr_columnsmgrs
             rR   rec_array_to_mgrr^      s     JJtE}c%j)U#w'#E73FK )gs5zRFK
e
EChhjJ    c                    |dk(  rt        | t              r| }|S | j                  dk(  r5t        | j                  | j
                  d   | j
                  d   d      }|S t        j                  | j                  d   | j                        }|S |dk(  rt        | t              r| }|S | j                  dk(  rt        t        | j
                  d               D cg c]  }| j                  |       }}|r|D cg c]  }|j                          }}t        || j
                  d   | j
                  d   g      }|S | j                         }|r|j                         }t        |g| j                  g      }|S t!        d| d      c c}w c c}w )	z
    Convert to specific type of Manager. Does not copy if the type is already
    correct. Does not guarantee a copy otherwise. `copy` keyword only controls
    whether conversion from Block->ArrayManager copies the 1D arrays.
    r@      r   r?   )r:   r   rB   rC   )rG   r.   rJ   rS   rL   rQ   r/   
from_arrayrN   r(   rangerF   iget_valuesrY   internal_valuesr)   rK   )r]   r:   rY   new_mgrirL   rP   r   s           rR   
mgr_to_mgrrh      s|    g~c<(G0 N- xx1}'JJSXXa[g* N# -77

1syyQ" N! 
c<(G N xx1}6;C<L6MN#//!,NN4:;Schhj;F;&vSXXa[/IJ N ++-!JJLE,eWsyykB N OPSuTUVWW O;s   F8Fc                   t        | t              rw|"| j                  t        | j                  g      }|| j                  }n| j                  |      } t        |       s(|&t        |      rt        j                  dt              } |dk(  rdn|}t        | dd       }d }t        |      st        |      rt        | t        j                  t        f      r<| j                  dkD  r-t        | j                   d         D 	cg c]  }	| d d |	f    } }	n| g} |t        t        t        |                   }nt#        |      }t%        | ||||      S t        |t&              rAt)        | d	      } |r| j+                         } | j                  dk(  r| j-                  d
d      } nt        | t        t        f      r[|s$|t/        | j0                  |      r| j2                  }|r| j4                  j+                         } n| j4                  } t7        |       } nlt        | t        j                  t        f      r?|t/        | j0                  |      r|nd}
t        j8                  | |
      } t7        |       } nt;        | |      } || j0                  |k7  rt=        | d ||d      } t?        | j                   d   | j                   d   ||      \  }}tA        | ||       |dk(  rtC        | j0                  jD                  tF              rt        j8                  | t              } |TtI        | j0                        r?t        | j                   d         D cg c]  }tK        tM        | d d |f                }}nWtO        jP                  | j0                  d      rtK        |       } t        | j                   d         D cg c]  }| d d |f    }}|r|D cg c]  }|j+                          }}tS        |||gd      S | jT                  } |tI        | j0                        rtW        |       }|D cg c]  }tM        |       }}tY        d t[        ||      D              rR|D cg c]  }t]        |d       }}t        t        |            D 	cg c]  }	t_        ||	   ta        |	             }}	nta        tc        t        |                  }t_        | ||      }|g}n|| j0                  jd                  dk(  rtg               rvti        d      }tW        |       }tk        |      D cg c]H  \  }}tm        |jo                         jq                  ||      ta        tc        ||dz               d      J }}}n.ta        tc        t        |                  }t_        | ||      }|g}t        |      dk(  rg }ts        |||gd      S c c}	w c c}w c c}w c c}w c c}w c c}w c c}	w c c}}w )N)r   r?   r8   r   Fr8   r?   rU   Tr=   rY   )r8   rY   allow_2dr   )rN   rM   mM)r9   c              3  *   K   | ]  \  }}||u  y wN ).0rO   ys      rR   	<genexpr>z!ndarray_to_mgr.<locals>.<genexpr>p  s     GdaqzGs   ra   )	placement)ru   rA   Upyarrow_numpy)storage)rJ   ):rG   r   namer"   rN   reindexrF   rH   emptyobjectgetattrr   rI   r   rJ   rc   shaper%   rS   r   r   rY   reshaper
   r8   _references_values
_ensure_2dr   _prep_ndarrayliker    	_get_axes!_check_values_indices_shape_match
issubclasstypestrr   r   r   r	   is_np_dtyper(   Tlistanyzipr+   r-   r*   slicekindr   r   	enumerater,   construct_array_type_from_sequencer0   )valuesrN   rM   r8   rY   r:   copy_on_sanitizevdtyperA   n_copyrg   rL   rP   obj_columnsrO   maybe_datetimedval
dvals_listblock_valuesbpnbrZ   s                          rR   ndarray_to_mgrr      s]    &)$?{{&.=LLE^^E*F 6{w2s7|XXfF3F !$wuDVWd+FD6"&9%&@ frzz>:;a v||A/ q!tF 
 XF?E#f+./G"7+GVWe5cJJ	FN	+ vT:[[]F;;!^^B*F	FY.	/M^FLL%@%%D^^((*F^^FF#	FRZZ8	9 e!D  	
 &u-F#
 #60@AV\\U2!
 QawNE7 &feW=
g~fll''-XXfF3F=_V\\:
 v||A/	  //q!t=F  v||T27?,1&,,q/,BCqfQTlCFC,23Schhj3F3FUG$4uMMXXF
 }66lBMNQ5a8NNGc+~&FGGBPQ$,T15QJQ s:/ Z]nQ6GHL 
  c'l 34Bf>B4L	6<<,,38R8TO46l %[1
 4 **,;;D;NuQA/
 
 E#g,/0&BT:t
7|q+w& ER D 4 O R
s1   ?W"W
8WW+WW
 W#&AW(c                0   | j                   d   t        |      k7  s| j                   d   t        |      k7  r`| j                   d   dcxk(  rt        |      k  rt        d       | j                   }t        |      t        |      f}t        d| d|       y)z\
    Check that the shape implied by our axes matches the actual shape of the
    data.
    r?   r   z)Empty data passed with indices specified.zShape of passed values is z, indices imply N)r~   rF   rK   )r   rN   rM   passedimplieds        rR   r   r     s     ||A#g,&&,,q/SZ*G <<?a,#e*,HII - u:s7|,5fX=MgYWXX +Hr_   r@   )r8   r:   rY   c                  |Lddl m}  || |t              }|j                         }|t	        ||          }nt        |      }|j                         rt        |      s|O|j                  j                         d   }	|	D ],  }
t        |j                  |
   ||      }||j                  |
<   . nt        j                  d      }t        t        j                  t!        |      |      }|j#                         }|r|g|z  }n&t%        |      D cg c]  }|j'                          }}||j(                  |<   t+        |      }t        |      }nVt+        | j-                               }|rt/        |      n
t1        d      }|D cg c]  }t3        j4                  | |          }}|r|dk(  rw|D cg c]k  }t7        |t8              r|j'                         nHt7        |t.              s%t7        |t:              r't=        |j                        r|j'                  d      n|m }}n+|D cg c]   }t?        |d	      r|j'                         n|" }}tA        ||||||
      S c c}w c c}w c c}w c c}w )z
    Segregate Series based on type and coerce into matrices.
    Needs to handle a lot of exceptional cases.

    Used in DataFrame.__init__
    r   )Series)rN   r8   rj   r|   r@   T)deepr8   )r8   r:   r;   )!pandas.core.seriesr   r|   isnarD   r%   r   r   r   nonzeror    iatrH   r8   r   nanrF   sumrc   rY   locr   keysr"   r$   commaybe_iterable_to_listrG   r   r   r   hasattrrS   )rZ   rN   rM   r8   r:   rY   r   rL   missingmidxsrg   rP   	nan_dtypevalnmissingrhs_r   krO   s                       rR   dict_to_mgrr     sE   " -G6:++-= #67(#34E 'E ;;=!1%!8    ..03 (A(AUKC$'FJJqM(
 HHX.	8UYW";;=%(*C 05X?!388:?C?&)

7#fw' DIIK !%%+=+;?CD!#,,T!W5DD'>    a0  q%(!!Y/+AGG4	 VVV& F  GMM'!W"5affh1<MFM%u#SWXX? @ E Ns   I I%1A0I*(%I/c                    t        | d         r|t        | d   j                        }t        | ||      \  }}t        |      }|3t	        | d   t
              rt        |       }nt        t        |             }|||fS )zA
    Convert a single sequence of arrays to multiple arrays.
    r   rj   )	r   r%   _fieldsrW   rG   r   _get_names_from_indexr$   rF   )rZ   rM   rN   r8   rL   s        rR   nested_data_to_arraysr     sz     d1g7?tAw/gU;OFG7#G}d1gy))$/E!#d),E7E!!r_   c                    t        |       dkD  xrG t        | d         xr7 t        | d   dd      dk(  xr" t        | t              xr | j
                  dk(   S )z7
    Check if we should use nested_data_to_arrays.
    r   rJ   r?   ra   )rF   r   r}   rG   r   rJ   )rZ   s    rR   treat_as_nestedr     sc    
 	D	A 	Fa!	FDGVQ'1,	F D.1Ddii1nE	r_   c                >   t        |       dk(  rt        j                  dt              S t	        | t
              r t        |       }|dt        j                  f   S d }t        | d         r4t        j                  | D cg c]
  } ||       c}      } t        |       S t	        | d   t        j                        rF| d   j                  dk(  r4t        j                  | D cg c]
  } ||       c}      } t        |       S  ||       } t        |       S c c}w c c}w )Nr   )r   r   rj   .c                p    t        |       rt        | t              r| S t        | d      } t	        |       }|S )NTr=   )r   rG   r   r   r   )vress     rR   convertz"_prep_ndarraylike.<locals>.convert/  s4    A*Q"=H!40$Q' 
r_   )rF   rH   r{   r|   rG   rc   r   newaxisr   r   rI   rJ   r   )r   rY   rP   r   r   s        rR   r   r   #  s     6{a xxf--	FE	"v&3

?## F1Iv6!71:67 f 
F1Irzz	*vay~~/Bv6!71:67 f f 7 7s   >D!Dc                    | j                   dk(  r"| j                  | j                  d   df      } | S | j                   dk7  rt        d| j                         | S )zB
    Reshape 1D values, raise on anything else other than 2D.
    r?   r   ra   zMust pass 2-d input. shape=)rJ   r   r~   rK   )r   s    rR   r   r   I  s\     {{aa! 45 M 
	6v||nEFFMr_   c                   d }g }g }| D ]N  }t        |t        t        f      rn||j                  |d      }t        |t              r!|j                  |ur|j                  |d      }|j                  |j                         |j                  }nt        |t              rp||j                  d      }t        |t        t        f      rt        |      }nt        |      }t        j                  ||j                  t        j                         }t#        |||d      }t%        j&                  ||       |j                  d        |j                  |       Q ||fS )NFrl   O)defaultr8   rY   )rG   r   r"   astyperN   rz   appendr   r   dictr!   r#   r   r	   fast_multigetrH   r   r    r   require_length_match)rZ   rN   r8   oindexhomogenizedrA   r   s          rR   rE   rE   T  s1    FKD  cIu-. jjUj3#y)ciiu.D kk%ek4KK(++C#t$ >"\\#.Fem^%DE%c*C s)C''V^^RVVL e5uEC$$S%0KK3; > r_   c                h   t        |       dk(  rt        d      S g }g }d}d}d}| D ]  }t        |t              rd}|j	                  |j
                         1t        |t              r+d}|j	                  t        |j                                      lt        |      r-t        |dd      dk(  rd}|j	                  t        |             t        |t        j                        s|j                  dkD  st        d       |s|st        d      |rt        |      }n|rt        |d      }|rzt        t!        |            }t        |      dkD  rt        d	      |rt        d
      |r0|d   t              k7  r-d|d    dt        |       }	t        |	      t        |d         }t#              S )zR
    Try to infer an Index from the passed data, raise ValueError on failure.
    r   FTrJ   r?   z,Per-column arrays must each be 1-dimensionalz2If using all scalar values, you must pass an indexsortz%All arrays must be of the same lengthz<Mixing dicts with non-Series may lead to ambiguous ordering.zarray length z does not match index length )rF   r$   rG   r   r   rN   r   r   r   r   r}   rH   rI   rJ   rK   r'   setr%   )
rZ   raw_lengthsindexeshave_raw_arrayshave_series
have_dictsr   rN   lengthsmsgs
             rR   rD   rD   ~  s   
 4yA~QK,.GOKJ Mc9%KNN399%T"JNN4
+,#73#:a#?"Os3x(RZZ(SXX\KLLM ;MNNg&	gE2s;'(w<!DEEN  qzSZ'#GAJ< 0!%j\+  !o%!'!*-Er_   c                0   ||j                  |      sg }|j                  |      }t        |      D ][  \  }}|dk(  r;t        j                  |t
              }|j                  t        j                         n| |   }|j                  |       ] |} |}| |fS )zB
    Pre-emptively (cheaply) reindex arrays with new columns.
    rk   rj   )	equalsget_indexerr   rH   r{   r|   fillr   r   )	rL   r\   rM   length
new_arraysindexerrg   r   rP   s	            rR   rX   rX     s     ~~k**,J!--g6G!'* '17((68CHHRVV$ )C!!#&'  F!K;r_   c                   t        d | D              }|st        t        |             S t        t	        t        |                   }d}t        |       D ]'  \  }}t        |dd       }||||<   d| ||<   |dz  }) t        |      S )Nc              3  :   K   | ]  }t        |d d      du  yw)ry   N)r}   )rr   ss     rR   rt   z(_get_names_from_index.<locals>.<genexpr>  s     K640<Ks   r   ry   zUnnamed r?   )r   r$   rF   r   rc   r   r}   r"   )rZ   has_some_namerN   countrg   r   r   s          rR   r   r     s    KdKKMSY'' s4y!12EE$ 1Avt$=E!H!%)E!HQJE <r_   c                t    |t        |       }nt        |      }|t        |      }||fS t        |      }||fS rp   )r$   r%   )NKrN   rM   s       rR   r   r     sN     }a U#" '> w''>r_   c                8    ddl m} t        t        ||             S )a  
    Converts a list of dataclass instances to a list of dictionaries.

    Parameters
    ----------
    data : List[Type[dataclass]]

    Returns
    --------
    list_dict : List[dict]

    Examples
    --------
    >>> from dataclasses import dataclass
    >>> @dataclass
    ... class Point:
    ...     x: int
    ...     y: int

    >>> dataclasses_to_dicts([Point(1, 2), Point(2, 3)])
    [{'x': 1, 'y': 2}, {'x': 2, 'y': 3}]

    r   )asdict)dataclassesr   r   map)rZ   r   s     rR   dataclasses_to_dictsr     s    0 #FD!""r_   c                   t        |       st        | t        j                        r| j                  j
                  rt        | j                  j
                        }|D cg c]  }| |   	 }}t        |       dk(  r/t        |      D ]!  \  }}|j                  dk(  s|dddf   ||<   # ||fS g t        g       fS t        | t        j                        rT| j                  j
                  >t        t        | j                  j
                              }|D cg c]  }| |   	 }}||fS t        | d   t        t        f      rt        |       }nst        | d   t        j                        rt        | |      \  }}nFt        | d   t               rt#        | |      \  }}n#| D cg c]  }t        |       } }t        |       }t%        |||      \  }	}|	|fS c c}w c c}w c c}w )a	  
    Return list of arrays, columns.

    Returns
    -------
    list[ArrayLike]
        These will become columns in a DataFrame.
    Index
        This will become frame.columns.

    Notes
    -----
    Ensures that len(result_arrays) == len(result_index).
    Nr   ra   )rF   rG   rH   rI   r8   namesr%   r   rJ   r"   r   tuple_list_to_arraysr   Mapping_list_of_dict_to_arraysr   _list_of_series_to_arrays_finalize_columns_and_data)
rZ   rM   r8   ry   rL   rg   rP   r   rO   contents
             rR   rW   rW     s   $ t9dBJJ'zz+&tzz'7'78189$t*99t9> #,F"3 2388q=(+AqD	F1I2 w&<###	D"**	%$***:*:*FTZZ--./#*+a$q'++w$q'D%=)d#	DGS[[	).tW=W	DGY	'0w?W #''Qa''d#1#wFGWG= : , (s   GG"Gc                    t        | d   t              rt        j                  |       }|S t        j                  |       }|S )Nr   )rG   r   r	   to_object_array_tuplesto_object_array)rZ   r   s     rR   r   r   Q  s@     $q'5!,,T2 N %%d+Nr_   c                   |3| D cg c]  }t        |t        t        f      s| }}t        |d      }i }g }| D ]  }t	        |dd       }|t        t        |            }t        |      |v r|t        |         }n|j                  |      x}|t        |      <   t        |d      }	|j                  t        j                  |	|              t        j                  |      }
|
|fS c c}w )NFr   rN   Tr=   )rG   r   r   r&   r}   r$   rF   idr   r   r   r   take_ndrH   vstack)rZ   rM   rO   	pass_dataindexer_cachealigned_valuesr   rN   r   r   r   s              rR   r   r   \  s      $Q1
1y,6O(PQQ	Q(?+-MN C7D)=!#a&)Ee9%#BuI.G161B1B71KKGmBuI.q5j00ABC ii'GG) Rs
   C*C*c                (   |>d | D        }t        d | D               }t        j                  ||      }t        |      }| D cg c]   }t	        |      t
        u r|n
t        |      " } }t        j                  | t        |            }||fS c c}w )a  
    Convert list of dicts to numpy arrays

    if `columns` is not passed, column names are inferred from the records
    - for OrderedDict and dicts, the column names match
      the key insertion-order from the first record to the last.
    - For other kinds of dict-likes, the keys are lexically sorted.

    Parameters
    ----------
    data : iterable
        collection of records (OrderedDict, dict)
    columns: iterables or None

    Returns
    -------
    content : np.ndarray[object, ndim=2]
    columns : Index
    c              3  N   K   | ]  }t        |j                                 y wrp   )r   r   )rr   rO   s     rR   rt   z*_list_of_dict_to_arrays.<locals>.<genexpr>  s     ,!tAFFH~,s   #%c              3  <   K   | ]  }t        |t                y wrp   )rG   r   )rr   ds     rR   rt   z*_list_of_dict_to_arrays.<locals>.<genexpr>  s     9qz!T*9   r   )r   r	   fast_unique_multiple_list_genr%   r   r   dicts_to_arrayr   )rZ   rM   genr   pre_colsr  r   s          rR   r   r   {  s    . ,t,9D99944StDx( 8<<!aDAd1g-<D<  tG}5GG =s   %Bc                    t        | j                        }	 t        ||      }t        |      r-|d   j                  t        j                  k(  rt        ||      }||fS # t        $ r}t	        |      |d}~ww xY w)zG
    Ensure we have valid columns, cast object dtypes if possible.
    Nr   rj   )
r   r   _validate_or_indexify_columnsAssertionErrorrK   rF   r8   rH   object_convert_object_array)r   rM   r8   contentserrs        rR   r   r     su     GIIH'/'B
 8}!**bjj8'>W  'o3&'s   A 	A9(A44A9c                   |t        t        |             }|S t        |t              xr t	        d |D              }|s:t        |      t        |       k7  r#t        t        |       dt        |        d      |rrt        |D ch c]  }t        |       c}      dkD  rt        d      |r@t        |d         t        |       k7  r&t        t        |d          dt        |        d      |S c c}w )a  
    If columns is None, make numbers as column names; Otherwise, validate that
    columns have valid length.

    Parameters
    ----------
    content : list of np.ndarrays
    columns : Index or None

    Returns
    -------
    Index
        If columns is None, assign positional column index value as columns.

    Raises
    ------
    1. AssertionError when content is not composed of list of lists, and if
        length of columns is not equal to length of content.
    2. ValueError when content is list of lists, but length of each sub-list
        is not equal
    3. ValueError when content is list of lists, but length of sub-list is
        not equal to length of content
    c              3  <   K   | ]  }t        |t                y wrp   )rG   r   )rr   cols     rR   rt   z0_validate_or_indexify_columns.<locals>.<genexpr>  s      7
&)JsD!7
r  z! columns passed, passed data had z columnsr?   z<Length of columns passed for MultiIndex columns is differentr   )r$   rF   rG   r   allr  rK   )r   rM   
is_mi_listr  s       rR   r  r    s   4 G-4 N/  . 
3 7
-47
 4

 c'lc'l: w<. Aw<.*  0CH01A5 R 
 3wqz?c'l: 71:''H7|nH.  N 1s   C/c                N    fd}| D cg c]
  } ||       }}|S c c}w )aA  
    Internal function to convert object array.

    Parameters
    ----------
    content: List[np.ndarray]
    dtype: np.dtype or ExtensionDtype
    dtype_backend: Controls if nullable/pyarrow dtypes are returned.
    coerce_float: Cast floats that are integers to int.

    Returns
    -------
    List[ArrayLike]
    c                   t        j                  d      k7  r6t        j                  | dk7        } | j                  t        j                  d      k(  rat	        |       } dk7  r| j                  t        j                  d      k(  rst               }|j                         }|j                  | |      } | S dk7  r?t        | t         j                        r%| j                  j                  dv rt        | d      } | S t        t              r&j                         }|j                  | d      } | S j                  d	v rt        |       } | S )
Nr   numpy)	try_floatconvert_to_nullable_dtyperj   iufbFrl   r   rn   )rH   r8   r	   maybe_convert_objectsr   r   r   r   rG   rI   r   pd_arrayr   r   )rP   	new_dtypearr_clsclscoerce_floatr8   dtype_backends       rR   r   z%convert_object_array.<locals>.convert  s7   BHHSM!++&*77*BC }99-5c:C$/CII#4N$/M	"+"@"@"B%44S	4J& 
% #g-*S"**2Myy~~/&s7  
 E>2 002((E(F 
 t# -S%8
r_   rq   )r   r8   r%  r$  r   rP   rL   s    ```   rR   r  r    s,    ,(T '..sgcl.F.M /s   ")rM   r"   r8   DtypeObj | Noner9   boolr:   z
str | Noner;   r'  returnr6   )
rZ   znp.rec.recarray | np.ndarrayr8   r&  rY   r'  r:   r   r(  r6   )T)r:   r   rY   r'  r(  r6   )r8   r&  rY   r'  r:   r   r(  r6   )r   
np.ndarrayrN   r"   rM   r"   r(  None)
rZ   r   r8   r&  r:   r   rY   r'  r(  r6   )
rZ   r3   rM   Index | NonerN   r+  r8   r&  r(  z$tuple[list[ArrayLike], Index, Index])r(  r'  )rY   r'  r(  r)  )r   r)  r(  r)  )rN   r"   r8   r&  r(  z!tuple[list[ArrayLike], list[Any]])r(  r"   )
rL   list[ArrayLike]r\   r"   rM   r+  r   intr(  tuple[list[ArrayLike], Index])
r   r-  r   r-  rN   r+  rM   r+  r(  ztuple[Index, Index]rp   )rM   r+  r8   r&  r(  r.  )rZ   zlist[tuple | list]r(  r)  )rZ   r   rM   r+  r(  tuple[np.ndarray, Index])rZ   z
list[dict]rM   r+  r(  r/  )r   r)  rM   r+  r8   r&  r(  r.  )r   zlist[np.ndarray]rM   r+  r(  r"   )r  F)
r   zlist[npt.NDArray[np.object_]]r8   r&  r%  r   r$  r'  r(  r,  )e__doc__
__future__r   collectionsr   typingr   r   r  rH   r   pandas._configr   pandas._libsr	   pandas.core.dtypes.astyper
   pandas.core.dtypes.castr   r   r   r   r   pandas.core.dtypes.commonr   r   r   r   r   pandas.core.dtypes.dtypesr   pandas.core.dtypes.genericr   r   pandas.corer   r   r   pandas.core.arraysr   pandas.core.arrays.string_r   pandas.core.constructionr   r   r   r   r   r    pandas.core.indexes.apir!   r"   r#   r$   r%   r&   r'   #pandas.core.internals.array_managerr(   r)   pandas.core.internals.blocksr*   r+   r,   r-   pandas.core.internals.managersr.   r/   r0   r1   collections.abcr2   r3   pandas._typingr4   r5   r6   r7   rS   r^   rh   r   r   r   r   r   r   r   rE   rD   rX   r   r   r   rW   r   r   r   r   r  r  rq   r_   rR   <module>rE     s   # 
   5  4   5
 . 2      
  "!>X>X
 >X >X 
>X >X >XB 
&  	 
   
   F"Re#2e:>eEHeePYY$Y/4Y	Y. "PY
PY
 PY 
PY PY PYf"
"" " 	"
 *"4	#L''.'&'T8v*/:FPS"6$
'2>$#D ;?55(75"5p
 >"
"" "J  #	,55(45
5v !	B*BB B 	B
 Br_   