+
    xȇi=Q                        R t ^ RIHt ^ RIHt ^ RIt^ RIt^ RIH	t	 ^ RI
HtHtHt ^ RIHt ]P"                  P%                  R4      t]P"                  P)                  R4      t]P"                  P)                  R4      t]R	 4       tR
 t]P"                  P3                  R. ROORP^ ..4      R 4       t]P"                  P3                  RRR.4      R 4       t]R 4       tR t]R 4       t]P"                  P3                  RRRR./R3R^ ^.RRR./R3R^ ^.RRR./R3.4      R 4       t]! RRR.4      t ]]P"                  P3                  R R^ ^./R!^R. RQO/R!^R] ! R"R#4      ] ! R"R$4      ] ! R"R%4      ] ! R&R'4      ] ! R(R)4      ] ! R(R*4      ./.4      R+ 4       4       t!]]P"                  P3                  R R^ ^./R!^R. RQO/R!^R] ! R"R#4      ] ! R"R$4      ] ! R"R%4      ] ! R&R'4      ] ! R(R)4      ] ! R(R*4      ./.4      R, 4       4       t"]]P"                  P3                  R R^ ^./R!^R. RQO/R!^R] ! R"R#4      ] ! R"R$4      ] ! R"R%4      ] ! R&R'4      ] ! R(R)4      ] ! R(R*4      ./.4      R- 4       4       t#]R. 4       t$]R/ 4       t%]R0 4       t&]R1 4       t']P"                  P3                  R2RRRS.4      R3 4       t(]]P"                  P3                  R / RR/.4      R4 4       4       t)]P"                  P3                  R5/ . RTO3R. RUO/. RUO3.4      R6 4       t*]P"                  P3                  RR"R&.R7.4      R8 4       t+]R9 4       t,]]P"                  P3                  R:R;]! . RVO.]PZ                  ! . RWO4      R<7      3R=]! . RVO.]PZ                  ! . RXO4      R<7      3R>]! . RYO.]PZ                  ! . RZO4      R<7      3.4      R? 4       4       t.]]P"                  P3                  RR^ ..4      ]P"                  P3                  R@RRARB.RBRA.RBRC..4      RD 4       4       4       t/]RE 4       t0]RF 4       t1]RG 4       t2]RH 4       t3]RI 4       t4RJ t5]RK 4       t6]RL 4       t7]RM 4       t8RN t9R# )[zx
Tests that the file header is properly handled or inferred
during parsing for all of the parsers defined in parsers.py
)
namedtuple)StringION)ParserError)	DataFrameIndex
MultiIndexz=ignore:Passing a BlockManager to DataFrame:DeprecationWarningpyarrow_xfailpyarrow_skipc                     T pR p\         P                  ! \        VR7      ;_uu_ 4        VP                  \	        R4      ^
.R7       RRR4       R#   + '       g   i     R# ; i)zbut only \d+ lines in filematchz,,headerNpytestraises
ValueErrorread_csvr   )all_parsersparsermsgs   &  r/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/tests/io/parser/test_header.pytest_read_with_bad_headerr      sB    F
'C	z	-	-t4 
.	-	-	-s   AA"	c                     T pR p\         P                  ! \        RR7      ;_uu_ 4        VP                  \	        V4      RR7       RRR4       R#   + '       g   i     R# ; i)$1,2,3,4,5
6,7,8,9,10
11,12,13,14,15
zUPassing negative integer to header is invalid. For no header, use header=None insteadr   r   Nr   r   r   datas   &  r   test_negative_headerr   &   sT    FD 
1
 

 	r2
 
 
 
   AA!	r   c                     T pR p\         P                  ! \        RR7      ;_uu_ 4        VP                  \	        V4      VR7       RRR4       R#   + '       g   i     R# ; i)z<1,2,3,4,5
        6,7,8,9,10
        11,12,13,14,15
        z8cannot specify multi-index header with negative integersr   r   Nr   )r   r   r   r   s   &&  r    test_negative_multi_index_headerr!   5   sT     FD 
