+
    xȇi7                     p    ^ RI t^ RIt^ RIHtHtHt ^ RIHt	 ^ RI
Hu Ht  ! R R4      t ! R R4      tR# )    N)	DataFrameIndexSeriesc                   R  a  ] tR t^t o ]P
                  R 4       t]P                  P                  R]	! ]
! ^
4      4      4      R 4       tR tR tR tR tR tR	 tR
 tR tR tR tR tR tR tR t]P                  P                  RR. RO3RR.4      R 4       tR tR tRtV tR# )
TestSamplec                    V\         J d0   \        P                  P                  ^4      P	                  ^
4      pM.\        P                  P                  ^4      P	                  R4      pV! VRR7      # )   N)dtype)
   r   )r   nprandomdefault_rngstandard_normal)selfframe_or_seriesarrs   && v/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/tests/frame/methods/test_sample.pyobjTestSample.obj   sU    f$))''*::2>C))''*::8DCs$//    testc           
         \         P                  P                  ^4      P                  ^ ^d4      p\        P
                  ! VP                  ^VR7      VP                  ^VR7      4       \        P
                  ! VP                  RVR7      VP                  RVR7      4       \        P
                  ! VP                  ^\         P                  P                  V4      R7      VP                  ^\         P                  P                  V4      R7      4       \        P
                  ! VP                  R\         P                  P                  V4      R7      VP                  R\         P                  P                  V4      R7      4       \        P
                  ! VP                  ^R\         P                  P                  V4      R7      VP                  ^R\         P                  P                  V4      R7      4       . . rT\        ^4       FG  pVP                  VP                  ^VR7      4       VP                  VP                  RVR7      4       KI  	  \        P
                  ! V!   \        P
                  ! V!   R# )r	   nrandom_stategffffff?)fracr   T)r   replacer   N)	r   r   r   integerstmassert_equalsamplerangeappend)r   r   r   seedos1os2_s   &&&    r   test_sampleTestSample.test_sample   s    yy$$Q'00C8
JJJ.

QT
0R	
 	JJCdJ3JJCdJ3	

 	JJ)>)>t)DJEJJ)>)>t)DJE	

 	JJCbii.C.CD.IJJJJCbii.C.CD.IJJ	

 	JJYY2248  
 JJYY2248  	
 rSqAJJszzADz9:JJszzsz>?  	
r   c                    \        VP                  ^R7      ^8H  4      '       g   Q h\        VP                  RR7      ^8H  4      '       g   Q h\        VP                  RR7      ^8H  4      '       g   Q hR# )   r   g(\?r   g
ףp=
?N)lenr!   r   r   s   &&r   test_sample_lengthsTestSample.test_sample_lengthsE   sd    3:::?a'((((3::4:(A-....3::4:(A-....r   c                    R p\         P                  ! \        VR7      ;_uu_ 4        VP                  RR7       RRR4       R#   + '       g   i     R# ; i)zdrandom_state must be an integer, array-like, a BitGenerator, Generator, a numpy RandomState, or Nonematcha_string)r   Npytestraises
ValueErrorr!   r   r   msgs   && r    test_sample_invalid_random_state+TestSample.test_sample_invalid_random_stateK   s<    + 	 ]]:S11JJJJ/ 2111s   AA	c                    R p\         P                  ! \        VR7      ;_uu_ 4        VP                  ^RR7       RRR4       R#   + '       g   i     R# ; i)z0Please enter a value for `frac` OR `n`, not bothr3   g333333?)r   r   Nr6   r:   s   && r   "test_sample_wont_accept_n_and_frac-TestSample.test_sample_wont_accept_n_and_fracT   s7    @]]:S11JJJ% 2111s   AA	c                P   \         P                  ! \        R R7      ;_uu_ 4        VP                  RR7       RRR4       \         P                  ! \        RR7      ;_uu_ 4        VP                  RR7       RRR4       R#   + '       g   i     LQ; i  + '       g   i     R# ; i)z<A negative number of rows requested. Please provide `n` >= 0r3   r,   Nz?A negative number of rows requested. Please provide `frac` >= 0r-   g333333ӿr6   r/   s   &&r   $test_sample_requires_positive_n_frac/TestSample.test_sample_requires_positive_n_fracZ   s|    ]]P
 
 JJJ	

 ]]S
 
 JJDJ!	
 

 


 
 
