
    d{                         d dl Zd dlZd dlmc mZ d dlZd dlm	Z	m
Z
mZmZmZ d dlmZ  ej        g d          d             Z ej        g d          d             Z G d d	          ZdS )
    N)Index
MultiIndexSeries
date_rangeisna)linearindexvaluesnearestslinearzero	quadraticcubicbarycentrickrogh
polynomialsplinepiecewise_polynomialfrom_derivativespchipakimacubicspline)paramsc                 ,    | j         }|dv rddini }||fS )a	  Fixture that returns an (method name, required kwargs) pair.

    This fixture does not include method 'time' as a parameterization; that
    method requires a Series with a DatetimeIndex, and is generally tested
    separately from these non-temporal methods.
    r   r   order   paramrequestmethodkwargss      h/var/www/html/t/fyr/venv311/lib/python3.11/site-packages/pandas/tests/series/methods/test_interpolate.pynontemporal_methodr%      s-    8 ]F#'???gq\\RF6>    )r   r   r   r   r   r   r   r   r   r   r   r   r   r   c                 ,    | j         }|dv rddini }||fS )zFixture that returns a (method name, required kwargs) pair to
    be tested for various Index types.

    This fixture does not include methods - 'time', 'index', 'nearest',
    'values' as a parameterization
    r   r   r   r   r    s      r$   interp_methods_indr(   2   s-    2 ]F#'???gq\\RF6>r&   c                      e Zd Zej                            d          d             Zd Zd Ze	j
        d             Ze	j
        d             Ze	j
        d             Ze	j
        d	             Ze	j
        d
             Zej                            di  ej        ddde	j
                  g          d             Zd Zd Zej                            di  ej        ddde	j
                  g          d             Zd Zd Ze	j
        d             Ze	j
        d             Zd Zej                            dddg          d             Zd Zej                            ddd g          d!             Zd" Zd# Zd$ Z d% Z!d& Z"ej                            d'g d(          d)             Z#ej                            d*e$j%        e$j%        d+e$j%        e$j%        e$j%        d,e$j%        e$j%        g	e$j%        e$j%        d-d-d-d-d.e$j%        e$j%        g	d/d0d1fe$j%        e$j%        d+e$j%        e$j%        e$j%        d,e$j%        e$j%        g	e$j%        e$j%        d-d-e$j%        e$j%        d.e$j%        e$j%        g	d/d0dd2fe$j%        e$j%        d+e$j%        e$j%        e$j%        d,e$j%        e$j%        g	e$j%        e$j%        d-e$j%        e$j%        e$j%        d.d.d.g	d/d3d1fe$j%        e$j%        d+e$j%        e$j%        e$j%        d,e$j%        e$j%        g	e$j%        e$j%        d-e$j%        e$j%        e$j%        d.d.e$j%        g	d/d3dd2fe$j%        e$j%        e$j%        e$j%        e$j%        e$j%        e$j%        ge$j%        e$j%        e$j%        e$j%        e$j%        e$j%        e$j%        gd/d3dd2f e&d4           e&d4          d/d3dd2ff          d5             Z'ej                            d*e$j%        e$j%        d+e$j%        e$j%        e$j%        d,e$j%        e$j%        g	e$j%        e$j%        d-d.d.d.d.e$j%        e$j%        g	d6d0d1fe$j%        e$j%        d+e$j%        e$j%        e$j%        d,e$j%        e$j%        g	e$j%        e$j%        d-e$j%        e$j%        d.d.e$j%        e$j%        g	d6d0dd2fe$j%        e$j%        d+e$j%        e$j%        e$j%        d,e$j%        e$j%        g	d-d-d-e$j%        e$j%        e$j%        d.e$j%        e$j%        g	d6d3d1fe$j%        e$j%        d+e$j%        e$j%        e$j%        d,e$j%        e$j%        g	e$j%        d-d-e$j%        e$j%        e$j%        d.e$j%        e$j%        g	d6d3dd2ff          d7             Z(d8 Z)d9 Z*d: Z+e	j
        d;             Z,ej                            d<d= ej        d>e	j
                  g          d?             Z-e	j
        d@             Z.e	j
        ej                            dAdBd/g          dC                         Z/dD Z0dE Z1e	j
        ej                            dAddFg          dG                         Z2e	j
        ej                            dHddIddJe$j%        g          dK                         Z3e	j
        dL             Z4e	j
        dM             Z5e	j
        dN             Z6e	j
        dO             Z7dP Z8dQ Z9dR Z:ej                            dSg dT e;j<        dUdVW           e;j=        ddVX          g          dY             Z>e	j
        dZ             Z?ej                            d[d>g d\fd=g d]fg          d^             Z@dS )_TestSeriesInterpolateDataz)EA.fillna does not handle 'linear' methodreasonc                 B   t          t          dd                    }|                                }t          j        |d<   |j                            d          }|                                }|j                            d          }t          j	        ||           d S )Nz