T
 
 	v6
 
 
 
r   TFc                     T pR pRp\         P                  ! \        VR7      ;_uu_ 4        VP                  \	        V4      VR7       RRR4       R#   + '       g   i     R# ; i)zMyColumn
a
b
a
bz#Passing a bool to header is invalidr   r   N)r   r   	TypeErrorr   r   )r   r   r   r   r   s   &&   r   test_bool_header_argr$   C   sK     FD 0C	y	,	,v6 
-	,	,	,   AA#	c                     T pR p. ROpVP                  \        V4      VR7      p\        . RO. RO. RO.. RO. ROR7      p\        P                  ! WE4       R# )	zfoo,1,2,3
bar,4,5,6
baz,7,8,9
namesindexcolumnsNABC         )         )      	   )foobarbazr   r   r   tmassert_frame_equal)r   r   r   r(   resultexpecteds   &     r   test_header_with_index_colrB   R   sU    FD E__Xd^5_9F	Iy)#H
 &+    c                     T pR pRpVP                  \        V4      ^^ R7      pVP                  \        V4      ^ ^ R7      p\        P                  ! WE4       R# )zggot,to,ignore,this,line
got,to,ignore,this,line
index,A,B,C,D
foo,2,3,4,5
bar,7,8,9,10
baz,12,13,14,15
z7index,A,B,C,D
foo,2,3,4,5
bar,7,8,9,10
baz,12,13,14,15
r   	index_colNr   r   r>   r?   )r   r   r   data2r@   rA   s   &     r   test_header_not_first_linerI   d   sU    FDE __Xd^A_CFxqAFH&+rC   c                 &   T pR pVP                  \        V4      . RO^ ^.R7      pR p\        ^4       UUu. uF#  p\        ^4       Uu. uF
  qd! WV4      NK  	  upNK%  	  ppp\        P                  ! \        ^4       Uu. uF  pRV 2NK
  	  up\        ^4       Uu. uF  pRV 2NK
  	  up.RR.R7      p\        P                  ! \        ^4       Uu. uF  pRV 2NK
  	  up\        ^4       Uu. uF  pR	V 2NK
  	  up\        ^4       Uu. uF  pR
V 2NK
  	  up\        ^4       Uu. uF  pRV 2NK
  	  up.. ROR7      p	\        W)VR7      p
\        P                  ! W:4       R# u upi u uppi u upi u upi u upi u upi u upi u upi )  C0,,C_l0_g0,C_l0_g1,C_l0_g2

