
    [6gA              
          d dl mZ d dlZd dlmZ d dlZd dlZd dlZd dl	Z	d dl
mZmZ d dlmZmZmZmZmZmZ d dlmZ e	j        d             Zd Zd Ze	j                            d	g d
          d             Zd Ze	j                            dg d          d             Zd Z e	j                            dg d          d             Z!d Z"d Z#d Z$d Z%d Z&d Z'e	j        (                    ed          d             Z)e	j        *                    e d          d             Z+e	j        (                    ed          d              Z,d! Z-d" Z.d# Z/e	j        *                    e d$          d%             Z0d& Z1e	j        j2        d'             Z3e	j                            d(g d)g d*g d+g d,g d-g d.g          d/             Z4dS )0    )StringION)ascii_uppercase)IS64PYPY)CategoricalIndex	DataFrame
MultiIndexSeries
date_rangeoption_contextc                      t          t          j                            d                              d          g d          S )z&Dataframe with duplicate column names.   )i     )ar   br   columns)r   nprandomdefault_rngstandard_normal     c/var/www/surfInsights/venv3-11/lib/python3.11/site-packages/pandas/tests/frame/methods/test_info.pyduplicate_columns_framer      sE     
	a  00;;$$$   r   c                      t                      } t                      }|                     |           |                                }t	          j        d          }||k    sJ d S )Nbufzd        <class 'pandas.core.frame.DataFrame'>
        RangeIndex: 0 entries
        Empty DataFrame
r   r   infogetvaluetextwrapdedentdfr   resultexpecteds       r   test_info_emptyr(   #   sd    	B
**CGGG\\^^F	 H Xr   c            
         d} t          dt          j                            d                              d| t
                    i          }t          t          j        t          d                    	                    t          j                            d                              dd| t
                                        
                    d	          |d	<   |                                 t                      }|                    |
           ||d	         dk             }t                      }|                    |
           d S )Ni	  int64r   d   )sizedtype
abcdefghijr   
   categoryr   d)r   r   r   r   integersintr
   arraylisttakeastypeisnar   r    )nr%   r   df2s       r   'test_info_categorical_column_smoke_testr;   2   s   A	GRY22155>>sRU>VVW	X	XB
l##$$))I!!!$$--a!3-GG	
 	
  fZ	 zN
 GGIII
**CGGG
R
^s"
#C
**CHHHr   fixture_func_name)	int_framefloat_framedatetime_framer   float_string_framec                 8   |                     |           }t                      }|                    |           |                                                                }t          |          dk    sJ t                      }|                    |d           d S )Nr   r/   Fr   verbose)getfixturevaluer   r    r!   
splitlineslen)r<   requestframer   r&   s        r   test_info_smoke_testrI   C   s     ##$566E
**C	JJ3J\\^^&&((Fv;;
**C	JJ3J&&&&&r   c                    t                      }|                     dg                              d|           |                     ddg                              d|           t                                          |           d S )NAr   FrC   r   Br   )r   reindexr    r   )r>   r   s     r   test_info_smoke_test2rO   X   s    
**C&&++Es+CCCc
++00C0HHH KKr   z&num_columns, max_info_columns, verbose))r/   r+   T)r/      T)r/   r/   T)r/   	   F)r/      Fc                    t          t          j                            d                              d| f                    }t          d|          5  t                      }|                    |           |                                }t                      }|                    ||           |                                }||k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nr      display.max_info_columnsr   rB   )	r   r   r   r   r   r   r   r    r!   )num_columnsmax_info_columnsrC   rH   
io_defaultr&   io_explicitr'   s           r   #test_info_default_verbose_selectionrZ   b   s    bi++A..>>;?OPPQQE	24D	E	E 	" 	"ZZ