2012-01-01   )periods   D)
r   r   copypdNaTdt	to_periodinterpolatetmassert_series_equal)selforigserser_perres_perexpected_pers         r$   test_interpolate_period_valuesz8TestSeriesInterpolateData.test_interpolate_period_valuesQ   s    jq999::iikkA &""3''%%''w((--
w55555r&   c                 6   t          t          j        t          |          t                    |j                  }|                                }t          j        |dd<   |                    d          }t          j
        ||           t          d |j        D             |j                                      t                    }|                                }t          j        |dd<   |                    d          }t          j
        ||           d S )	Ndtyper.   
   r   r"   c                 6    g | ]}|                                 S  )	toordinal).0ds     r$   
<listcomp>z>TestSeriesInterpolateData.test_interpolate.<locals>.<listcomp>g   s     :::qQ[[]]:::r&   r	   time)r   nparangelenfloatr	   r2   NaNr7   r8   r9   astype)r:   datetime_serieststs_copylinear_interpord_tsord_ts_copytime_interps           r$   test_interpolatez*TestSeriesInterpolateData.test_interpolate]   s    BIc/22%@@@/BWXX''))"++8+<<
}b111::O$9:::/BW
 
 

&-- 	 kkmmFAbD!--V-<<
{F33333r&   c                     t          dddt          j        g          }d}t          j        t
          |          5  |                    d           d d d            d S # 1 swxY w Y   d S )Nr   r   r0   zGtime-weighted interpolation only works on Series.* with a DatetimeIndexmatchrM   rE   )r   rN   rR   pytestraises
ValueErrorr7   )r:   non_tsmsgs      r$   /test_interpolate_time_raises_for_non_timeserieszITestSeriesInterpolateData.test_interpolate_time_raises_for_non_timeseriesp   s     Aq"&)**W]:S111 	. 	.f---	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	. 	.   AA#&A#c                 z   t          g d          }t          g dt          g d                    }|j                            t          g d                                        t
                    }|                    |                              d          dd	         }t          j	        ||           d S )
NrD            	      &@g     &@g      '@g     '@      (@g     (@g      )@g     )@      *@	      ?      ?      ?      ?       @      @      @      @      @rL   rq   rr   rs   ru   rv   rw   r   rE   r      
r   r   r	   unionrS   rQ   reindexr7   r8   r9   )r:   r<   expected	new_indexresults        r$   test_interpolate_cubicsplinez6TestSeriesInterpolateData.test_interpolate_cubicsplinex   s    %%%&&KKKIIIJJ
 
 

 IOOE*L*L*L$M$MNNUU
 
	 Y''33=3II!A#N