C1,,C_l1_g0,C_l1_g1,C_l1_g2
C2,,C_l2_g0,C_l2_g1,C_l2_g2
C3,,C_l3_g0,C_l3_g1,C_l3_g2
R0,R1,,,
R_l0_g0,R_l1_g0,R0C0,R0C1,R0C2
R_l0_g1,R_l1_g1,R1C0,R1C1,R1C2
R_l0_g2,R_l1_g2,R2C0,R2C1,R2C2
R_l0_g3,R_l1_g3,R3C0,R3C1,R3C2
R_l0_g4,R_l1_g4,R4C0,R4C1,R4C2
rE   c                     R V  RV 2# )Rr/    )rcs   &&r   <lambda>)test_header_multi_index.<locals>.<lambda>   s    !AaSkrC   R_l0_gR_l1_gR0R1r'   C_l0_gC_l1_gC_l2_gC_l3_g)r+   r*   N    r1   r2   r3   )C0C1C2C3)r   r   ranger   from_arraysr   r>   r?   )r   r   r   r@   
data_gen_frO   rP   ir*   r+   rA   s   &          r   test_header_multi_indexre   x   sw   FD __Xd^LQPQF_SF)J:?(C(QuQx0x!Zx0(DC"" %a	)1F1#,	)%(+K(QfQCL(+KLTlE $$#(8,8avaS\8,#(8,8avaS\8,#(8,8avaS\8,#(8,8avaS\8,		
 'G e<H&+ 1C	)+K
 -,,,s;   E/	E*E/ E5E:
E?1F
F	+F*E/z
kwargs,msgrF   r:   r;   z]index_col must only contain integers of column positions when specifying a multi-index headerr(   z9cannot specify names when specifying a multi-index headerusecolsz;cannot specify usecols when specifying a multi-index headerc                     R pT p\         P                  ! \        VR7      ;_uu_ 4        VP                  ! \	        V4      3R. RO/VB  RRR4       R#   + '       g   i     R# ; i)rK   r   r   Nr[   r   )r   kwargsr   r   r   s   &&&  r   test_header_multi_index_invalidri      sJ    ,D F	z	-	-F|FvF 
.	-	-	-s   !AA%	
_TestTuplefirstsecondrh   skiprowsaqrO   sbtrP   uvc                     T p\        . RO. RO.RR.\        P                  ! . R	O4      R7      pRpVP                  ! \	        V4      3R^ /VB p\
        P                  ! WS4       R# )
r1   onetwor)   zC,a,a,a,b,c,c
,q,r,s,t,u,v
,,,,,,
one,1,2,3,4,5,6
two,7,8,9,10,11,12rF   Nr1   r2   r3   r4   r5   r6   r7   r8   r9   
         )rn   ro   )rn   rO   )rn   rp   )rq   rr   )rP   rs   )rP   rt   r   r   from_tuplesr   r   r>   r?   r   rh   r   rA   r   r@   s   &&    r   &test_header_multi_index_common_format1r      sg    < F	23en&&T
HD __Xd^CqCFCF&+rC   c                     T p\        . RO. RO.RR.\        P                  ! . R	O4      R7      pRpVP                  ! \	        V4      3R^ /VB p\
        P                  ! WS4       R# )
r1   rv   rw   r)   z<,a,a,a,b,c,c
,q,r,s,t,u,v
one,1,2,3,4,5,6
two,7,8,9,10,11,12rF   Nrx   ry   r}   r~   r   s   &&    r   &test_header_multi_index_common_format2r      sg    < F	23en&&T
HD
 __Xd^CqCFCF&+rC   c                     T p\        . R	O. R
O.RR.\        P                  ! . RO4      R7      pVP                  RR7      pRpVP                  ! \        V4      3RR/VB p\        P                  ! WS4       R# )r1   rv   rw   r)   T)drop2a,a,a,b,c,c
q,r,s,t,u,v
1,2,3,4,5,6
7,8,9,10,11,12rF   Nrx   ry   r}   )r   r   r   reset_indexr   r   r>   r?   r   s   &&    r   &test_header_multi_index_common_format3r   )  s|    < F	23en&&T
H ###.HD
 __Xd^FtFvFF&+rC   c           
         T p\        \        P                  ! . R
