gL i3 UdZddlmZddlmZmZmZmZmZddl Z ddl m Z ddl m Z mZddlmZddlmZmZmZerdd lmZmZed edZGd d Zd diZeedddZeedddZd]dZd^dZd^dZiZ de!d<de d<de d<de d<de d<de d<ee dddZ"iZ#d e!d!<de#d<de#d<de#d<ee#dddZ$d_d"Z%d diZ&d#e!d$<ee&d%dd&Z'ed`d'Z(edad(Z( dbd)Z(iZ)d#e!d*<de)d+<de)d <ee)dd,Z*ee)d-ddZ+dcd.Z,iZ-d/e!d0<de-d+<de-d <d1e-d2<de-d<ee-d3ddZ.ee-d4ddZ/dd1d5Z0ee0d67Z1dddd1d8Z2ee2d9ddZ3ee2d:ddZ4dd;iZ5dddZ6ddiZ7d#e!d?<ee7d@ddZ8d diZ9d#e!dA<ee9dBddZ:iZ;de!dC<de;d<de;d<de;d<ee;dDd6EZ|s|sy| |jn|}| |jn|}| |jn|}|dk(rt||||jy|dk(rt |||jy|dk(rt |||||jytd|d)Nargskwargsbothzinvalid validation method '')rrrr rrr ValueError)rr r!rrrs r__call__zCompatValidator.__call__@sF#m #*  $ $$  !'F V  %':DMM J x  E64== 9 v  $tV%8$-- :6(!DE Er)NNN)rz str | NonereturnNone)__name__ __module__ __qualname__rr%rrrr3sM! 7 7  7  ! F  F Frroutargminr")rrrargmaxc>t|ts||f|z}d}||fS)NT) isinstancer )skipnar s rprocess_skipnar3hs+&'"fny4 4<rc<t||\}}t|||S)a If 'Series.argmin' is called via the 'numpy' library, the third parameter in its signature is 'out', which takes either an ndarray or 'None', so check if the 'skipna' parameter is either an instance of ndarray or is None, since 'skipna' itself should be a boolean )r3validate_argminr2r r!s rvalidate_argmin_with_skipnar7p#"&$/LFDD&! Mrc<t||\}}t|||S)a If 'Series.argmax' is called via the 'numpy' library, the third parameter in its signature is 'out', which takes either an ndarray or 'None', so check if the 'skipna' parameter is either an instance of ndarray or is None, since 'skipna' itself should be a boolean )r3validate_argmaxr6s rvalidate_argmax_with_skipnar;|r8rzdict[str, int | str | None]ARGSORT_DEFAULTSaxis quicksortkindorderstableargsort)rrrzdict[str, int | None]ARGSORT_DEFAULTS_KINDclt|s||f|z}d}t||dtt|}|S)a! If 'Categorical.argsort' is called via the 'numpy' library, the first parameter in its signature is 'axis', which takes either an integer or 'None', so check if the 'ascending' parameter has either integer type or is None, since 'ascending' itself should be a boolean T)r)r validate_argsort_kindrbool) ascendingr r!s rvalidate_argsort_with_ascendingrJs@) 1|d" $A>T9%I rzdict[str, Any] CLIP_DEFAULTScliprFcyrr+r>r r!s rvalidate_clip_with_axisrOrcyrr+rNs rrOrOrPrcNt|tr|f|z}d}t|||S)a If 'NDFrame.clip' is called via the numpy library, the third parameter in its signature is 'out', which can takes an ndarray, so check if the 'axis' parameter is an instance of ndarray, since 'axis' itself should either be an integer or None N)r1r validate_cliprNs rrOrOs1$ w~$ KrCUM_FUNC_DEFAULTSdtype)rrcumsumct|s |f|z}d}n%t|tjr t |}t ||||S)z If this function is called via the 'numpy' library, the third parameter in its signature is 'dtype', which takes either a 'numpy' dtype or 'None', so check if the 'skipna' parameter is a boolean or not Tr)r r1npbool_rHvalidate_cum_func)r2r r!names rvalidate_cum_func_with_skipnar]sD 6?y4 FBHH %fdF$/ Mrzdict[str, bool | None]ALLANY_DEFAULTSFkeepdimsallany)r,r_r!)r)r>rUr,r_minmaxCzdict[str, str]RESHAPE_DEFAULTSreshapeREPEAT_DEFAULTSrepeatROUND_DEFAULTSround SORT_DEFAULTSsort)rrzdict[str, Any | None]STAT_FUNC_DEFAULTSinitialoverwrite_inputsumprodmeanmedianSTAT_DDOF_FUNC_DEFAULTSzdict[str, str | None] TAKE_DEFAULTSraisemodetakecXt|ts||f|z}d}t||dd|S)z If this function is called via the 'numpy' library, the third parameter in its signature is 'axis', which takes either an ndarray or 'None', so check if the 'convert' parameter is either an instance of ndarray or is None TrFr")rr)r1r validate_take)convertr r!s rvalidate_take_with_convertr|Hs6 '7#wzD $AfE Nraxes transposec|g}t|t|z }t|t|zdkDrtd|dy)z 'args' and 'kwargs' should be empty, except for allowed kwargs because all of their necessary parameters are explicitly listed in the function signature Nrz?numpy operations are not valid with groupby. Use .groupby(...). () instead)setlenr )r\r r!alloweds rvalidate_groupby_funcr\sX  [3w< 'F 4y3v;"% !!%j 2  #r)rbrcrprqrrstdvarc|t|t|zdkDr"|tvrtd|dtdy)z 'args' and 'kwargs' should be empty because all of their necessary parameters are explicitly listed in the function signature rzAnumpy operations are not valid with resample. Use .resample(...).rztoo many arguments passed inN)rRESAMPLER_NUMPY_OPSr TypeError)rr r!s rvalidate_resampler_funcrqsS  4y3v;" ( ()&&,XZ9 677 #rcN|y||k\s |dkr||zdkrtd|dyy)a Ensure that the axis argument passed to min, max, argmin, or argmax is zero or None, as otherwise it will be incorrectly ignored. Parameters ---------- axis : int or None ndim : int, default 1 Raises ------ ValueError Nrz4`axis` must be fewer than the number of dimensions ())r$)r>ndims rvalidate_minmax_axisrsA | t|qTD[1_OPTvUVWXX&5r)rsrrrbrcrprqcR|tvrt|||St|}|||S)NrX)_validation_funcsvalidate_stat_func)rr r!validation_funcs r validate_funcrs1 %%!$e<<'.O 4 ((r)r2bool | ndarray | Noner&ztuple[bool, Any])r2rr&rH)rIzbool | int | Noner&rH)r>r r&r')r>rr&r)r>zndarray | AxisNoneTr&zAxisNoneT | None)r2rHr&rH)r{zndarray | bool | Noner&rHr)r\strr&r')rrr&r')r.)r>zAxisInt | Nonerintr&r')r&r')U__doc__ __future__rtypingrrrrrnumpyrYr pandas._libs.libr r pandas.errorsr pandas.util._validatorsr rrpandas._typingrrrrARGMINMAX_DEFAULTSr5r:r3r7r;r<__annotations__validate_argsortrDrGrJrKrSrOrTr[validate_cumsumr]r^ validate_all validate_anyLOGICAL_FUNC_DEFAULTSvalidate_logical_funcMINMAX_DEFAULTS validate_min validate_maxrevalidate_reshapergvalidate_repeatrivalidate_roundrk validate_sortrmcopy SUM_DEFAULTS PROD_DEFAULTS MEAN_DEFAULTSMEDIAN_DEFAULTSr validate_sum validate_prod validate_meanvalidate_medianrtvalidate_stat_ddof_funcrurzr|TRANSPOSE_DEFAULTSvalidate_transposerrrrrrr+rrrs"#2   T40I)F)FXT]!hv1"hv1   13-2& !#I1V 02,1 "f!%g"&h'&  "' ~-A      *%'>&!'%#f!"Xf!  +-',# 5Q 5Q !%%8'(=hO$tO5Q 5Q %,S>.1"If!$*4.0!8F#(. '&a.0 */ f# f g VHM ,.)."7 5!&&(  V Z Y!!# !!# $))+%*!"# !&:$%7If!  A  A "8F35/4#' !%&+ #)*A(S') $) e f VHM  d^$k&a  $J 8Y*      )r