vx00000r&   c                 l   t          t          j        t          j                            d                              }|j                            t          g d                                        t                    }|
                    |                              d          }|dd          d S )Nd   )size)g     H@g     H@g     H@g      I@g     @I@g     `I@r   rE   1   3   )r   rN   sortrandomuniformr	   r|   r   rS   rQ   r}   r7   )r:   r<   r   interp_ss       r$   test_interpolate_pchipz0TestSeriesInterpolateData.test_interpolate_pchip   s    RWRY..C.8899:: IOO:::;;
 

&-- 	 ;;y))55W5EEBr&   c                    t          g d          }t          g dt          g d                    }|j                            t          g d                                        t
                    }|                    |                              d          }t          j	        |dd	         |           t          g d
t          g d                    }|j                            t          g d                                        t
                    }|                    |                              dd          }t          j	        |dd	         |           d S )Nrg   rk   ro   rL   ry   r   rE   r   rz   )	rl   rp   rp   rp   rm   rp   rp   rp   rn   )r"   derr{   r:   r<   r~   r   r   s        r$   test_interpolate_akimaz0TestSeriesInterpolateData.test_interpolate_akima   sl   %%%&& KKKIIIJJ
 
 
 IOOE*L*L*L$M$MNNUU
 
	 ;;y))55W5EE
x!}h777 <<<IIIJJ
 
 
 IOOE*L*L*L$M$MNNUU
 
	 ;;y))55W!5LL
x!}h77777r&   c                 z   t          g d          }t          g dt          g d                    }|j                            t          g d                                        t
                    }|                    |                              d          }t          j	        |dd	         |           d S )
Nrg   rk   ro   rL   ry   r   rE   r   rz   r{   r   s        r$   %test_interpolate_piecewise_polynomialz?TestSeriesInterpolateData.test_interpolate_piecewise_polynomial   s    %%%&&KKKIIIJJ
 
 

 IOOE*L*L*L$M$MNNUU
 
	 ;;y))55=S5TT
x!}h77777r&   c                 z   t          g d          }t          g dt          g d                    }|j                            t          g d                                        t
                    }|                    |                              d          }t          j	        |dd	         |           d S )
Nrg   rk   ro   rL   ry   r   rE   r   rz   r{   r   s        r$   !test_interpolate_from_derivativesz;TestSeriesInterpolateData.test_interpolate_from_derivatives   s    %%%&&KKKIIIJJ
 
 

 IOOE*L*L*L$M$MNNUU
 
	 ;;y))55=O5PP
x!}h77777r&   r#   r   r   r"   r   )marksc                     t          t          j        t          j        g          }t          j         |j        di ||           t          g t                                                    }t          j         |j        di ||           d S )NrB   rG   )r   rN   nanr8   r9   r7   object)r:   r#   ss      r$   test_interpolate_cornersz2TestSeriesInterpolateData.test_interpolate_corners   s     BFBF#$$
}q}66v66:::2V$$$0022
}q}66v66:::::r&   c                    t          t          j        t          j        t          j                            d                              }t          j                            d          |d d d<   |j        j        	                    t                    }|                    d          }|                                }t          |j                  }| }t          t          j        ||         ||         |j        |                   |j        |                   }t          j        ||         |           |                    d          }t          j        ||           t          j        ||         |           d S )N   rL   rD   rz   r	   rE   r
   )r   rN   r   r   r   randrandnr	   r
   rS   rQ   r7   r2   r   interpr8   r9   )r:   r   valsr   r~   badgoodother_results           r$   test_interpolate_index_valuesz7TestSeriesInterpolateData.test_interpolate_index_values   s2   26););!<!<===$$##A#w~$$U++g..66888?##tId3idQXd^<<AGCL
 
 
 	vc{H555 }}H}55
|V444
|C0(;;;;;r&   c                    t          ddt          j        t          j        t          j        dg          }d}t          j        t
          |          5  |                    d           d d d            d S # 1 swxY w Y   d S )Nr   rz   rh   zStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexr]   rM   rE   r   rN   r   r_   r`   ra   r7   r:   r   rc   s      r$   test_interpolate_non_tsz1TestSeriesInterpolateData.test_interpolate_non_ts   s    Aq"&"&"&"566# 	 ]:S111 	) 	)MMM(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s   A55A9<A9c                     t          ddt          j        dg          } |j        di |}t          g d          }t	          j        ||           d S )Nr   r   rz           rp   rt   rx   rG   r   rN   r   r7   r8   r9   )r:   r#   r   r   r~   s        r$   test_nan_interpolatez.TestSeriesInterpolateData.test_nan_interpolate   s`     Aq"&!$%%((((...//
vx00000r&   c                     t          ddt          j        dgg d          }|                                }t          g dg d          }t	          j        ||           d S )Nr   r0      )r   rz   r.   	   rL   )rp   rt   rx         @r   r:   r   r   r~   s       r$   test_nan_irregular_indexz2TestSeriesInterpolateData.test_nan_irregular_index
  sf    Aq"&!$LLL999...lllCCC
vx00000r&   c                     t          dddt          j        gt          d                    }|                                }t          g dt          d                    }t          j        ||           d S )Nr   r   r0   abcdrL   )r   rp   rt   rt   )r   rN   r   listr7   r8   r9   r   s       r$   test_nan_str_indexz,TestSeriesInterpolateData.test_nan_str_index  sj    Aq!RV$DLL999...d6llCCC
vx00000r&   c                     t          ddt          j        dgg d          }|                    d          }t          g dg d          }t	          j        ||           d S )	Nr   r      )r   r0   rz   r   rL   r   rE   )rp   r         "@g      0@r   )r:   sqr   r~   s       r$   test_interp_quadz*TestSeriesInterpolateData.test_interp_quad  sl    Q262&lll;;;{33///|||DDD
vx00000r&   c                 \   t          ddt          j        dt          j        dg          }t          g d          }|                    d          }t	          j        ||           |                    dd	          }t	          j        ||           t          g d
          }|                    d          }t	          j        ||                    d                     |                    dd	          }t	          j        ||           t          g d
          }|                    d          }t	          j        ||                    d                     |                    dd	          }t	          j        ||           t          g d          }|                    d          }t	          j        ||           |                    dd	          }t	          j        ||           t          g d          }|                    d          }t	          j        ||           d S )Nr   rz   ri      )rp   rx   g      @rm   g     2@      9@r   rE   infer)r"   downcast)r   rz   rz   ri   ri   r   r   rQ   r   )r   rx   g:/KK@rm   gL82@r   r   )rp   rx   g333333@rm   g3333332@r   r   )r   rN   r   r7   r8   r9   rS   r:   r   r~   r   s       r$   test_interp_scipy_basicz1TestSeriesInterpolateData.test_interp_scipy_basic  s   Aq"&"bfb122;;;<<i00