s   B$BB	B%	c                    \         P                  ! \        R R7      ;_uu_ 4        VP                  RR7       RRR4       R#   + '       g   i     R# ; i)z$Only integers accepted as `n` valuesr3   g	@r,   Nr6   r/   s   &&r   test_sample_requires_integer_n)TestSample.test_sample_requires_integer_nf   s2    ]]:-STTJJJ UTTTs   AA	c                l   R p\         P                  ! \        VR7      ;_uu_ 4        VP                  ^^ ^.R7       RRR4       \         P                  ! \        VR7      ;_uu_ 4        VP                  ^R.^,          R7       RRR4       R#   + '       g   i     LZ; i  + '       g   i     R# ; i)5Weights and axis to be sampled must be of same lengthr3   r   weightsN      ?r6   r:   s   && r   "test_sample_invalid_weight_lengths-TestSample.test_sample_invalid_weight_lengthsk   sw    E]]:S11JJQFJ+ 2 ]]:S11JJSEBJJ/ 21 21 211s   B)B"B	"B3	c                    R.^
,          pRp\         P                  ! \        VR7      ;_uu_ 4        VP                  ^VR7       RRR4       R#   + '       g   i     R# ; i)皙?z.weight vector many not include negative valuesr3   rJ   Ngr6   )r   r   bad_weightsr;   s   &&  r   test_sample_negative_weights'TestSample.test_sample_negative_weightst   sB    frk>]]:S11JJKJ0 2111s   AA 	c                   R .^
,          p\         P                  V^ &   Rp\        P                  ! \        VR7      ;_uu_ 4        VP                  ^VR7       RRR4       R .^
,          p\         P                  ) V^ &   \        P                  ! \        VR7      ;_uu_ 4        VP                  ^VR7       RRR4       R#   + '       g   i     Lp; i  + '       g   i     R# ; i)rP   z*weight vector may not include `inf` valuesr3   rJ   N)r   infr7   r8   r9   r!   )r   r   weights_with_infr;   weights_with_ninfs   &&   r   test_sample_inf_weights"TestSample.test_sample_inf_weights{   s      52: ff:]]:S11JJ$4J5 2 !EBJ "w!]]:S11JJ$5J6 21 21
 211s   C "C C	C$	c                    ^.^
,          p^dV^ &   Rp\         P                  ! \        VR7      ;_uu_ 4        VP                  ^VRR7       RRR4       R#   + '       g   i     R# ; i)   zWeighted sampling cannot be achieved with replace=False. Either set replace=True or use smaller weights. See the docstring of sample for details.r3   Fr   rK   r   Nr6   )r   r   high_variance_weightsr;   s   &&  r   %test_sample_unit_probabilities_raises0TestSample.test_sample_unit_probabilities_raises   sX    !"b#&a " 	
 ]]:S11JJ$95JI 2111s   AA&	c                L    ^.^
,          p^	V^ &   VP                  ^VRR7       R# r[   Fr\   Nr!   )r   r   edge_variance_weightss   && r   5test_sample_unit_probabilities_edge_case_do_not_raise@TestSample.test_sample_unit_probabilities_edge_case_do_not_raise   s.     "#b#$a 

Q 5u
Er   c                L    ^.^
,          p^V^ &   VP                  ^VRR7       R# ra   rb   )r   r   low_variance_weightss   && r   2test_sample_unit_normal_probabilities_do_not_raise=TestSample.test_sample_unit_normal_probabilities_do_not_raise   s,     !sRx"#Q

Q 4e
Dr   c                    ^ .^
,          p\         P                  ! \        RR7      ;_uu_ 4        VP                  ^VR7       RRR4       R#   + '       g   i     R# ; i)r   $Invalid weights: weights sum to zeror3   rJ   Nr6   )r   r   zero_weightss   && r   test_sample_zero_weights#TestSample.test_sample_zero_weights   sA     sRx]]:-STTJJLJ1 UTTTs   AA	c                    \         P                  .^
,          p\        P                  ! \        RR7      ;_uu_ 4        VP                  ^VR7       RRR4       R#   + '       g   i     R# ; i)r   rk   r3   rJ   N)r   nanr7   r8   r9   r!   )r   r   nan_weightss   && r   test_sample_missing_weights&TestSample.test_sample_missing_weights   sE     vvhm]]:-STTJJKJ0 UTTTs   AA,	c                    R .^
,          pRV^&   \         P                  ! VP                  ^^ VR7      VP                  R,          4       R # )NrL   r   axisrK         N)r   r    r!   iloc)r   r   weights_with_Nones   && r   test_sample_none_weights#TestSample.test_sample_none_weights   sB    !FRK"!
JJ,=J>	
r   zfunc_str,argznp.arrayc           	     T   \        R \        ^
^4      R\        ^^4      /4      p\        P                  ! WC4      pVP	                  ^\        V4      ! V4      R7      pVP	                  ^\        P                  ! \        V4      ! V4      4      R7      p\        P                  ! WV4       R# )col1col2r   N)	r   r"   r   get_objr!   evalcomr   r    )r   func_strargr   r   resultexpecteds   &&&&   r   test_sample_random_state#TestSample.test_sample_random_state   s     r2b"FGjj.ad8nS.AB::0@0@hPSAT0U:V
)r   c                :   V! \         P                  ! ^d4      4      p\         P                  P                  ^4      pVP	                  ^2VR7      pVP	                  ^2VR7      pVP
                  P                  VP
                  P                  8H  P                  4       '       d   Q hVP	                  ^2\         P                  P                  ^4      R7      pVP	                  ^2\         P                  P                  ^4      R7      p\        P                  ! WE4       R# )d   r   N)