z
"""$$&&jj

{G
444''))!!!!!	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"s   A:CC!Cc                  L   t                      } d}d}t          t          j                            d                              d|f                    }|                    d|            |                                 }d}||v sJ |                    d|            |                     d           | 	                                }t          |          dk    sJ t          |          D ]8\  }}||cxk    r	||z   k     r#n d	||z
   d	}	|                    |	          sJ 9d S )
N  rT   r      TrL   z- #     Column  Dtype  
---    ------  -----  r    )r   r   r   r   r   r   r    r!   seek	readlinesrF   	enumerate
startswith)
r   r,   startrH   resheaderlinesilineline_nrs
             r   -test_info_verbose_check_header_separator_bodyrj   z   s6   
**CDEbi++A..>>4yIIJJE	JJtJ%%%
,,..C=FS====	JJtJ%%%HHQKKKMMOOEu::>>>>U## , ,4A$$$$$$$$$&!e)&&&G??7+++++, ,r   z>size, header_exp, separator_exp, first_line_exp, last_line_exp))r   $ #   Column  Non-Null Count  Dtype  $---  ------  --------------  -----  $ 0   0       3 non-null      float64z$ 3   3       3 non-null      float64)rP   rk   rl   rm   z$ 10  10      3 non-null      float64)e   z% #    Column  Non-Null Count  Dtype  z%---   ------  --------------  -----  z% 0    0       3 non-null      float64z% 100  100     3 non-null      float64)r\   z& #     Column  Non-Null Count  Dtype  z&---    ------  --------------  -----  z& 0     0       3 non-null      float64z& 1000  1000    3 non-null      float64)i'  z' #      Column  Non-Null Count  Dtype  z'---     ------  --------------  -----  z' 0      0       3 non-null      float64z' 10000  10000   3 non-null      float64c                    t          t          j                            d                              d| f                    }t                      5 }|                    dd|           |                                                                }ddd           n# 1 swxY w Y   |dd         }|^}	}
}}}|	|k    sJ |
|k    sJ ||k    sJ ||k    sJ dS )zETest header column, spacer, first line and last line in verbose mode.r   r]   T)rC   show_countsr   N)	r   r   r   r   r   r   r    r!   rE   )r,   
header_expseparator_expfirst_line_explast_line_exprH   r   	all_linestablere   	separator
first_linerest	last_lines                 r   %test_info_verbose_with_counts_spacingr|      s*   X bi++A..>>4yIIJJE	 0s

4Ts
;;;LLNN--//	0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 adOE6;3FIzD)Z%%%%''''%%%%%%s   ?BB"Bc                  `   t          dt          ddgd          i          } t                      }|                     |           |                                }t          |                                                                           }t          j	        d| d          }||k    sJ d S )	Nr   rR   r   i8)r-   r   a      <class 'pandas.core.frame.DataFrame'>
    RangeIndex: 2 entries, 0 to 1
    Data columns (total 1 columns):
     #   Column  Non-Null Count  Dtype
    ---  ------  --------------  -----
     0   a       2 non-null      int64
    dtypes: int64(1)
    memory usage: z bytes
    )
r   r
   r   r    r!   floatmemory_usagesumr"   r#   )r%   r   r&   bytesr'   s        r   test_info_memoryr      s    	CAd3334	5	5B
**CGGG\\^^F"//##''))**E		 		 		 		 H Xr   c                  d   t                      } t          t          j                            d                              d                    }|                    |            t                      } |                    | d           |                                 }t          |	                                          dk    sJ |}t          dd          5  t                      } |                    |            |                                 }||k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nr   )rT   rn   r   rn   r   max_colsr+   rU   )r   r   r   r   r   r   r    r!   rF   rE   r   )ior%   r&   r'   s       r   test_info_wider      sM   	B	29((++;;HEE	F	FBGGGOOO	BGGSG!!![[]]Fv  ""##c))))H	2C	8	8 " "ZZ
B!!!!!	" " " " " " " " " " " " " " " " " "s   AD%%D),D)c                      t                      } t          ddggddg          }|                    |            |                                                     d          }d|d         k    sJ d	|d
         k    sJ d S )NrR   g       @r   r   r   Tz% 0   a       1 non-null      int64  
rT   z% 1   a       1 non-null      float64
   )r   r   r    r!   rE   )r   rH   rf   s      r   0test_info_duplicate_columns_shows_correct_dtypesr      s    	B3xj3*555E	JJ2JKKMM$$T**E3uQx????3uQx??????r   c            	         g d} i }d}t          |           D ]O\  }}t          j                            d                              d|                              |          ||<   Pt          |          }t                      }|                    |           |	                                }d}||v sJ t          |           D ]\  }}d|dd	|dd
|dd| }	|	|v sJ d S )Nr*   float64zdatetime64[ns]ztimedelta64[ns]
complex128objectboolr/   r   r,   r   zY #   Column  Non-Null Count  Dtype          
---  ------  --------------  -----          r^   r1   z   z       z non-null     )
ra   r   r   r   r2   r7   r   r   r    r!   )
dtypesdatar9   rg   r-   r%   r   rd   re   names
             r   test_info_shows_column_dtypesr      s(     F D
Af%% M M5)''**33AA3>>EEeLLQ	4B
**CGGG
,,..C	7  S====f%%  5A1AAA1AAAqAAA%AAs{{{{{ r   c                     t          t          j                            d                              d                    } dD ]\  }}t          dd          5  t                      }|                     ||           |                                }t          |
                                                    d                    |k    sJ 	 d d d            n# 1 swxY w Y   dD ]\  }}t          dd	          5  t                      }|                     ||           |                                }t          |
                                                    d                    |k    sJ 	 d d d            n# 1 swxY w Y   d
D ]>\  }}t          dd          5  t                      }|                     ||           |                                }t          |
                                                    d                    |k    sJ 	 d d d            n# 1 swxY w Y   t          dd	          5  t                      }|                     ||           |                                }t          |
                                                    d                    |k    sJ 	 d d d            n# 1 swxY w Y   @d S )Nr   )r/   rT   ))rT   NrT   F   TrW   r   rB   
))r   Nr   r   rT   ))r   rT   )rT   r   r   )r   r   r   r   r   r   r   r    r!   rF   stripsplit)r%   len_rC   r   rd   r   s         r   test_info_max_colsr     s   	29((++;;GDD	E	EB< 8 8g.22 	8 	8**CGGWG---,,..Csyy{{((..//477777		8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 > 8 8g.22 	8 	8**CGGWG---,,..Csyy{{((..//477777		8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 , 8 8h.22 	8 	8**CGGhG///,,..Csyy{{((..//477777		8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 .22 	8 	8**CGGhG///,,..Csyy{{((..//477777		8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	88 8sL   A4CC	C	;A4E<<F 	F 	 A4H!!H%	(H%	<A4J==K	K	c            	      	   g d} i }d}t          |           D ]O\  }}t          j                            d                              d|                              |          ||<   Pt          |          }t                      }|                    |d           |	                                
                                }d|d         v sJ |                    |d	           |	                                
                                }d|d         vsJ |                    |d           |	                                
                                }t          j        d
|d                   sJ |j        d d d df                             |d           |	                                
                                }t          j        d
|d                   rJ g d} i }d}t          |           D ]O\  }}t          j                            d                              d|                              |          ||<   Pt          |          }| |_        t          ddgidg          }|                    |d           |	                                
                                }t          j        d
|d                   sJ |                    |d           |	                                
                                }t          j        d|d                   sJ |                                                                }	t#          |           |z  dz  |j        j        z   }
|	|
k    sJ t          j        |j        j                  dz   }|t          j        |                                          k    sJ |                                                                |                    d                                          k    sJ t          ddgdg                              d           t          ddgdg          j        j         t          dt-          j        dgt1          d          g          dg          }|j        j         |                    d           |j        j        j         |                    d                                          }|dk    sJ d S )Nr   r/   r   r   T)r   r   zmemory usage: Fzmemory usage: [^+]+\+rT   )r*   r*   r*   r   r+   r   rR   fooindexdeepzmemory usage: [^+]+$   r   rK   r   r     r   r   r   r   )ra   r   r   r   r2   r7   r   r   r    r!   rE   rematchilocr   r   r   rF   r   nbytesr,   valuesr	   from_productrange)r   r   r9   rg   r-   r%   r   rd   df_with_object_indexdf_sizeexp_sizesize_dfmems                r   test_info_memory_usager   :  s     F D
Af%% M M5)''**33AA3>>EEeLLQ	4B
**C GG$G'''
,,..
#
#
%
%Cs2w&&&& GG%G(((
,,..
#
#
%
%C3r7****GG$G'''
,,..
#
#
%
%C 8,c"g66666GAAArrENCd333
,,..
#
#
%
%C x0#b'::::: 433FDAf%% M M5)''**33AA3>>EEeLLQ	4BBJ$cA3Zw???#D999
,,..
#
#
%
%C8,c"g66666#F;;;
,,..
#
#
%
%C8+SW55555 oo##%%G6{{Q"RX_4Hh gbj'((1,Gbgboo//000000 ??  ""boo4o&@&@&D&D&F&FFFFF ause,,,999EEEause,,,299	j-ueDkk.BCCcU
 
 
B HOOOO$OHO
//t/
$
$
(
(
*
*C777777r   z'on PyPy deep=True doesn't change result)reasonc                     t          ddgidg          } |                     dd                                          |                     d                                          k    sJ t          ddgi          }|                    d                                          |                                                                k    sJ d S Nr   rR   r   r   T)r   r   r   r   r   r   r   	df_objects     r   $test_info_memory_usage_deep_not_pypyr     s    $cA3Zw???))4)@@DDFF

+
+$
+
7
7
;
;
=
=	> 	> 	> 	> 3,''I!!t!,,0022Y5K5K5M5M5Q5Q5S5SSSSSSSr   z(on PyPy deep=True does not change resultc                     t          ddgidg          } |                     dd                                          |                     d                                          k    sJ t          ddgi          }|                    d                                          |                                                                k    sJ d S r   r   r   s     r    test_info_memory_usage_deep_pypyr     s    $cA3Zw???))4)@@DDFF,,4,88<<>>	? 	? 	? 	? 3,''I!!t!,,0022i6L6L6N6N6R6R6T6TTTTTTTr   z PyPy getsizeof() fails by designc            	         t          dt          j        dgt          d          g          dg          } |                     d                                          }|t          j        |           z
  }t          |          dk     sJ d S )	NrR   r   r   rK   r   Tr   r+   )	r   r	   r   r   r   r   sys	getsizeofabs)r%   r   diffs      r   test_usage_via_getsizeofr     s    	j-ueDkk.BCCcU
 
 
B //t/
$
$
(
(
*
*C r"""Dt99s??????r   c            
         t                      } t          dt          d          g d          }|                    |            d|                                 vsJ t                      } t          dt          d          t          d                    }|                    |            d|                                 v sJ t                      } t          dt          d          t          j        t          d          t          d          g                    }|                    |            d|                                 vsJ t                      } t          dt          d          t          j        t          d          d	d