vx000i'BB
vx000///00i00
vxw'?'?@@@i'BB
vx000///00f--
vxw'?'?@@@fw??
vx000 CCCDDk22
vx000kGDD
vx000;;;<<g..
vx00000r&   c                    t          ddt          j        t          j        t          j        dg          }t          ddddt          j        dg          }|                    d	d
          }t	          j        ||           d S )Nr   rz   rh   rp   rx         @      @rl   r   r0   r"   limitr   r   s       r$   test_interp_limitz+TestSeriesInterpolateData.test_interp_limitB  sl    Aq"&"&"&"5663S#rvt<==ha88
vx00000r&   r   r   c                     t          ddt          j        dg          }|\  }}t          j        t
          d          5   |j        d||d| d d d            d S # 1 swxY w Y   d S )Nr   r0   r   zLimit must be greater than 0r]   r   r"   rG   r   )r:   r%   r   r   r"   r#   s         r$   *test_interpolate_invalid_nonpositive_limitzDTestSeriesInterpolateData.test_interpolate_invalid_nonpositive_limitI  s     Aq"&!$%%+]:-KLLL 	@ 	@AM?f?????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s   AA #A c                     t          ddt          j        dg          }|\  }}d}t          j        t
          d          5   |j        d||d| d d d            d S # 1 swxY w Y   d S )	Nr   r0   r   rt   zLimit must be an integerr]   r   rG   r   )r:   r%   r   r"   r#   r   s         r$   $test_interpolate_invalid_float_limitz>TestSeriesInterpolateData.test_interpolate_invalid_float_limitQ  s    Aq"&!$%%+]:-GHHH 	@ 	@AM?f?????	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@s    AA"%A"invalid_methodNnonexistent_methodc                    t          ddt          j        dt          j        dg          }d| d}t          j        t
          |          5  |                    |           d d d            n# 1 swxY w Y   t          j        t
          |          5  |                    |d	
           d d d            d S # 1 swxY w Y   d S )Nr   rz   ri   r   zmethod must be one of.* Got 'z	' insteadr]   rE   r   r   r   )r:   r   r   rc   s       r$   test_interp_invalid_methodz4TestSeriesInterpolateData.test_interp_invalid_methodY  s?   Aq"&"bfb122GnGGG]:S111 	1 	1MMM000	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1 	1
 ]:S111 	; 	;MMrM:::	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;s$   A..A25A2B99B= B=c                     t          ddt          j        dt          j        dg          }d}t          j        t
          |          5  |                    dd           d d d            d S # 1 swxY w Y   d S )	Nr   rz   ri   r   z&Cannot pass both fill_value and methodr]   pad)
fill_valuer"   r   )r:   r<   rc   s      r$   $test_interp_invalid_method_and_valuez>TestSeriesInterpolateData.test_interp_invalid_method_and_valuef  s    aBFB3446]:S111 	8 	8OOqO777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8s   A,,A03A0c                 ^   t          ddt          j        t          j        t          j        dg          }t          ddddt          j        dg          }|                    d	d
d          }t	          j        ||           |                    d	d
d          }t	          j        ||           d S )Nr   rz   rh   rp   rx   r   r   rl   r   r0   forwardr"   r   limit_directionFORWARDr   r   s       r$   test_interp_limit_forwardz3TestSeriesInterpolateData.test_interp_limit_forwardn  s    Aq"&"&"&"566 3S#rvt<==haSS
vx000haSS
vx00000r&   c           
      F   t          t          j        ddt          j        t          j        t          j        dt          j        g          }t          g d          }|                    dd          }t	          j        ||           t          t          j        dddd	d
