
    Owg*                     P    d dl Zd dlZd dlZd dlmZmZmZ d dlm	Z
  G d d      Zy)    N)	DataFrameSeries
date_rangec                   B    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zy
)TestDataFrameRoundc                 
   t               }t        j                  ||j                                t        g dg dd      }t        g dg dd      }t        j                  |j                         |       d}t        g dg dd      }t        j                  |j                  |      |       t        j                  t	        j                  ||      |       ddg}d	}t        j                  t        |
      5  |j                  |       d d d        t        g dg dd      }ddd}t        j                  |j                  |      |       t        g dg dd      }ddi}t        j                  |j                  |      |       ddd}	t        j                  |j                  |	      |       ddd}
d}t        j                  t        |
      5  |j                  |
       d d d        ddd}
t        j                  t        |
      5  |j                  |
       d d d        t        |
      }t        j                  t        |
      5  |j                  |       d d d        dddgd}
t        j                  t        |
      5  |j                  |
       d d d        t        |
      }t        j                  t        |
      5  |j                  |       d d d        t        |
      }t        j                  t        |
      5  |j                  |       d d d        t        |
      }t        j                  t        |
      5  |j                  |       d d d        ddd}|dz  }t        g dg dd      }t        j                  |j                  |      |       t        t        j                  dd      }t        j                  t        |
      5  |j                  |       d d d        t        j                  |d   j                  d      |d          d}t        g dg dd      }d|j                  _        d|j                  _        t        j                  |j                  |      |       t        j                  |d   j                  |      |d          t        j                  |j                  |      d   |d          y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   mxY w# 1 sw Y   :xY w# 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   OxY w)Ng+?gCl @gCl@gX9v?gZd;@gZd;	@col1col2      ?       @      @   )gQ?g(\ @g(\@)gGz?gףp=
@gףp=
	@   z4decimals must be an integer, a dict-like or a Seriesmatch)皙?g @g@)g333333?皙@g	@r   )col3r   g      ?z#Values in decimals must be integersfood   )g     [@   i6  )g      Y@   i,  r   cols)r   tmassert_frame_equalroundnppytestraises	TypeErrorr   nanassert_series_equalcolumnsname)selfdfexpected_roundeddecimals
round_listmsg
round_dictexpected_partially_roundedpartial_round_dictwrong_round_dictnon_int_round_dictnon_int_round_Seriesnegative_round_dictbig_dfexpected_neg_roundednan_round_Seriess                   \/var/www/horilla/myenv/lib/python3.12/site-packages/pandas/tests/frame/methods/test_round.py
test_roundzTestDataFrameRound.test_round   s    [
b"((*-  5?TUV %o%WX
bhhj*:; $'1CD
 	bhhx02BC 	bhhr846FG V
D]]9C0 	!HHZ 	! %$.@A
  +