r   aranger   r   r!   indexvaluesallr   r    )r   r   r   rngresult1result2s   &&    r   test_sample_generator TestSample.test_sample_generator   s    biin-ii##A& **r*4**r*4MM((GMM,@,@@EEGGGG **r		0E0Eb0I*J**r		0E0Eb0I*J
)r   c                
   \        R \        R4      /4      p\        P                  ! W!4      pRp\        P
                  ! \        VR7      ;_uu_ 4        VP                  ^RR7       RRR4       R#   + '       g   i     R# ; i)AabczJReplace has to be set to `True` when upsampling the population `frac` > 1.r3   F)r   r   N)r   listr   r   r7   r8   r9   r!   )r   r   r   r;   s   &&  r   *test_sample_upsampling_without_replacement5TestSample.test_sample_upsampling_without_replacement   sb     d5k*+jj. Y 	 ]]:S11JJAuJ- 2111s   A11B	 N)r	      r[   r   )znp.random.MT19937r   )znp.random.PCG64   )__name__
__module____qualname____firstlineno__r7   fixturer   markparametrizer   r"   r(   r0   r<   r?   rC   rF   rM   rR   rX   r^   rd   rh   rm   rr   r|   r   r   r   __static_attributes____classdictcell____classdict__s   @r   r   r      s     ^^0 0 [[VT%)_5, 6,\/0&
"
017
JFE21
 [[&$#	
*** 
. 
.r   r   c                   D   a  ] tR t^t o R tR tR tR tR tR t	Rt
V tR# )	TestSampleDataFramec           
        ^ .^
,          p^V^&   \        R\        ^
^4      R\        ^^4      RR.^
,          RV/4      pVP                  ^RR7      p\        P                  ! W2P
                  R,          4       \        \        ^
4      4      pRp\        P                  ! \        VR	7      ;_uu_ 4        VP                  ^R
R7       RRR4       Rp\        P                  ! \        VR	7      ;_uu_ 4        VP                  ^R
^R7       RRR4       \        P                  ! \        RR	7      ;_uu_ 4        VP                  ^RR7       RRR4       ^ .^
,          pRV^ &   \        P                  ! VP                  ^VR7      VP
                  R,          4       \        R\        ^
4      RR.^
,          /4      p^ ^.p\        P                  ! VP                  ^^VR7      VR.,          4       \        P                  ! VP                  ^RVR7      VR.,          4       ^ .^
,          pRV^&   \        P                  ! VP                  ^RVR7      VP
                  R,          4       \        P                  ! VP                  ^RVR7      VP
                  R,          4       Rp\        P                  ! \        VR	7      ;_uu_ 4        VP                  ^^R7       RRR4       Rp\        P                  ! \        VR	7      ;_uu_ 4        VP                  ^RR7       RRR4       \        \        ^
4      4      p\        P                  ! \        RR	7      ;_uu_ 4        VP                  ^^R7       RRR4       Rp\        P                  ! \        VR	7      ;_uu_ 4        VP                  ^^R.^
,          R7       RRR4       R#   + '       g   i     EL
; i  + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     EL0; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     R# ; i)r   r   r   	colStringaeasyweightsrJ   rw   z@Strings cannot be passed as weights when sampling from a Series.r3   weight_columnNzLStrings can only be passed to weights when sampling from rows on a DataFrame)r   rK   rv   z-'String passed to weights not a valid column'not_a_real_column_namerL   :Nr[   Nru   columnsrowsr   z)No axis named 2 for object type DataFrame)r   rv   z2No axis named not_a_name for object type DataFrame
not_a_namez&No axis named 1 for object type SeriesrI   )r   r"   r!   r   assert_frame_equalrz   r   r7   r8   r9   KeyError)	r   easy_weight_listdfsample1serr;   weights_less_than_1second_column_weightweights	   &        r   r(   TestSampleDataFrame.test_sample   sd   
 38b"b"cURZ/	
 ))a)7