ddg          }|                    dd          }t	          j        ||           t          ddddd	d
dt          j        g          }|                    dd          }t	          j        ||           d S )Nrp   rx   rl   )rp   rp   rx   r   r   r   rl   rl   r   bothr"   r   r   r   r   r   backwardr   r   s       r$   test_interp_unlimitedz/TestSeriesInterpolateData.test_interp_unlimitedz  s    BFCbfbfbfdBFKLLDDDEEhGG
vx000263S#sD$GHHh	JJ
vx0003S#sCrvFGGh
KK
vx00000r&   c                    t          ddt          j        t          j        t          j        dg          }d}t          j        t
          |          5  |                    ddd	           d d d            n# 1 swxY w Y   t          j        t
          |          5  |                    dd
           d d d            d S # 1 swxY w Y   d S )Nr   rz   rh   zVInvalid limit_direction: expecting one of \['forward', 'backward', 'both'\], got 'abc'r]   r   r0   abcr   r   r   r   s      r$   test_interp_limit_bad_directionz9TestSeriesInterpolateData.test_interp_limit_bad_direction  sf   Aq"&"&"&"566/ 	 ]:S111 	K 	KMMEMJJJ	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K 	K ]:S111 	B 	BMM5MAAA	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	B 	Bs$   A66A:=A:CCCc                    t          t          j        t          j        dt          j        t          j        t          j        dt          j        t          j        g	          }t          t          j        t          j        dddddt          j        t          j        g	          }|                    dd	
          }t	          j        ||           t          t          j        t          j        ddt          j        t          j        dt          j        t          j        g	          }|                    dd	d          }t	          j        ||           t          t          j        t          j        ddt          j        ddt          j        t          j        g	          }|                    dd	dd          }t	          j        ||           t          t          j        t          j        dt          j        t          j        t          j        dddg	          }|                    dd
          }t	          j        ||           t          t          j        t          j        dt          j        t          j        t          j        ddt          j        g	          }|                    ddd          }t	          j        ||           t          t          j        ddt          j        t          j        t          j        ddt          j        g	          }|                    dddd          }t	          j        ||           t          dddt          j        t          j        t          j        dt          j        t          j        g	          }|                    ddd          }t	          j        ||           d}t          j        t          |          5  |                    dd
           d d d            d S # 1 swxY w Y   d S )Nrz      rx   r   r         @r   r   insider"   
limit_arear   r"   r   r   r   )r"   r   r   r   outsider   )r"   r   r   zEInvalid limit_area: expecting one of \['inside', 'outside'\], got abcr]   r   )	r   rN   r   r7   r8   r9   r_   r`   ra   )r:   r   r~   r   rc   s        r$   test_interp_limit_areaz0TestSeriesInterpolateData.test_interp_limit_area  sD   BFBFArvrvrvq"&"&QRR26263S#sBFBFSTTh8DD
vx000VRVS#rvrvsBFBFK
 
 h81MM
vx00026263RVS#rvrvVWW&PQ  
 
 	vx00026263SRUVWWh9EE
vx000VRVS"&"&"&#sBFK
 
 h9ANN
vx000263RVRVRVS#rvVWW	6QR  
 
 	vx0003S"&"&"&#rvrvVWW	:  
 
 	vx000 W]:S111 	= 	=MMeM<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	=s   O,,O03O0z!method, limit_direction, expected))r   r   r   )ffillr   r   )backfillr   r   )bfillr   r   )r   r   r   )r   r   r   )r   r   r   )r   r   r   c                     t          g d          }d| d| d}t          j        t          |          5  |                    ||           d d d            d S # 1 swxY w Y   d S )Nr   r0   rz   z`limit_direction` must be 'z' for method ``r]   r   )r   r_   r`   ra   r7   )r:   r"   r   r~   r   rc   s         r$   "test_interp_limit_direction_raisesz<TestSeriesInterpolateData.test_interp_limit_direction_raises  s     999MHMMFMMM]:S111 	J 	JMMMIII	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	J 	Js   AA"Azdata, expected_data, kwargsrz   r   rx   r   r   r   r   r   r   r.   c                     t          |          }t          |          } |j        di |}t          j        ||           d S NrG   r   r7   r8   r9   r:   dataexpected_datar#   r   r~   r   s          r$   test_interp_limit_area_with_padz9TestSeriesInterpolateData.test_interp_limit_area_with_pad  sM    L 4LL-((((((
vx00000r&   r   c                     t          |          }t          |          } |j        di |}t          j        ||           d S r   r   r   s          r$   $test_interp_limit_area_with_backfillz>TestSeriesInterpolateData.test_interp_limit_area_with_backfill  sL    8 4LL-((((((
vx00000r&   c                 f   t          ddt          j        t          j        t          j        dg          }t          ddt          j        dddg          }|                    d	d
d          }t	          j        ||           t          dddt          j        ddg          }|                    d	dd          }t	          j        ||           t          ddt          j        t          j        t          j        ddt          j        t          j        dt          j        g          }t          g d          }|                    d	d
d          }t	          j        ||           t          dddt          j        dddddddg          }|                    d	dd          }t	          j        ||           d S )Nr   rz   rh   rp   rx   r   r   rl   r   r0   r   r   r   r   r   r   ri   )rp   rx   r   r   r   r   r         $@rl   rm   rm   r   r   r   rm   r   r   s       r$   test_interp_limit_directionz5TestSeriesInterpolateData.test_interp_limit_direction(  s{   Aq"&"&"&"5663RVS#t<==haTT
vx0003S"&#t<==haPP
vx000 Aq"&"&"&!QBFSTTUUUVVhaPP
vx000#sBFCc4tTJ
 
 haPP
vx00000r&   c                    t          t          j        t          j        dddt          j        g          }t          dddddt          j        g          }|                    ddd	
          }t	          j        ||           t          g d          }|                    ddd
          }t	          j        ||           d S )Nr.   r   r   r   r   r   r   r0   r   r   )r   r   r   r   r   r   r   r   r   s       r$   test_interp_limit_to_endsz3TestSeriesInterpolateData.test_interp_limit_to_endsA  s    BFBFAq!RV4553S#sBF;<<haTT