gg                    }|                    |            d|                                 v sJ d S )NrR   ab)rR   r   r]   r   r   r   +ABCr]   r   bar)r   r   r5   r    r!   r	   r   r   )r   r%   s     r    test_info_memory_usage_qualifiedr     s   
**C	1d4jj				:	:	:BGGGcllnn$$$$
**C	1d4jjU	<	<	<BGGG#,,..    
**C		4::Z%<eAhha=Q%R%R
 
 
B GGGcllnn$$$$
**C		4::Z%<eAhhPU=W%X%X
 
 
B GGG#,,..      r   c                  
   d } d}t          t                    }t          j        t	          t                    t          d|          gddg          }t          dt          j        	                    d	          
                    ||z            i|
          }|                    d          }|j        j        |j        j        k    sJ  | |           | |          k    sJ  | |           | |          z
  dk     sJ d S )Nc                 R    |                      d                                          S )NTr   )r   r   )fs    r   r   z>test_info_memory_usage_bug_on_multiindex.<locals>.memory_usage  s"    ~~4~((,,...r   r+   20160101)periodsiddate)namesvaluer   r   i  )rF   r   r	   r   r5   r   r   r   r   r   r   unstackr   r   )r   NMr   r%   	unstackeds         r   (test_info_memory_usage_bug_on_multiindexr     s(   / / / 	AOA#	o		
