
    d,                         d dl m Z mZ d dlmZ d dlZd dlZd dlmZm	Z	m
Z
mZmZmZmZmZmZmZmZ d dlmZ d dlmc mc mZ  G d d          ZdS )    )datetime	timedelta)StringION)NACategorical	DataFrame
MultiIndexNaTPeriodIndexSeries	Timestamp
date_rangeoption_contextperiod_rangec                      e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zej        j        d             Zd Zd Zej        j        d             Zd Zd Zd Zd Zd Zd Zd Zd Zd Zej                            dej         ej!        g          ej                            de"dge#dgg          d                         Z$d Z%d Z&d  Z'd! Z(d" Z)d#S )$TestDataFrameReprInfoEtcc                    t          d          dd}fdt          |          D             }t          |                              d          }|j        t
          k                                    sJ t          |           t          |j        d dd d f                    t          |j        d dd d f                    d S )NACDEFGHIJKLMNOP2     c                 F    g | ]}fd t                    D             S )c                 N    g | ]!}t           j                                      "S  )nprandomchoice).0xletss     ]/var/www/html/t/fyr/venv311/lib/python3.11/site-packages/pandas/tests/frame/test_repr_info.py
<listcomp>zPTestDataFrameReprInfoEtc.test_repr_bytes_61_lines.<locals>.<listcomp>.<listcomp>"   s)    >>>Q")""4((>>>    )range)r   _r   slens     r    r!   zETestDataFrameReprInfoEtc.test_repr_bytes_61_lines.<locals>.<listcomp>"   s4    UUU1>>>>%++>>>UUUr"   U1<   =   )	listr#   r   astypedtypesobjectallrepriloc)selfnseqswordsdfr   r%   s       @@r    test_repr_bytes_61_linesz1TestDataFrameReprInfoEtc.test_repr_bytes_61_lines   s    %&&UUUUUeUUUu$$T**	V#((***** 	RRWSbS!!!V_RWSbS!!!V_r"   c                     t          j        ddgddg          }t          t          j                            dd          |          }t          j        ||          }t          |           d S )	N)r   r   )   r6   u   Δi1names      index)	r	   from_tuplesr   r   r   randntmget_objr.   )r0   frame_or_seriesr=   objs       r    test_repr_unicode_level_namesz6TestDataFrameReprInfoEtc.test_repr_unicode_level_names+   sc    &'7$?OPPP	1--U;;;jo..S					r"   c                     t          g dg dg dd                              ddg          }t          |j                  }d|d<   ||_        t	          |           d	d
g|d<   ||_        t	          |           d S )Nr6   r:      r;               	   abcrP   rQ   )fazboor   rS   rT   )r   	set_indexr)   r=   r.   )r0   r3   r=   s      r    test_assign_index_sequencesz4TestDataFrameReprInfoEtc.test_assign_index_sequences2   s    YYYYYYYYYGGHHRR#J
 
 RX!aR 5>aRr"   c                     t          dddgit          t          d          gddgg          }t          |          }d}||k    sJ d S )	NXr6   r:   20130101rP   rQ   r<   z/              X
NaT        a  1
2013-01-01 b  2)r   r
   r   r.   r0   r3   resultexpecteds       r    test_repr_with_mi_natz.TestDataFrameReprInfoEtc.test_repr_with_mi_natA   sZ    aV}c9Z3H3H-ICQT:,VWWWbF!!!!!!r"   c                     t          g ddd t          j        t          g          }t	          |          }d}||k    sJ d S )N)r6   r:   rG   r;   Tz'      0
True  1
None  2
NaN   3
NaT   4)r   r   nanr
   r.   rZ   s       r    test_repr_with_different_nullsz7TestDataFrameReprInfoEtc.test_repr_with_different_nullsG   sK    |||dD"&#%>??b
 !!!!!!r"   c           	          t           j        ddgd ddgt          ddgddd	gi}t          |
          }t	          |          }d}||k    sJ d S )Nr6   r:   rG   r;   rJ   rL   TrM   rN   )datazG   NaN  None  NaT  True