vx00088899haPP
vx00000r&   c                    t          t          j        t          j        ddt          j        t          j        g          }t          t          j        t          j        dddt          j        g          }|                    ddd          }t	          j        ||           t          t          j        dddt          j        t          j        g          }|                    ddd	          }t	          j        ||           t          t          j        ddddt          j        g          }|                    ddd
          }t	          j        ||           d S )Nr.   r   r   r   r   r   r   r   r   r   r   r   s       r$   test_interp_limit_before_endsz7TestSeriesInterpolateData.test_interp_limit_before_endsM  s   BFBFAq"&"&9::26263S"&ABBhaSS
vx000263S"&"&ABBhaTT
vx000263S#rv>??haPP
vx00000r&   c                     t          g d          }|                    dd          }t          j        ||           |                                }t          j        ||           d S )Nr   r   r   r   r   )r:   r   r   s      r$   test_interp_all_goodz.TestSeriesInterpolateData.test_interp_all_good]  sc    999l!<<
vq))) 
vq)))))r&   check_scipyFTc                    t          j        g d          }t          ddt          j        g|          }|                                }d|j        d<   |                                }t          j	        ||           d}|rMt          j        t          |          5  |                    dd           d d d            d S # 1 swxY w Y   d S d S )	N))r   a)r   b)r0   cr   r0   rL   z?Only `method=linear` interpolation is supported on MultiIndexesr]   r   r   )r   from_tuplesr   rN   r   r2   locr7   r8   r9   r_   r`   ra   )r:   r  idxr   r~   r   rc   s          r$   test_interp_multiIndexz0TestSeriesInterpolateData.test_interp_multiIndexg  s    $%C%C%CDDAq"&>---6688Q
vx000O 	<z555 < <\;;;< < < < < < < < < < < < < < < < < <	< 	<s   C  CCc                     t          dt          j        dgg d          }d}t          j        t
          |          5  |                    d           d d d            d S # 1 swxY w Y   d S )	Nr   rz   )r   r0   r   rL   z8krogh interpolation requires that the index be monotonicr]   r   rE   r   r   s      r$   test_interp_nonmono_raisez3TestSeriesInterpolateData.test_interp_nonmono_raisex  s    Arvq>333H]:S111 	* 	*MMM)))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   A""A&)A&r"   r   c                     t          dt          j        dgt          dd|                    }|                    |          }t          g dt          dd|                    }t          j        ||           d S )Nr   rz   1/1/2000r/   tzrL   rE   )rp   rp   rx   )r   rN   r   r   r7   r8   r9   )r:   r"   tz_naive_fixturedfr   r~   s         r$   test_interp_datetime64z0TestSeriesInterpolateData.test_interp_datetime64  s     N*ZGW"X"X"X
 
 
 v..OOZ7GHHH
 
 
 	vx00000r&   c                     t          ddd          }t          |          }t          j        |d<   |                    d          }t          |          }|d         |d<   t          j        ||           d S )	Nz
2015-04-05rz   z
US/Centralr  r   r   rE   r   )r   r   r3   r4   r7   r8   r9   )r:   dtir<   r   r~   s        r$   #test_interp_pad_datetime64tz_valuesz=TestSeriesInterpolateData.test_interp_pad_datetime64tz_values  sp    q\BBBSkkA..#;;qk
vx00000r&   c                     t          g d          }|                    d          }|}t          j        ||           d S )Nrp   rt   rx   r   )r   r   r   s       r$   test_interp_limit_no_nansz3TestSeriesInterpolateData.test_interp_limit_no_nans  sD    ???##Q''
vx00000r&   r   c                     t          ddt          j        dg          }d}t          j        t
          |          5  |                    |           d d d            d S # 1 swxY w Y   d S )Nr   r   rz   z6You must specify the order of the spline or polynomialr]   rE   r   )r:   r"   r   rc   s       r$   test_no_orderz'TestSeriesInterpolateData.test_no_order  s     Aq"&!$%%F]:S111 	) 	)MMM(((	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)re   r   g      r   c                     t          ddt          j        dg          }d}t          j        t
          |          5  |                    d|           d d d            d S # 1 swxY w Y   d S )Nr   r   rz   z.order needs to be specified and greater than 0r]   r   r   r   )r:   r   r   rc   s       r$   %test_interpolate_spline_invalid_orderz?TestSeriesInterpolateData.test_interpolate_spline_invalid_order  s     Aq"&!$%%>]:S111 	8 	8MMM777	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8 	8s   A  A$'A$c           	          t          ddt          j        ddt          j        dg          }|                    dd          }t          g d          }t	          j        ||           d S )	Nr   r0   r   r.   r   r   r   rp   rt   rx   r   r   r   r   r   r   s       r$   test_splinez%TestSeriesInterpolateData.test_spline  sd    Aq"&!Q233ha88===>>