:q A A ABVn  E 
	")''**::1q5AAB%
 
 
B 

4  I9y/66666<ll9555555 <	""\\"%5%55<<<<<<r   c                      t          ddg          } t          t          j        d          | |           }t	                      }|                    |           d S )Nr   r   )r   r   r   r   )r   r   r   zerosr   r    )idxr%   r   s      r   test_info_categoricalr     sT    
C:
&
&C	28F##3	<	<	<B
**CGGGr   zGH 36579: fail on 32-bit systemc                      t          ddgddgdddg          } t                      }|                     d|	           |                                }t	          j        d
          }||k    sJ d S )NrR   r   r]   )rR   r   rK   rM   r   T)rp   r   af          <class 'pandas.core.frame.DataFrame'>
        Index: 2 entries, A to B
        Data columns (total 2 columns):
         #   Column  Non-Null Count  Dtype
        ---  ------  --------------  -----
         0   1       2 non-null      int64
         1   2       2 non-null      int64
        dtypes: int64(2)
        memory usage: 48.0+ bytes
        r   r$   s       r   test_info_int_columnsr     s     
1v1a&))#s	<	<	<B
**CGG#G&&&\\^^F
	 H Xr   c                  
   t          ddg          } t          j        d           5  |                                 }d d d            n# 1 swxY w Y   t	          t
          rdnddg          }t          j        ||           d S )Nr   r   r      r   Index)r   tmassert_produces_warningr   r
   r   assert_series_equal)r%   r&   r'   s      r   "test_memory_usage_empty_no_warningr     s    	#s	$	$	$B		#D	)	) # #""# # # # # # # # # # # # # # #D'bbay999H68,,,,,s   AAAc                     t          j        d           t          ddgddgg          } t          dd          5  t	                      }|                     |           |                                }d d d            n# 1 swxY w Y   t	                      }|                     |           |                                }||k    sJ d S )	NnumbarR   r   r]   r   zcompute.use_numbaTr   )pytestimportorskipr   r   r   r    r!   r$   s       r   test_info_compute_numbar     s       	QFQF#	$	$B	+T	2	2    jj