O. RO.RR7      \        ^^.4      \	        . RO. RO.. RO. RO.RR.R7      R7      pRpVP                  \        V4      ^ ^.^ R7      p\        P                  ! W$4       R	# )r2   int64dtypern   ro   levelscodesr(   r)   r   rE   Nr2   r3   r4   r5   r6   r8   r9   rz   r{   r|   rn   rq   rP   rO   rp   rr   rs   rt   r\   r\   r1   r2   r2   r\   r1   r2   r3   r4   )	r   nparrayr   r   r   r   r>   r?   r   r   rA   r   r@   s   &    r   0test_header_multi_index_common_format_malformed1r   Y  s    F
/#56gFQFm#%>?"O4*
HD
 __Xd^QFa_HF(+rC   c           
         T p\        \        P                  ! . R	O. R
O.RR7      \        ^^^4      \	        . RO. RO.. RO. RO.RR.R7      R7      pRpVP                  \        V4      ^ ^.^ R7      p\        P                  ! W$4       R# )r2   r   r   Nro   r   r)   1,a,a,b,c,c
q,r,s,t,u,v
1,2,3,4,5,6
7,8,9,10,11,12rE   r   r   r   r   r   r   )	r   r   r   ra   r   r   r   r>   r?   r   s   &    r   0test_header_multi_index_common_format_malformed2r   n  s    F
/#56gFAr1o#%>?"O4+
HD
 __Xd^QFa_HF(+rC   c           
      2   T p\        \        P                  ! . R
O. RO.RR7      \        ^^.^^..^ ^.^ ^..R7      \        . RO. RO.. RO. RO.RR.R7      R7      pRpVP	                  \        V4      ^ ^.^ ^.R	7      p\        P                  ! W$4       R# )r3   r   r   )r   r   Nro   r   r)   r   rE   )r3   r4   r5   r6   )r9   rz   r{   r|   r   )rp   rr   rs   rt   )r\   r1   r2   r2   r[   )r   r   r   r   r   r   r>   r?   r   s   &    r   0test_header_multi_index_common_format_malformed3r     s    F
,0@!Q!Q 0!Q!Q8HI#%9:.+
HD
 __Xd^QFq!f_MF(+rC   c                     T pR R .^^.^^..p\         P                  ! RR.4      p\        W#R7      pRpVP                  \	        V4      ^ ^.R7      p\
        P                  ! WE4       R # )Nr+   za,b
A,B
,
1,2
3,4r   )rn   r-   )rq   r.   )r   r   r   r   r   r>   r?   )r   r   r   r+   rA   r@   s   &     r   "test_header_multi_index_blank_liner     sm     F4L1a&1a&)D$$j*%=>G/H"D__Xd^QF_;F(+rC   zdata,headerc                 <   T pVP                   R 8X  d6   Ve2   \        P                  P                  RR7      pVP	                  V4       VP                  \        R4      . ROR7      pVP                  \        V4      . ROVR7      p\        P                  ! Wv4       R# )pyarrowNzDataFrame.columns are different)reason1,2,3
4,5,6r'   r(   r   r   )	enginer   markxfailapplymarkerr   r   r>   r?   )r   r   r   requestr   r   rA   r@   s   &&&&    r   !test_header_names_backward_compatr     s}    
 F}}	!f&8{{  (I JD!x7OH__Xd^?6_RF&+rC   c                     T p\        . ROR7      pVP                  ! \        R4      3/ VB p\        P                  ! WC4       R# )rn   r   za,b,cNr   r   r   r   r>   r?   )r   rh   r   rA   r@   s   &&   r   test_read_only_header_no_rowsr     s9     F1H__Xg.9&9F&+rC   zkwargs,namesc                     T pR p\        . RO. RO. RO.VR7      pVP                  ! \        V4      3RR/VB p\        P                  ! We4       R# )r   r   r   N)r1   r2   r3   r4   r5   )r6   r7   r8   r9   rz   )r{   r|            r   )r   rh   r(   r   r   rA   r@   s   &&&    r   test_no_headerr     sV     FD 	*,@A5H __Xd^CDCFCF&+rC   string_headerc                     R pRpT p\         P                  ! \        VR7      ;_uu_ 4        VP                  \	        V4      VR7       RRR4       R#   + '       g   i     R# ; i)z*header must be integer or list of integersz1,2
3,4r   r   Nr   )r   r   r   r   r   s   &&   r   test_non_int_headerr     sG     7CDF	z	-	-v6 
.	-	-	-r%   c           	          R pT p\        R^ ^.R^^.R^^./4      pVP                  \        V4      ^ .R7      p\        P                  ! WC4       R# )za,b,c
0,1,2
1,2,3rn   rq   rP   r   Nr   )r   r   r   rA   r@   s   &    r   test_singleton_headerr     sW     %DF#1vsQFC!Q@AH__Xd^QC_8F&+rC   zdata,expectedz#A,A,A,B
one,one,one,two
0,40,34,0.1r   z%A,A,A,B
one,one,one.1,two
0,40,34,0.1z/A,A,A,B,B
one,one,one.1,two,two
0,40,34,0.1,0.1c                 r    T pVP                  \        V4      ^ ^.R7      p\        P                  ! WB4       R# )r\   r   NrG   )r   r   rA   r   r@   s   &&&  r   test_mangles_multi_indexr     s2    R F__Xd^QF_;F&+rC   r+    Unnamed
NotUnnamedc                    T p^ ^.pVf&   RP                  T;'       g    RR.4      R,           pM,RP                  R.T;'       g    RR.,           4      R,           pVP                  \        V4      WAR7      p. pVf   . ROp\        V4       F1  w  rV	'       g   RVf   TMV^,            R2p	VP	                  V	4       K3  	  \
        P                  ! \        VR	R
.4      4      p\        ^^.^^..VR7      p
\        P                  ! Wj4       R# )r\   N,r   z
0,1
2,3
4,5
z
,0,1
0,2,3
1,4,5
rE   z	Unnamed: _level_001r   )r   r   r   )joinr   r   	enumerateappendr   r   zipr   r>   r?   )r   rF   r+   r   r   r   r@   exp_columnsrd   colrA   s   &&&        r   test_multi_index_unnamedr     s    FVFxx++B8,/BBxx 3 3B8458PP__Xd^F_PFKG$9#4a!a%@IC3	 % $$SsCj%ABG1a&1a&)7;H&+rC   c           	          T pR pVP                  \        V4      ^ . ROR7      p\        R^^.R^^.R^^./4      p\        P                  ! W44       R# )za, b
1,2,3
5,6,4
r-   r.   r/   )r   r(   Nr,   r=   r   r   r   r@   rA   s   &    r   6test_names_longer_than_header_but_equal_with_data_rowsr   D  s[     FD __Xd^A__MF#1vsQFC!Q@AH&+rC   c                 Z   T pR pRp\         P                  ! . RO4      p\        . RO. RO.VR7      pVP                  \	        V4      ^ ^.R7      p\
        P                  ! WeP                  R,          4       VP                  \	        V4      ^ ^.R7      p\
        P                  ! Wu4       R# )	zFMale, Male, Male, Female, Female
R, R, L, R, R
.86, .67, .88, .78, .81z^Male, Male, Male, Female, Female
R, R, L, R, R
.86, .67, .88, .78, .81
.86, .67, .88, .78, .82r   r   :Nr1   NN))MalerM   ) Male R)r   z L) Femaler   )r   z R.1)Q?q=
ףp?)\(?(\?gQ?)r   r   r   r   g=
ףp=?)r   r   r   r   r   r>   r?   iloc)r   r   s1s2mirA   df1df2s   &       r    test_read_csv_multiindex_columnsr   Q  s     F	SB	"  
			