vx00000r&   c           	      R   t          ddddt          j        dt          j        g          }|                    ddd          }t          g d          }t	          j        ||           |                    ddd	          }t          g d
          }t	          j        ||           d S )Nr   r0   rz   r      r   )r"   r   ext)rp   rt   rx   r   r   r   r   r   r%  r   )r:   r   result3	expected3result1	expected1s         r$   test_spline_extrapolatez1TestSeriesInterpolateData.test_spline_extrapolate  s    Aq!Q26233--xqa-@@>>>??	
w	222--xqa-@@>>>??	
w	22222r&   c           	          t          ddt          j        ddt          j        dg          }|                    ddd	          d
         |                    dd          d
         k    sJ d S )Nr   r0   r   gffffff@r   r   rz   r   )r"   r   r   r.   r   )r   rN   r   r7   )r:   r   s     r$   test_spline_smoothz,TestSeriesInterpolateData.test_spline_smooth  sr    Aq"&!S"&!455MMaM88;}}HA}66q9: : : : : :r&   c                 4   t          t          j        d          dz  d          }t          j        |t          j                            ddd          <   |                    dd	
          }|                    dd	
          }t          j        ||           d S )NrD   r0   rQ   rB   r   r   rz   r   r   r   )	r   rN   rO   r   r   randintr7   r8   r9   )r:   r   r,  r-  s       r$   test_spline_interpolationz3TestSeriesInterpolateData.test_spline_interpolation  s     29R==A%W555(*")

Aq!
$
$%--xq-99MMM;;	
w	22222r&   c                    t          dt          j        dgt          j        g d                    }|                    d          }t          g dt          j        g d                    }t          j        ||           t          dt          j        dgt          j        g d                    }|                    d          }t          g d	t          j        g d                    }t          j        ||           d S )
Nr   rz   r   rL   rM   rE   r  )r   r0   r   )rp   g(%?rx   )r   rN   r   r3   to_timedeltar7   r8   r9   )r:   r  r   r~   s       r$   test_interp_timedelta64z1TestSeriesInterpolateData.test_interp_timedelta64  s    QN"/)))*D*DEEEv..///1K1KLLL
vx000 QN"/)))*D*DEEEv.....boiii6P6PQQQ
vx00000r&   c                 B   t          ddd          }t          t          j                            t          |                    |          }t          j        |d d d<   |                    d          }|                                }t          j	        ||           d S )	Nr  z	1/20/2000r1   )freqrL   r0   r
   rE   )
r   r   rN   r   r   rP   r   r7   r8   r9   )r:   rngrU   r   exps        r$   %test_series_interpolate_method_valuesz?TestSeriesInterpolateData.test_series_interpolate_method_values  s    [s;;;BIOOCHH--S999&33Q3x00nn
vs+++++r&   c                 l   t          ddd          }t          g d|          }|                    |t          j        d          z                                             }|                    |                              d	          }t          ddd
          }t          g d|          }|                    |t          j        d          z                                             }|                    |                              d	          }t          j	        |j
        |j
                   d S )Nz1/1/2012r   12D)r/   r8  )r   ri      $   r   )daysrM   rE   12H)hours)r   r   appendr3   
DateOffsetsort_valuesr}   r7   r8   assert_numpy_array_equalr
   )r:   r	   rU   r   r:  r   s         r$    test_series_interpolate_intradayz:TestSeriesInterpolateData.test_series_interpolate_intraday  s   :qu===OOOU++LLA)>)>)>!>??KKMM	jj##//v/>>:qu===OOOU++LLQ)?)?)?!?@@LLNN	I&&22&2AA
#FM3:>>>>>r&   ind)r
  r  r  rJ   z