0    1     3    6     8
1    2     4    7     9)r   r_   r
   r   r.   )r0   dr3   r[   r\   s        r    #test_repr_with_different_nulls_colsz<TestDataFrameReprInfoEtc.test_repr_with_different_nulls_colsR   se    VaVTAq63Aq!fEAb !!!!!!r"   c           	          t          ddidt          j        idt          j        idt          j        iddidt          j        id          }|                    ddg          }t	          |           d S )N)AA0006000nuitrg   rf   )AAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFri   rk   )r   r   r_   rU   r.   )r0   df3idfs      r    test_multiindex_na_reprz0TestDataFrameReprInfoEtc.test_multiindex_na_repr\   sz    4jA4bf=4bf=4bf=4c:4bf= 	
 	
 mmXx011S					r"   c                     t          j        ddgg d          }t          dddgi|          }t          |                              d	          }|d
                             d          sJ d S )N)rP   r   foo)rQ   r6   barrO   r8   valuer   r6   r<   
r:   za 0 foo)r	   r>   r   r.   split
startswith)r0   r=   r3   liness       r    test_repr_name_coincidez0TestDataFrameReprInfoEtc.test_repr_name_coincidel   s    &o.ooo
 
 
 !Q(666Rt$$Qx""9-------r"   c                 z   |}|}t          |           t          |           t          |j                   t          |j                   t                      }|                    |           |                    |           |j                            |           |j                            |           d S )Nbuf)r.   Tr   	to_string)r0   /multiindex_year_month_day_dataframe_random_data multiindex_dataframe_random_dataymdframer}   s         r    test_repr_to_stringz,TestDataFrameReprInfoEtc.test_repr_to_stringv   s    
 >0US			UWSUjjC   #c"""C     r"   c                     t          t                                 t          t          j        d                    }t          |           d S )Nr   r<   )r.   r   r   arange)r0   r   s     r    test_repr_emptyz(TestDataFrameReprInfoEtc.test_repr_empty   s=    Y[[ 	$000Ur"   c                 n    t                      }t          |           |                    d|           d S )NFverboser}   )r   r.   info)r0   float_string_framer}   s      r    test_repr_mixedz(TestDataFrameReprInfoEtc.test_repr_mixed   s;    jj 	   377777r"   c                 $   t          t          j                            d          t	          j        d          dt          d                    }t          j        |j        d ddf<   t          j        |j        d ddf<   t          |           d S )N   )rf   Br<      rf   r   )
r   r   r   r?   r@   makeStringIndexr#   r_   locr.   r0   biggies     r    test_repr_mixed_bigz,TestDataFrameReprInfoEtc.test_repr_mixed_big   s     )//#&&R-?-D-DEEUSVZZ
 
 
  "v
3B38!v
3B38Vr"   c                 B   t                      }t          |           |                    d|           |                    dg                              d|           |                    ddg                              d|           t	          g d          }t          |           t	                                          |           t	          dgd	gd
g          }dt          |          vsJ dt          |          vsJ dt          |          vsJ d S )NFr   rf   columnsr   )r   r6   rG   r|   za
	bza
	dza
	fr   r=   	za
)r   r.   r   reindexr   )r0   float_framer}   no_indexr3   s        r    	test_reprz"TestDataFrameReprInfoEtc.test_repr   s3   jj 	[C000 	SE**//3/GGGS#J//44U4LLL
 YYY///X 	S!!!
|j\*NNN488####488####DHH$$$$$$r"   c                    t          ddgddgg          }t          dd          5  dt          |          v sJ 	 d d d            n# 1 swxY w Y   t          dd          5  dt          |          vsJ 	 d d d            n# 1 swxY w Y   t          dd	          5  dt          |          vsJ 	 d d d            d S # 1 swxY w Y   d S )
Nr6   r:   rG   r;   zdisplay.show_dimensionsTz2 rows x 2 columnsFtruncater   r   r.   r0   r3   s     r    test_repr_dimensionsz-TestDataFrameReprInfoEtc.test_repr_dimensions   s   AA'((5t<< 	4 	4'48833333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 5u== 	8 	8'tBxx77777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 5zBB 	8 	8'tBxx77777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8s5   AAA"BB
BC  CCc                     t          t          j        d          t          d          t          d                    }t	          |           d S )N)r   r;   r;   r   r   )r   r   zerosr#   r.   r   s     r    test_repr_bigz&TestDataFrameReprInfoEtc.test_repr_big   s=     28H--uQxxuSzzRRRVr"   c                    t          ddgdz  t          j                    dgdz  ddgdz  t          j                    t          d          z   dgdz  it	          j        d                    }t          |           t          j        dd           t          |           t          j        dd	d
d           t          |           t          j        ddd
d           t          |           t          j
                     d S )Nrs   r6   r   rt   r<   zdisplay.precisionrG   zdisplay.max_rows
   display.max_columnsr:   r   )r   r   todayr   r   r   r.   fmt