C                             
 **CGGG||~~HXs   9A??BBz!row, columns, show_counts, result)   r   NT)r   r   TT)r   r   FF)rT   rT   NF)rT   rT   TF)rT   rT   FFc                    t          dt          d          t          d                                        ddi          }t          j        |j        d<   t          d| d|          5  t                      5 }|                    ||           d	|	                                v |u sJ 	 d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )
NrR   r/   r   r   )rR   rR   zdisplay.max_info_rowsrU   )r   rp   znon-null)
r   r   r7   r   nanr   r   r   r    r!   )rowr   rp   r&   r%   r   s         r   test_info_show_countsr      sV    
1eBiiuRyy	9	9	9	@	@!W	N	NBFBGDM	&@'
 
 < < ZZ 	<3GGG555#,,..0V;;;;;	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	< 	<< < < < < < < < < < < < < < < < < <s6   (C72B6*C6B:	:C=B:	>CCC)5r   r   r   stringr   r   r"   numpyr   r   pandas.compatr   r   pandasr   r   r	   r
   r   r   pandas._testing_testingr   fixturer   r(   r;   markparametrizerI   rO   rZ   rj   r|   r   r   r   r   r   r   skipifr   xfailr   r   r   r   r   r   r   
single_cpur   r   r   r   r   <module>r      s         				 " " " " " " 



             
                            "   	 	' '	 	'   ,  	 	" "	 	", , ,, D$ $ $' 'P& &Q' 'P&$  ," " "$@ @ @  88 8 8DR R Rj D!JKKT T LKT t8$NOOU U POU D!CDD  ED! ! !4= = =2   t8$EFF  GF,- - -     '
 

< 
<
 

< 
< 
<r   