bhhz24DE &/*OD&
" %a[
bhh'9:<VW %&q1
bhh'78:TU '(53]]9C0 	)HH'(	) '(7]]9C0 	)HH'(	)  &&89]]9C0 	+HH)*	+ '(!Q8]]9C0 	)HH'(	)  &&89]]9C0 	+HH)*	+  &&89]]9C0 	+HH)*	+  &&89]]9C0 	+HH)*	+ (*26c(&0AB 
 	fll+>?AUV "2661"=>]]9C0 	'HH%&	' 	r&z//24DV4LM $'1CD
 !

(.  %
bhhx02BC 	r&z//9;KF;ST
rxx1&9;KF;STg	! 	!0	) 	)
	) 	)	+ 	+
	) 	)	+ 	+
	+ 	+	+ 	+	' 	'sl   ;SS$S1S>TTT%T2 T?S!$S.1S;>TTT"%T/2T<?U	c                 6   t        ddgddgg      }t        j                  |d      }t        ddgd	d
gg      }t        j                  ||       d}t        j                  t        |      5  t        j                  |d|       d d d        y # 1 sw Y   y xY w)N{Gz?g(\?Q?g
ףp=
@r   )r.   r   r           g      @z$the 'out' parameter is not supportedr   )r.   out)r   r#   r"   r    r!   r$   r%   
ValueError)r+   r,   rA   expectedr0   s        r;   test_round_numpyz#TestDataFrameRound.test_round_numpy   s    ttTl34hhrA&sCj3*56
c8,4]]:S1 	-HHR!,	- 	- 	-s   -BBc                 L   t        dt        j                  dg      j                         }t	        j
                  d       5  |j                         }d d d        t        dt        j                  dg      j                         }t	        j                  |       y # 1 sw Y   JxY w)Nr>   r?   r   r@   )r   r#   r'   to_framer    assert_produces_warningr"   r!   )r+   r,   resultrC   s       r;   test_round_numpy_with_nanz,TestDataFrameRound.test_round_numpy_with_nan   s|    T2664()224''- 	 XXZF	 3,-668
fh/	  	 s    BB#c                 H   t        g dg dt        dd      d      }t        g dg dt        dd      d      }t        j                  |j	                         |       t        j                  |j	                  d      |       t        j                  |j	                  d	di      |       t        j                  |j	                  d	d
i      |       t        j                  |j	                  d
dd      |       t        j                  |j	                  ddi      |       y )N)r   r   gffffff
@g@)1acf20111111   )periods)r   r   r   )r   r   r   g      @r   r   r   r   r   )r   r   r    r!   r"   )r+   r,   round_0s      r;   test_round_mixed_typez(TestDataFrameRound.test_round_mixed_type   s    ,,":q9
 ,,":q9
 	bhhj'2
bhhqk2.
bhh{3R8
bhh{3W=
bhh1'=>H
bhh{3R8    c                    t        t        j                  j                  d      j                  ddg      g dg d      }t	        j
                  ||fd      }|j                         }t        j                  |j                  |j                         t        g dg d	
      }d}t        j                  t        |      5  |j                  |       d d d        y # 1 sw Y   y xY w)Nr      )ABC)firstsecondthird)r)   indexr   )axis)r   r   r   )rW   rX   rW   )r]   z Index of decimals must be uniquer   )r   r#   randomdefault_rngpdconcatr"   r    assert_index_equalr]   r   r$   r%   rB   )r+   r,   dfsroundedr.   r0   s         r;   !test_round_with_duplicate_columnsz4TestDataFrameRound.test_round_with_duplicate_columns   s     II!!!$++QF3#.
 iiRq)))+
gmmSYY7)?;0]]:S1 	HHX	 	 	s   CC&c                     t        g dg dd      }t        g dg dd      }t        j                  t        |      |       y )Nr	   r
   r   r   )r   r    r!   r"   )r+   r,   r-   s      r;   test_round_builtinz%TestDataFrameRound.test_round_builtin   s<      5?TUV %o%WX
eBi)9:rT   c                    t        j                  dgdz  dgdz  z         }t        t        j                  j                  d      j	                  d      t        d            }|j                  d      }||_        |j                         j                  |      }|j                  dk(  sJ |j                  d      }|j                  dk(  sJ t        j                  ||       y )NlowrV   hir   )   rV   abcr)   )ra   CategoricalIndexr   r#   r_   r`   listr"   r]   copy	set_indexshaper    r!   )r+   idxr,   rC   df_categoricalrH   s         r;    test_round_nonunique_categoricalz3TestDataFrameRound.test_round_nonunique_categorical   s    !!5'A+
":;ryy,,Q/66v>UT88A;,,S1##v---%%a(||v%%%
fh/rT   c                     t        j                  t        j                  dd            }t        ddgddgg|      }|j	                         }t        ddgd	d	gg|      }t        j                  ||       y )
Nr   r   gQ?r   g333333?g      ?rn   r   r@   )ra   ro   interval_ranger   r"   r    r!   )r+   r)   r,   rH   rC   s        r;   $test_round_interval_category_columnsz7TestDataFrameRound.test_round_interval_category_columns   sl    %%b&7&71&=>sc4[17CsCj3*5wG
fh/rT   c                 p    t               }|j                         }t        j                  ||       ||usJ y )N)r   r"   r    r!   )r+   r,   rH   s      r;   test_round_empty_not_inputz-TestDataFrameRound.test_round_empty_not_input   s2    [
b&)rT   N)__name__
__module____qualname__r<   rD   rI   rS   rf   rh   rv   ry   r{    rT   r;   r   r      s2    oUb	-09.$;00 rT   r   )numpyr#   r$   pandasra   r   r   r   pandas._testing_testingr    r   r   rT   r;   <module>r      s)       
 T  T rT   