B 	')GHRTH //(2,1v/
6C#}}R01
//(2,1v/
6C#(rC   c                     T pR p\         P                  ! \        RR7      ;_uu_ 4        VP                  \	        V4      ^ ^.R7       RRR4       R#   + '       g   i     R# ; i)z1row11,row12,row13
row21,row22, row23
row31,row32
z1Header rows must have an equal number of columns.r   r   Nr   r   r   r   r   )r   r   cases   &  r   'test_read_csv_multi_header_length_checkr   q  sX     FD
 
N
 
 	1v6
 
 
 
s   AA#	c                     T pR pVP                  \        V4      RR.RR7      p\        R. ROR^\        P                  \        P                  ./. ROR7      p\
        P                  ! W44       R# )zx,1,5
y,2
z,3
rn   rq   Nr   )r*   r0   )xyz)r   r   r   r   nanr>   r?   r   s   &    r   #test_header_none_and_implicit_indexr     sa     FD__Xd^C:d_KF	iq"&&"&&12/H &+rC   c                     T pR p\         P                  ! \        RR7      ;_uu_ 4        VP                  \	        V4      RR.RR7       RRR4       R#   + '       g   i     R# ; i)x,1
y,2,5
z,3
z"Expected 2 fields in line 2, saw 3r   rn   rq   Nr   r   r   s   &  r   1test_header_none_and_implicit_index_in_second_rowr     sJ     FD	{*N	O	OsCjF 
P	O	O	Os    AA$	c                     T pR pVP                  \        V4      RR.RRR7      p\        RRR.R^^./4      p\        P                  ! W44       R# )r   rn   rq   Nskip)r(   r   on_bad_linesr   r   r=   r   s   &    r   &test_header_none_and_on_bad_lines_skipr     s[    FD__sCjF  F #Sz3A78H&+rC   c                     T pR pRp\         P                  ! \        VR7      ;_uu_ 4        VP                  \	        V4      . ROR7       RRR4       R#   + '       g   i     R# ; i)za,b
1,2
z;Passed header=\[0,1,2\], len of 3, but only 2 lines in filer   r   N)r\   r1   r2   r   )r   r   r   r   s   &   r   test_header_missing_rowsr     sL     FD IC	z	-	-y9 
.	-	-	-s   AA%	c                     T pR pVP                  \        V4      RR7      p\        R^ .R^RR/4      p\        P                  ! W44       R# )z1aa    bb(1,1)   cc(1,1)
                0  2  3.5\s+sepaazbb(1,1)zcc(1,1)g      @Nr=   r   s   &    r    test_header_multiple_whitespacesr     sO     FD __Xd^_8F$Y9cBCH&+rC   c                     T pR pVP                  \        V4      RR7      p\        RRR./4      p\        P                  ! W44       R# )za,b