set_optionr@   reset_display_options)r0   r   
unsortables      r    test_repr_unsortablez-TestDataFrameReprInfoEtc.test_repr_unsortable   s    sRx  1#(w|  9Q<</%2	 )B--
 
 

 	Z*A...[)2/DaHHH[)41FMMM[
 """""r"   c                 b   d}t          d||gi          }t          |          }d}|                    d          d                                         |k    sJ t          d||gi          }t          |          }|                    d          d                                         |k    sJ d S )Nu   σσσσrf   z      Arv   r   )r   r.   rw   rstrip)r0   uvalr3   r[   ex_tops        r    test_repr_unicodez*TestDataFrameReprInfoEtc.test_repr_unicode   s    )dD\*++b||D!!!$++--7777dD\*++b||D!!!$++--777777r"   c                 H    t          ddgi          }t          |           d S )Nrf      א)r   strr   s     r     test_unicode_string_with_unicodez9TestDataFrameReprInfoEtc.test_unicode_string_with_unicode   s%    hZ())Br"   c                 `    t          g dg dg dd          }t          |j                   d S )NrF   rH   rK   )r   u   בrR   )r   r.   r   r   s     r    test_repr_unicode_columnsz2TestDataFrameReprInfoEtc.test_repr_unicode_columns   s;    )))yyyyyyQQRRRZr"   c                     t          ddgi          }d}t          j        t          |          5  t	          |           d d d            d S # 1 swxY w Y   d S )Nrf   abcz2^'str' object cannot be interpreted as an integer$)match)r   pytestraises	TypeErrorbytes)r0   r3   msgs      r    test_str_to_bytes_raisesz1TestDataFrameReprInfoEtc.test_str_to_bytes_raises   s    eW~&&B]9C000 	 	"III	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   AAAc                     t          t          j                            dd          t	          j        dd                    }t          |           d S )Nr   r   r   )r   r   r   r?   r@   rands_arrayr.   r   s     r    test_very_wide_info_reprz1TestDataFrameReprInfoEtc.test_very_wide_info_repr  s?    ryr2..r28N8NOOORr"   c                     t          dgdd          }t          dd          5  dt          |          v sJ 	 d d d            d S # 1 swxY w Y   d S )Nizl u  Is it possible to modify drop plot codeso that the output graph is displayed in iphone simulator, Is it possible to modify drop plot code so that the output graph is â¨displayed in iphone simulator.Now we are adding the CSV file externally. I want to Call the File through the code..)Id	StringColr   r   r   r   r   s     r    ,test_repr_column_name_unicode_truncation_bugzETestDataFrameReprInfoEtc.test_repr_column_name_unicode_truncation_bug  s    i2 
 
  1266 	+ 	+$r((*****	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   AA
A
c                    t          j        d           d}t          dd dd          5  t          g dg dg          }|                                }||k    sJ 	 d d d            n# 1 swxY w Y   |                                J d S )Njinja2z{\begin{tabular}{llll}
\toprule
 & 0 & 1 & 2 \\
\midrule
0 & $\alpha$ & b & c \\
1 & 1 & 2 & 3 \\
\bottomrule
\end{tabular}
zstyler.format.escapezstyler.render.reprlatex)z$\alpha$rQ   rR   rF   )r   importorskipr   r   _repr_latex_)r0   r\   r3   r[   s       r    test_latex_reprz(TestDataFrameReprInfoEtc.test_latex_repr  s    H%%% "D*>
 
 	& 	& 333YYY?@@B__&&FX%%%%%	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	& 	&   (((((s   2A((A,/A,c                 $   t          dddd          }t          ddd          }t          ||d	          }d
}t          |          |k    sJ t          t	          |          t	          |          d	          }t          |          |k    sJ d S )Nz2011-01-01 09:00HrI   z
US/Eastern)freqperiodstzz2011-01M)r   r   )dtpz                         dt        p
0 2011-01-01 09:00:00-05:00  2011-01
1 2011-01-01 10:00:00-05:00  2011-02
2 2011-01-01 11:00:00-05:00  2011-03
3 2011-01-01 12:00:00-05:00  2011-04
4 2011-01-01 13:00:00-05:00  2011-05)r   r   r   r.   r   )r0   r   r   r3   expdf2s         r    #test_repr_categorical_dates_periodsz<TestDataFrameReprInfoEtc.test_repr_categorical_dates_periods0  s    *aLQQQa888bq))**( Bxx3{2[^^DDEECyyCr"   argzbox, expectedz0    NaT
dtype: objectz     0
0  NaTc                 h    t           | |d          gt                              }||k    sJ d S )Nr
   dtype)r.   r,   )r0   r   boxr\   r[   s        r    test_repr_np_nat_with_objectz5TestDataFrameReprInfoEtc.test_repr_np_nat_with_objectA  sA     cc33u::,f55566!!!!!!r"   c                 f    t          dt          ddd          i          }t          |           d S )Nyearz1/1/1700r   zA-DEC)r   r   )r   r   r.   r   s     r    "test_frame_datetime64_pre1900_reprz;TestDataFrameReprInfoEtc.test_frame_datetime64_pre1900_reprK  s2    
:r P P PQRRRr"   c                     t          g dd          }t          t          j                            dd          |          }|                                 d S )N)z2011-1z2011-2z2011-3r   )r   rG   r;   r<   )r   r   r   r   r?   r   )r0   r=   r   s      r    %test_frame_to_string_with_periodindexz>TestDataFrameReprInfoEtc.test_frame_to_string_with_periodindexP  sU    :::EEE")//!Q//u=== 	r"   c           	          t          dddgit          j        t          t          dgd          g                    }|                                }d}||k    sJ d S )NrP   r6   r:   Int64r   r<   z      a
<NA>  1
1     2)r   r	   from_arraysr   r   r   rZ   s       r    "test_to_string_ea_na_in_multiindexz;TestDataFrameReprInfoEtc.test_to_string_ea_na_in_multiindexW  sr    1a&M(&"a*H*H*H)IJJ
 
 

  !!!!!!r"   c                     t          dt          ddd          i          }t          |          }|j        d d d df         }t          |          }||k    sJ d S )Nr   2019r   UTC)r   r   rI   )r   r   r.   r/   )r0   r3   r\   r[   s       r    $test_datetime64tz_slice_non_truncatez=TestDataFrameReprInfoEtc.test_datetime64tz_slice_non_truncated  sg    ZuEEEFGG88WQQQU^b!!!!!!r"   c                     t          t          ddgd          t          ddgd          d          }|                    d	j        d	j        g
          }d}||k    sJ d S )Ng_c97ݚ?g6sӭ?Float64r   r6   r:   r   )rP   rQ   z{:.2f})
formattersz)      a     b
0  0.12  1.00
1  1.12  2.00)r   r   r   formatrZ   s       r    test_masked_ea_with_formatterz6TestDataFrameReprInfoEtc.test_masked_ea_with_formatterl  s    [+6iHHHQF'222 
 
 (/8?)KLL !!!!!!r"   N)*__name__
__module____qualname__r4   rD   rV   r]   r`   rd   rq   rz   r   r   r   r   markslowr   r   r   r   r   r   r   r   r   r   r   r   r   parametrizer   
datetime64timedelta64r   r   r   r   r   r   r   r   r   r"   r    r   r      sY             " " "	" 	" 	"" " "   . . .! ! !&  8 8 8 [  % % %2	8 	8 	8 [  
# # #28 8 8        + + +*) ) )*     " [UR]BN$CDD[
+	,y:J.KL " "	  ED
"
  
  " " "" " "" " " " "r"   r   )r   r   ior   numpyr   r   pandasr   r   r   r	   r
   r   r   r   r   r   r   pandas._testing_testingr@   pandas.io.formats.formatformatsr   r   r   r   r"   r    <module>r     sL                                                    & & & & & & & & & & & &\" \" \" \" \" \" \" \" \" \"r"   