gwws|4 U2YP]]:S11JJOJ4 2 	 ]]:S11II?I; 2 ]]K
 
 II#;I<
  !cBh!$A
bii!5HiI277SU;W b	6C52:>? !1v
II+?I@"fX,	

 	II	3GIH"fX,	
 rq	
bii!&&iI277SV<X
III8"''#,	

 :]]:S11III" 2 C]]:S11III- 2 U2Y]]:-UVVJJJ# W F]]:S11IIC52:I6 21w 211 211
 
 
F 211 211 WV
 211sT   3O5O6O0	PPP,!P?O	O-	0P	P	P)	,P<	?Q	c           	     V   ^ .^,          p^V^&   \        R\        ^
^4      R\        ^^4      RR.^
,          /4      pVP                  ^^VR7      p\        P                  ! W2R.,          4       \        P                  ! VP                  ^^*R7      VP                  ^^ ^*R7      4       R# )	r   r   r   r   r   ru   r   )r   rv   r   N)r   r"   r!   r   r   )r   r   r   r   s   &   r   test_sample_axis1%TestSampleDataFrame.test_sample_axis1@  s    37U2r]FE"bM;PR
S
 ))aa1A)B
g;-'89 	III+RYYQSY-T	
r   c                   \        R . ROR. R	O/. R
OR7      p\        . RO. ROR7      p\        P                  ! VP                  ^.,          VP                  ^VR7      4       \        . RO. ROR7      p\        P                  ! VP                  ^.,          VP                  ^VR7      4       \        R^ .^^.R7      p\        P                  ! VP                  ^.,          VP                  ^VR7      4       \        ^^ .^^.R7      p\        P                  ! \        RR7      ;_uu_ 4        VP                  ^VR7       RRR4       R#   + '       g   i     R# ; i)r   r   )r   rK   g{Gz?rk   r3   N)rx   ry      r   bc)	   rx   r   )r[   r   r   )r   rx   r   )gMbP?r   i'  )r   rx   r   )	r   r   r   r   locr!   r7   r8   r9   )r   r   r   ser2ser3ser4s   &     r   %test_sample_aligns_weights_with_frame9TestSampleDataFrame.test_sample_aligns_weights_with_frameP  s   	6?C9UYi0
bffaSk299Q9+DE 'z:
bffaSk299Q9+EF tQi1v.
bffaSk299Q9+EF q!fQF+]]:-STTIIaI& UTTTs   .EE	c                   \        \        P                  P                  ^4      P	                  R4      . ROR7      pVP                  ^4      p\        P                  ! R4      ;_uu_ 4        ^VR&   RRR4       R#   + '       g   i     R# ; i)r	   )r   Nd)r   r   r   )r   r   r   r   r   r!   r   assert_produces_warning)r   r   df2s   &  r   test_sample_is_copy'TestSampleDataFrame.test_sample_is_copye  se     II!!!$44W=
 iil''--CH .---s   +A;;B	c                   \         P                  ! \         P                  ^\         P                  .4      pVP                  4       p\	        . RO4      pVP                  VR7       \        P                  ! W4       \        R. R	OR^\         P                  \         P                  ./4      pVR,          P                  4       pVP                  RRRR7       VR,          p\        P                  ! W4       R# )
r[   r   r   rK   g      ?T)r   r   rK   N)r[   r	   r   )r[   r[   r[   )
r   arrayrp   copyr   r!   r   assert_numpy_array_equalr   assert_series_equal)r   r   r   r   r   s   &    r   #test_sample_does_not_modify_weights7TestSampleDataFrame.test_sample_does_not_modify_weightsp  s    2661bff-.;;=Y 	

6
"
##F5 )YBFFBFF8KLMi=%%'
		sD)	<I
v0r   c           	         \        R \        ^
^4      R\        ^^4      RR.^
,          /4      pVP                  ^RR7      p\        \        ^4      4      p\        P
                  ! VP                  VRR7       R# )r   r   r   r   T)ignore_index)exactN)r   r"   r!   r   r   assert_index_equalr   )r   r   r   expected_indexs   &   r   test_sample_ignore_index,TestSampleDataFrame.test_sample_ignore_index  sf    U2r]FE"bM;PR
S
 140uQx
fllN$Gr   r   N)r   r   r   r   r(   r   r   r   r   r   r   r   r   s   @r   r   r      s,     S7j
 '*	1$H Hr   r   )numpyr   r7   pandasr   r   r   pandas._testing_testingr   pandas.core.commoncorecommonr   r   r   r   r   r   <module>r      s;      
     W. W.tbH bHr   