
    bMh*                     X    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dS )    N)	DataFrameSeries
date_rangec                   D    e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
S )TestDataFrameRoundc                    t                      }t          j        ||                                           t          g dg dd          }t          g dg dd          }t          j        |                                |           d}t          g dg dd          }t          j        |                    |          |           t          j        t	          j        ||          |           ddg}d	}t          j        t          |
          5  |                    |           d d d            n# 1 swxY w Y   t          g dg dd          }ddd}t          j        |                    |          |           t          g dg dd          }ddi}t          j        |                    |          |           ddd}	t          j        |                    |	          |           ddd}
d}t          j        t          |
          5  |                    |
           d d d            n# 1 swxY w Y   ddd}
t          j        t          |
          5  |                    |
           d d d            n# 1 swxY w Y   t          |
          }t          j        t          |
          5  |                    |           d d d            n# 1 swxY w Y   dddgd}
t          j        t          |
          5  |                    |
           d d d            n# 1 swxY w Y   t          |
          }t          j        t          |
          5  |                    |           d d d            n# 1 swxY w Y   t          |
          }t          j        t          |
          5  |                    |           d d d            n# 1 swxY w Y   t          |
          }t          j        t          |
          5  |                    |           d d d            n# 1 swxY w Y   ddd}|dz  }t          g dg dd          }t          j        |                    |          |           t          t          j	        dd          }t          j        t          |
          5  |                    |           d d d            n# 1 swxY w Y   t          j
        |d                             d          |d                    d}t          g dg dd          }d|j        _        d|j        _        t          j        |                    |          |           t          j
        |d                             |          |d                    t          j
        |                    |          d         |d                    d S )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                   e/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/tests/frame/methods/test_round.py
test_roundzTestDataFrameRound.test_round   s7    [[
b"((**---  5 5 5?T?T?TUUVV %ooo%W%WXX
bhhjj*:;;; $'''1C1C1CDD
 
 	bhhx002BCCC 	bhr8446FGGG V
D]9C000 	! 	!HHZ   	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! %$__.@.@.@AA
 
  ++

bhhz224DEEE &/***OOODD&
 &
" %a[
bhh'9::<VWWW %&q11
bhh'788:TUUU '(553]9C000 	) 	)HH'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) '(77]9C000 	) 	)HH'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)  &&899]9C000 	+ 	+HH)***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ '(!Q88]9C000 	) 	)HH'(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)  &&899]9C000 	+ 	+HH)***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+  &&899]9C000 	+ 	+HH)***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+  &&899]9C000 	+ 	+HH)***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ (*266c(&&&0A0A0ABB 
  
 	fll+>??AUVVV "261"="=>>]9C000 	' 	'HH%&&&	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	r&z//224DV4LMMM $'''1C1C1CDD
 
 !
(. %
bhhx002BCCC 	r&z//99;KF;STTT
rxx11&9;KF;STTTTTs   D44D8;D8H55H9<H9 JJ	J7KK KL((L,/L,M??NN4OOOP--P14P17SS Sc                 J   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            d S # 1 swxY w Y   d S )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4hrA&&&sCj3*566
c8,,,4]:S111 	- 	-HR!,,,,	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	- 	-s   3BBBc                 h   t          dt          j        dg                                          }t	          j        d           5  |                                }d d d            n# 1 swxY w Y   t          dt          j        dg                                          }t	          j        ||           d S )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    T264())2244'-- 	  	 XXZZF	  	  	  	  	  	  	  	  	  	  	  	  	  	  	 3,--6688
fh/////s   A$$A(+A(c                    t          g dg dt          dd          d          }t          g dg dt          dd          d          }t          j        |                                |           t          j        |                    d          |           t          j        |                    d	di          |           t          j        |                    d	d
i          |           t          j        |                    d
dd          |           t          j        |                    ddi          |           d S )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   sJ   ,,,,,,":q999 
 
 ,,,,,,":q999 
 
 	bhhjj'222
bhhqkk2...
bhh{33R888
bhh{33W===
bhh1'='=>>HHH
bhh{33R88888    c                    t          t          j                            d                              ddg          g dg d          }t	          j        ||fd          }|                                }t          j        |j	        |j	                   t          g dg d	
          }d}t          j        t          |          5  |                    |           d d d            d S # 1 swxY w Y   d S )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   s5    I!!!$$++QF33#OO...
 
 
 iRq)))))++
gmSY777)))???;;;0]:S111 	 	HHX	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   C))C-0C-c                     t          g dg dd          }t          g dg dd          }t          j        t          |          |           d S )Nr	   r
   r   r   )r   r    r!   r"   )r+   r,   r-   s      r;   test_round_builtinz%TestDataFrameRound.test_round_builtin   sg      5 5 5?T?T?TUUVV %ooo%W%WXX
eBii)9:::::rT   c                    t          j        dgdz  dgdz  z             }t          t          j                            d                              d          t          d                    }|                    d          }||_        |	                                
                    |          }|j        dk    sJ |                    d          }|j        dk    sJ t          j        ||           d S )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+
":;;ry,,Q//66v>>UTTT88A;;,,S11#v----%%a((|v%%%%
fh/////rT   c                    t          j        t          j        dd                    }t          ddgddgg|          }|                                }t          ddgd	d	gg|          }t          j        ||           d S )
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   s    %b&71&=&=>>sc4[17CCCsCj3*5wGGG
fh/////rT   c                     t                      }|                                }t          j        ||           ||usJ d S )N)r   r"   r    r!   )r+   r,   rH   s      r;   test_round_empty_not_inputz-TestDataFrameRound.test_round_empty_not_input   sB    [[
b&)))rT   N)__name__
__module____qualname__r<   rD   rI   rS   rf   rh   rv   ry   r{    rT   r;   r   r      s        oU oU oUb	- 	- 	-0 0 09 9 9.  $; ; ;0 0 00 0 0         rT   r   )numpyr#   r$   pandasra   r   r   r   pandas._testing_testingr    r   r   rT   r;   <module>r      s                     
      T  T  T  T  T  T  T  T  T  T rT   