2019-01-01r   startr/   )rJ  endc                    t          j        ddt          j        dg|          }|\  }}|dk    rt	          j        d           |dk    r> |d         j        di |}t          g dd|	          }t          j	        ||           d S d
| d}t	          j
        t          |          5   |d         j        dd|i| d d d            d S # 1 swxY w Y   d S )Nr   r   rz   rL   r   scipyr   r   namer	   z9Index column must be numeric or datetime type when using z_ method other than linear. Try setting a numeric or datetime index column before interpolating.r]   r"   rG   )r3   	DataFramerN   r   r_   importorskipr7   r   r8   r9   r`   ra   )	r:   r(   rH  r  r"   r#   r   r~   expected_errors	            r$   test_interp_non_timedelta_indexz9TestSeriesInterpolateData.test_interp_non_timedelta_index  s\    \1a+3777+W(((X&RU&0000F222#FFFH"6844444!! ! !  z@@@ ; ;!1!:::6:::; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;s   )CCCc                 ~   t          j        dd          }t          j        ddt          j        dg|          }|\  }}|dv r;|j                            t          j        	                    | d	                      |d         j
        dd
|i|}t          g dd|          }t          j        ||           dS )z
        Tests for non numerical index types  - object, period, timedelta
        Note that all methods except time, index, nearest and values
        are tested here.
        r   r   rI  r   rz   rL   >   r   r   z2 interpolation is not supported for TimedeltaIndexr+   r"   r   rN  NrG   )r3   timedelta_rangerP  rN   r   node
add_markerr_   markxfailr7   r   r8   r9   )	r:   r!   r(   rH  r  r"   r#   r   r~   s	            r$    test_interpolate_timedelta_indexz:TestSeriesInterpolateData.test_interpolate_timedelta_index  s      q!444\1a+3777+&&&L##!!$XXX "    
 #A";;&;F;;...QcBBB
vx00000r&   zascending, expected_values)r   r0   rz   r   rD   rD   r   rz   r0   r   c                     t          ddt          j        ddgg d          }|                    |                              d	          }t          ||t
          
          }t          j        ||           d S )NrD   r   r0   r   r[  )r   r	   )	ascendingr	   rE   )r   r	   rC   )r   rN   r   
sort_indexr7   rQ   r8   r9   )r:   r]  expected_valuesrU   r   r~   s         r$   test_interpolate_unsorted_indexz9TestSeriesInterpolateData.test_interpolate_unsorted_index.  s{     "aA.6F6F6FGGG33??w?OOoUSSS
vx00000r&   )A__name__
__module____qualname__r_   rX  rY  r@   r[   rd   tdskip_if_no_scipyr   r   r   r   r   parametrizer   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rN   r   ranger   r   r  r  r  r  r  r  r  r  r  r!  r#  r&  r.  r0  r3  r6  r;  rG  r3   period_rangeinterval_rangerS  rZ  r`  rG   r&   r$   r*   r*   P   s/
       [IJJ	6 	6 KJ	64 4 4&. . . 1 1 1 	 	 	 8 8 82 8 8 8 8 8 8 [FL'!44B<O  	
 ; ; ;< < <.) ) ) [FL'!44B<O  	
 1 1 11 1 11 1 1 1 1 1 "1 "1 "1H1 1 1 [Wr1g..@ @ /.@@ @ @ [-6J/KLL
; 
; ML
;8 8 8
1 
1 
11 1 1B B B-= -= -=^ [+		
 		
 		
 J J J [% BFBFBFArvrvNc3S"&"&I 99 BFBFBFArvrvNc26263O 1EE BFBFBFArvrvNbfbfbfc3L 	:: BFBFBFArvrvNbfbfbfc3O 	AFF HH 	AFF aa 	AFF5	
" "F1 1G" "F1 [% BFBFBFArvrvNc3S"&"&I"(;; BFBFBFArvrvNbfbfc3O"(QGG BFBFBFArvrvNc3RVRVL")<< BFBFBFArvrvNc2626263O")aHH!	
 21 13 211 1 12
1 
1 
11 1 1  * * * [|v|D8KLLLM < < < * * * [X	5'9::	1 	1 ;: 	1	1 	1 	11 1 1 [Xh'?@@) ) A@ ) [Wr4C&@AA8 8 BA 8 1 1 1 3 3 3 
 
 
 3 3 31 1 1	, 	, 	,? ? ? [   BO,:::BA1---	
 ; ; ;, 1 1 1, [$
   	!E+;+;+;#<= 1 1	 1 1 1r&   r*   )numpyrN   r_   pandas.util._test_decoratorsutil_test_decoratorsrd  pandasr3   r   r   r   r   r   pandas._testing_testingr8   fixturer%   r(   r*   rG   r&   r$   <module>rr     sW        ) ) ) ) ) ) ) ) )                            *	 	+ *	     $	 	% $	g1 g1 g1 g1 g1 g1 g1 g1 g1 g1r&   