1,2
3,4
    r   r   za,bz1,2z3,4Nr=   r   s   &    r   test_header_delim_whitespacer     sI     FD __Xd^_8F%%01H&+rC   c           	          T pR pVP                  \        V4      R^ ^.RRRR7      p\        RR.RR..RR	7      p\        P                  ! W44       R# )
z
a,i,x
b,j,y
Nzstring[pyarrow]r   )r   rf   r   dtype_backendr   rn   rd   rq   jr   r=   )pyarrow_parser_onlyr   r   r@   rA   s   &    r   test_usecols_no_header_pyarrowr     sg     FD __A  F 3*sCj19JKH&+rC   )r   r2   r4   r}   )r   N)zfoo,bar,baz
1,2,3
4,5,6r\   r   )r:   r;   r<   quuxpanda)r\   (   "   皙?)r-   rv   r-   zone.1)r-   zone.2r.   rw   )r  r  r-   zone.1.1r  )r\   r  r  r  r  )r  r  r  r  )r.   ztwo.1):__doc__collectionsr   ior   numpyr   r   pandas.errorsr   pandasr   r   r   pandas._testing_testingr>   r   filterwarnings
pytestmarkusefixturesxfail_pyarrowskip_pyarrowr   r   parametrizer!   r$   rB   rI   re   ri   rj   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rN   rC   r   <module>r     s  
 #    % 
 [[''C
 ''8{{&&~6 5 53 ZB7#<=
7 >
7 D%=17 27 , ,",( ", ",J  5%.)'	
 1a&'E5>:H	

 1a&)eU^<J	
*G+*G( w&9:
 	Aq6 
	
 3$3$3$3$3$3$
	
8,9 :,& 	Aq6 
	
 3$3$3$3$3$3$
	
8,9 :,$ 	Aq6 
	
 3$3$3$3$3$3$
	
8,9 :,& , ,( , ,* , ,( , , *,LM,, Be(<#=>, ? , 	_<=2	
	
,	
, S#J#@A7 B7 , ,  4!""..P	
 6!""..R	
 @&'"..	
'"%L,M% N, taSk2I9b/i=VX, 3 
,D 	, 	, ) )> 7 7 , , G G, : : , , 	, 	,,rC   