
    .iy                         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y)
    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                 6    | 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      j/var/www/app/trading-bot/venv/lib/python3.12/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                 6    | 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                  j                  d      d        Zd Zd Zd Z	d Z
d Zd	 Zd
 Zej                  j                  di  ej                  ddd ej"                  d            g      d        Zd Zd Zej                  j                  di  ej                  ddd ej"                  d            g      d        Zd Zd Zd Zd Zd Zej                  j                  dddg      d        Zd Zej                  j                  dd d!g      d"        Zd# Zd$ Zd% Z d& Z!ej                  j                  d'e"jF                  e"jF                  d(e"jF                  e"jF                  e"jF                  d)e"jF                  e"jF                  g	d*d+d,fe"jF                  e"jF                  d(e"jF                  e"jF                  e"jF                  d)e"jF                  e"jF                  g	d*d+dd-fe"jF                  e"jF                  d(e"jF                  e"jF                  e"jF                  d)e"jF                  e"jF                  g	d*d.d,fe"jF                  e"jF                  d(e"jF                  e"jF                  e"jF                  d)e"jF                  e"jF                  g	d*d.dd-fe"jF                  e"jF                  e"jF                  e"jF                  e"jF                  e"jF                  e"jF                  gd*d.dd-f e$d/      d*d.dd-ff      d0        Z%ej                  j                  d'e"jF                  e"jF                  d(e"jF                  e"jF                  e"jF                  d)e"jF                  e"jF                  g	d1d+d,fe"jF                  e"jF                  d(e"jF                  e"jF                  e"jF                  d)e"jF                  e"jF                  g	d1d+dd-fe"jF                  e"jF                  d(e"jF                  e"jF                  e"jF                  d)e"jF                  e"jF                  g	d1d.d,fe"jF                  e"jF                  d(e"jF                  e"jF                  e"jF                  d)e"jF                  e"jF                  g	d1d.dd-ff      d2        Z&d3 Z'd4 Z(d5 Z)d6 Z*ej                  j                  d7d8 ej                  d9 ej"                  d            g      d:        Z+d; Z,ej                  j                  d<d=d*g      d>        Z-d? Z.d@ Z/ej                  j                  d<ddAg      dB        Z0ej                  j                  dCddDddEe"jF                  g      dF        Z1dG Z2dH Z3dI Z4dJ Z5dK Z6dL Z7dM Z8ej                  j                  dNg dO e9jt                  dPdQR       e9jv                  ddQS      g      dT        Z<dU Z=ej                  j                  dVd9g dWfd8g dXfg      dY        Z>dZ Z?d[ Z@y )\TestSeriesInterpolateDataz)EA.fillna does not handle 'linear' methodreasonc                 .   t        t        dd            }|j                         }t        j                  |d<   |j
                  j                  d      }|j                         }|j
                  j                  d      }t        j                  ||       y )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   ss    jq9:iikA &&""3'%%'ww((-
w5r&   c                 p   t        t        j                  t        |      t              |j
                        }|j                         }t        j                  |dd t        j                  |dd |j                  d      }t        j                  ||       t        |j
                  D cg c]  }|j                          c}|j
                        j                  t              }|j                         }t        j                  |d	d
 |j                  d      }t        j                  ||       y c c}w )Ndtyper         	   r   r"   r	   r.   
   time)r   nparangelenfloatr	   r2   nanr7   r8   r9   	toordinalastype)	r:   datetime_serieststs_copylinear_interpdord_tsord_ts_copytime_interps	            r$   test_interpolatez*TestSeriesInterpolateData.test_interpolate]   s    BIIc/2%@/BWBWX'')
 vv!vv!++8+<
}b1$3$9$9:qQ[[]:/BWBW

&- 	 kkmFFAb!--V-<
{F3 ;s   *D3c                     t        dddt        j                  g      }d}t        j                  t
        |      5  |j                  d       d d d        y # 1 sw Y   y xY w)Nr   r   r0   zGtime-weighted interpolation only works on Series.* with a DatetimeIndexmatchrJ   rG   r   rK   rO   pytestraises
ValueErrorr7   )r:   non_tsmsgs      r$   /test_interpolate_time_raises_for_non_timeserieszITestSeriesInterpolateData.test_interpolate_time_raises_for_non_timeseriesu   sT     Aq"&&)*W]]:S1 	.f-	. 	. 	.s   AA c                 v   t        j                  d       t        g d      }t        g dt        g d            }|j                  j                  t        g d            j                  t              }|j                  |      j                  d      j                  d	d
 }t        j                  ||       y )NscipyrI            	      &@g     &@g      '@g     '@      (@g     (@g      )@g     )@      *@	      ?      ?      ?      ?       @      @      @      @      @rH   rq   rr   rs   ru   rv   rw   r   rG   r      )r_   importorskipr   r   r	   unionrQ   rN   reindexr7   locr8   r9   )r:   r<   expected	new_indexresults        r$   test_interpolate_cubicsplinez6TestSeriesInterpolateData.test_interpolate_cubicspline}   s    G$%&KIJ

 IIOOE*L$MNUU
	 Y'33=3IMMaPQR
vx0r&   c                    t        j                  d       t        t        j                  t        j
                  j                  d      j                  d                  }|j                  j                  t        g d            j                  t              }|j                  |      j                  d      }|j                  dd	  y )
Nrf   r0   d   )size)g     H@g     H@g     H@g      I@g     @I@g     `I@r   rG   1   3   )r_   r{   r   rK   sortrandomdefault_rnguniformr	   r|   r   rQ   rN   r}   r7   r~   )r:   r<   r   interp_ss       r$   test_interpolate_pchipz0TestSeriesInterpolateData.test_interpolate_pchip   s    G$RWWRYY2215==3=GHI IIOO:;

&- 	 ;;y)55W5ERr&   c                    t        j                  d       t        g d      }t        g dt        g d            }|j                  j                  t        g d            j                  t              }|j                  |      j                  d      }t        j                  |j                  d	d
 |       t        g dt        g d            }|j                  j                  t        g d            j                  t              }|j                  |      j                  dd	      }t        j                  |j                  d	d
 |       y )Nrf   rg   rk   ro   rH   ry   r   rG   r   rz   )	rl   rp   rp   rp   rm   rp   rp   rp   rn   )r"   derr_   r{   r   r   r	   r|   rQ   rN   r}   r7   r8   r9   r~   r:   r<   r   r   r   s        r$   test_interpolate_akimaz0TestSeriesInterpolateData.test_interpolate_akima   s   G$%& KIJ
 IIOOE*L$MNUU
	 ;;y)55W5E
x||Aa0(; <IJ
 IIOOE*L$MNUU
	 ;;y)55W!5L
x||Aa0(;r&   c                 v   t        j                  d       t        g d      }t        g dt        g d            }|j                  j                  t        g d            j                  t              }|j                  |      j                  d      }t        j                  |j                  d	d
 |       y )Nrf   rg   rk   ro   rH   ry   r   rG   r   rz   r   r   s        r$   %test_interpolate_piecewise_polynomialz?TestSeriesInterpolateData.test_interpolate_piecewise_polynomial   s    G$%&KIJ

 IIOOE*L$MNUU
	 ;;y)55=S5T
x||Aa0(;r&   c                 v   t        j                  d       t        g d      }t        g dt        g d            }|j                  j                  t        g d            j                  t              }|j                  |      j                  d      }t        j                  |j                  d	d
 |       y )Nrf   rg   rk   ro   rH   ry   r   rG   r   rz   r   r   s        r$   !test_interpolate_from_derivativesz;TestSeriesInterpolateData.test_interpolate_from_derivatives   s    G$%&KIJ

 IIOOE*L$MNUU
	 ;;y)55=O5P
x||Aa0(;r&   r#   r   r   r"   r   rf   )marksc                 ,   t        t        j                  t        j                  g      }t        j                   |j
                  di ||       t        g t              j                         }t        j                   |j
                  di ||       y )NrB    )r   rK   rO   r8   r9   r7   object)r:   r#   ss      r$   test_interpolate_cornersz2TestSeriesInterpolateData.test_interpolate_corners   sl     BFFBFF#$
}q}}6v6:2V$002
}q}}6v6:r&   c                    t        t        j                  t        j                  t        j                  j                  d      j	                  d                  }t        j                  j                  d      j                  d      |j                  d d d<   |j                  j                  j                  t              }|j                  d      }t        |      }| }t        t        j                  ||   ||   |j                  |         |j                  |         }t        j                   ||   |       |j                  d      }t        j                   ||       t        j                   ||   |       y )	Nr0      rH   rI   rz   r	   rG   r
   )r   rK   rO   r   r   r   standard_normalr~   r	   r
   rQ   rN   r7   r   interpr8   r9   )r:   r   valsr   badgoodr   other_results           r$   test_interpolate_index_valuesz7TestSeriesInterpolateData.test_interpolate_index_values   s   266)>)>q)A)H)H)L!MNYY**1-==bAcc
ww~~$$U+g.1gtIId3idQXXd^<AGGCL
 	vc{H5 }}H}5
|V4
|C0(;r&   c                    t        ddt        j                  t        j                  t        j                  dg      }d}t        j                  t
        |      5  |j                  d       d d d        y # 1 sw Y   y xY w)Nr   rz   rh   zStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexr\   rJ   rG   r^   r:   r   rc   s      r$   test_interpolate_non_tsz1TestSeriesInterpolateData.test_interpolate_non_ts   sb    Aq"&&"&&"&&"56# 	 ]]:S1 	)MMM(	) 	) 	)s   A55A>c                     t        ddt        j                  dg      } |j                  di |}t        g d      }t	        j
                  ||       y )Nr   r   rz           rp   rt   rx   r   r   rK   rO   r7   r8   r9   )r:   r#   r   r   r   s        r$   test_nan_interpolatez.TestSeriesInterpolateData.test_nan_interpolate   sI     Aq"&&!$%((./
vx0r&   c                     t        ddt        j                  dgg d      }|j                         }t        g dg d      }t	        j
                  ||       y )Nr   r0   rD   )r   rz   r.   rF   rH   )rp   rt   rx         @r   r:   r   r   r   s       r$   test_nan_irregular_indexz2TestSeriesInterpolateData.test_nan_irregular_index  sC    Aq"&&!$L9.lC
vx0r&   c                     t        dddt        j                  gt        d            }|j	                         }t        g dt        d            }t        j                  ||       y )Nr   r   r0   abcdrH   )r   rp   rt   rt   )r   rK   rO   listr7   r8   r9   r   s       r$   test_nan_str_indexz,TestSeriesInterpolateData.test_nan_str_index  sK    Aq!RVV$DL9.d6lC
vx0r&   c                     t        j                  d       t        ddt        j                  dgg d      }|j                  d      }t        g d	g d      }t        j                  ||       y )
Nrf   r   rD      )r   r0   rz   rD   rH   r   rG   )rp   r         "@g      0@r_   r{   r   rK   rO   r7   r8   r9   )r:   sqr   r   s       r$   test_interp_quadz*TestSeriesInterpolateData.test_interp_quad  sV    G$Q2662&l;{3/|D
vx0r&   c                    t        j                  d       t        ddt        j                  dt        j                  dg      }t        g d      }|j                  d      }t        j                  ||       |j                  d      }t        j                  ||       t        g d	      }|j                  d
      }t        j                  ||j                  d             |j                  d
      }t        j                  ||       t        g d	      }|j                  d      }t        j                  ||j                  d             |j                  d      }t        j                  ||       t        g d      }|j                  d      }t        j                  ||       |j                  d      }t        j                  ||       t        g d      }|j                  d      }t        j                  ||       y )Nrf   r   rz   ri      )rp   rx   g      @rm   g     2@      9@r   rG   )r   rz   rz   ri   ri   r   r   rN   r   )r   rx   g:/KK@rm   gL82@r   r   )rp   rx   g333333@rm   g3333332@r   r   )	r_   r{   r   rK   rO   r7   r8   r9   rQ   r:   r   r   r   s       r$   test_interp_scipy_basicz1TestSeriesInterpolateData.test_interp_scipy_basic!  s   G$Aq"&&"bffb12;<i0
vx0i0
vx012i0
vxw'?@i0
vx012f-
vxw'?@f-
vx0 CDk2
vx0k2
vx0;<g.
vx0r&   c                 
   t        ddt        j                  t        j                  t        j                  dg      }t        ddddt        j                  dg      }|j                  d	d
      }t	        j
                  ||       y )Nr   rz   rh   rp   rx         @      @rl   r   r0   r"   limitr   r   s       r$   test_interp_limitz+TestSeriesInterpolateData.test_interp_limitE  sb    Aq"&&"&&"&&"563S#rvvt<=ha8
vx0r&   r   r   c                     t        ddt        j                  dg      }|\  }}t        j                  t
        d      5   |j                  d||d| d d d        y # 1 sw Y   y xY w)Nr   r0   rD   zLimit must be greater than 0r\   r   r"   r   r^   )r:   r%   r   r   r"   r#   s         r$   *test_interpolate_invalid_nonpositive_limitzDTestSeriesInterpolateData.test_interpolate_invalid_nonpositive_limitL  sd     Aq"&&!$%+]]:-KL 	@AMM?f??	@ 	@ 	@s   AA&c                     t        ddt        j                  dg      }|\  }}d}t        j                  t
        d      5   |j                  d||d| d d d        y # 1 sw Y   y xY w)	Nr   r0   rD   rt   zLimit must be an integerr\   r   r   r^   )r:   r%   r   r"   r#   r   s         r$   $test_interpolate_invalid_float_limitz>TestSeriesInterpolateData.test_interpolate_invalid_float_limitT  sg    Aq"&&!$%+]]:-GH 	@AMM?f??	@ 	@ 	@s    AA(invalid_methodNnonexistent_methodc                 t   t        ddt        j                  dt        j                  dg      }d}|d}t        j                  t
        |      5  |j                  |       d d d        t        j                  t
        |      5  |j                  |d	
       d d d        y # 1 sw Y   AxY w# 1 sw Y   y xY w)Nr   rz   ri   r   z2Can not interpolate with method=nonexistent_methodz%'method' should be a string, not Noner\   rG   r   r   r^   )r:   r   r   rc   s       r$   test_interp_invalid_methodz4TestSeriesInterpolateData.test_interp_invalid_method\  s    Aq"&&"bffb12B!9C]]:S1 	1MMM0	1
 ]]:S1 	;MMrM:	; 	;	1 	1
	; 	;s   B"B."B+.B7c                 `   t        ddt        j                  t        j                  t        j                  dg      }t        ddddt        j                  dg      }|j                  d	d
d      }t	        j
                  ||       |j                  d	d
d      }t	        j
                  ||       y )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_forwardk  s    Aq"&&"&&"&&"56 3S#rvvt<=haS
vx0haS
vx0r&   c           
      J   t        t        j                  ddt        j                  t        j                  t        j                  dt        j                  g      }t        g d      }|j                  dd      }t	        j
                  ||       t        t        j                  dddd	d
ddg      }|j                  dd      }t	        j
                  ||       t        ddddd	d
dt        j                  g      }|j                  dd      }t	        j
                  ||       y )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_unlimitedw  s    BFFCbffbffbffdBFFKLDEhG
vx02663S#sD$GHh	J
vx03S#sCrvvFGh
K
vx0r&   c                    t        ddt        j                  t        j                  t        j                  dg      }d}t        j                  t
        |      5  |j                  ddd	       d d d        t        j                  t
        |      5  |j                  dd
       d d d        y # 1 sw Y   AxY w# 1 sw Y   y xY w)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  s    Aq"&&"&&"&&"56/ 	 ]]:S1 	KMMEMJ	K ]]:S1 	BMM5MA	B 	B		K 	K	B 	Bs   B.B:.B7: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	      }|j                  dd	
      }t	        j
                  ||       t        t        j                  t        j                  ddt        j                  t        j                  dt        j                  t        j                  g	      }|j                  dd	d      }t	        j
                  ||       t        t        j                  t        j                  ddt        j                  ddt        j                  t        j                  g	      }|j                  dd	dd      }t	        j
                  ||       t        t        j                  t        j                  dt        j                  t        j                  t        j                  dddg	      }|j                  dd
      }t	        j
                  ||       t        t        j                  t        j                  dt        j                  t        j                  t        j                  ddt        j                  g	      }|j                  ddd      }t	        j
                  ||       t        t        j                  ddt        j                  t        j                  t        j                  ddt        j                  g	      }|j                  dddd      }t	        j
                  ||       t        dddt        j                  t        j                  t        j                  dt        j                  t        j                  g	      }|j                  ddd      }t	        j
                  ||       d}t        j                  t        |      5  |j                  dd
       d d d        y # 1 sw Y   y xY w)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   rK   rO   r7   r8   r9   r_   r`   ra   )r:   r   r   r   rc   s        r$   test_interp_limit_areaz0TestSeriesInterpolateData.test_interp_limit_area  s   BFFBFFArvvrvvrvvq"&&"&&QR2662663S#sBFFBFFSTh8D
vx0VVRVVS#rvvrvvsBFFBFFK
 h81M
vx02662663RVVS#rvvrvvVW&PQ  
 	vx02662663SRUVWh9E
vx0VVRVVS"&&"&&"&&#sBFFK
 h9AN
vx02663RVVRVVRVVS#rvvVW	6QR  
 	vx03S"&&"&&"&&#rvvrvvVW	:  
 	vx0 W]]:S1 	=MMeM<	= 	= 	=s   >QQ$zdata, kwargsrz   r   padr   r   r   r   r.   c                     t        |      }d}t        j                  t        |      5   |j                  di | d d d        y # 1 sw Y   y xY w)N#Can not interpolate with method=padr\   r   r   r_   r`   ra   r7   r:   datar#   r   rc   s        r$   test_interp_limit_area_with_padz9TestSeriesInterpolateData.test_interp_limit_area_with_pad  sG    @ 4L3]]:S1 	$AMM#F#	$ 	$ 	$   AAbfillc                     t        |      }d}t        j                  t        |      5   |j                  di | d d d        y # 1 sw Y   y xY w)Nz%Can not interpolate with method=bfillr\   r   r   r   s        r$   $test_interp_limit_area_with_backfillz>TestSeriesInterpolateData.test_interp_limit_area_with_backfill  sF    . 4L5]]:S1 	$AMM#F#	$ 	$ 	$r   c                 |   t        ddt        j                  t        j                  t        j                  dg      }t        ddt        j                  dddg      }|j                  d	d
d      }t	        j
                  ||       t        dddt        j                  ddg      }|j                  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      }|j                  d	d
d      }t	        j
                  ||       t        dddt        j                  dddddddg      }|j                  d	dd      }t	        j
                  ||       y )Nr   rz   rh   rp   rx   r   r   rl   r   r0   r   r   r   r   r   rF   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3RVVS#t<=haT
vx03S"&&#t<=haP
vx0 Aq"&&"&&"&&!QBFFSTUVhaP
vx0#sBFFCc4tTJ
 haP
vx0r&   c                 z   t        t        j                  t        j                  dddt        j                  g      }t        dddddt        j                  g      }|j                  ddd	
      }t	        j
                  ||       t        g d      }|j                  ddd
      }t	        j
                  ||       y )Nr.   r   rF   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_ends  s    BFFBFFAq!RVV453S#sBFF;<haT
vx089haP
vx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      }|j                  ddd      }t	        j
                  ||       t        t        j                  dddt        j                  t        j                  g      }|j                  ddd	      }t	        j
                  ||       t        t        j                  ddddt        j                  g      }|j                  ddd
      }t	        j
                  ||       y )Nr.   r   r   r   r   r   r   r   r   r   r   r   s       r$   test_interp_limit_before_endsz7TestSeriesInterpolateData.test_interp_limit_before_ends+  s    BFFBFFAq"&&"&&9:2662663S"&&ABhaS
vx02663S"&&"&&ABhaT
vx02663S#rvv>?haP
vx0r&   c                     t        j                  d       t        g d      }|j                  dd      }t	        j
                  ||       |j                         }t	        j
                  ||       y )Nrf   r   r0   rz   r   r   r   )r_   r{   r   r7   r8   r9   )r:   r   r   s      r$   test_interp_all_goodz.TestSeriesInterpolateData.test_interp_all_good;  sY    G$9l!<
vq) 
vq)r&   check_scipyFTc                    t        j                  g d      }t        ddt        j                  g|      }|j                         }d|j                  d<   |j                         }t        j                  ||       d}|r8t        j                  t        |      5  |j                  dd       d d d        y y # 1 sw Y   y xY w)	N))r   a)r   b)r0   cr   r0   rH   z?Only `method=linear` interpolation is supported on MultiIndexesr\   r   r   )r   from_tuplesr   rK   rO   r2   r~   r7   r8   r9   r_   r`   ra   )r:   r   idxr   r   r   rc   s          r$   test_interp_multiIndexz0TestSeriesInterpolateData.test_interp_multiIndexE  s     $$%CDAq"&&>-668Q
vx0Oz5 <\;< < < <s   B88Cc                     t        j                  d       t        dt        j                  dgg d      }d}t        j
                  t        |      5  |j                  d	       d d d        y # 1 sw Y   y xY w)
Nrf   r   rz   )r   r0   r   rH   z8krogh interpolation requires that the index be monotonicr\   r   rG   r_   r{   r   rK   rO   r`   ra   r7   r   s      r$   test_interp_nonmono_raisez3TestSeriesInterpolateData.test_interp_nonmono_raiseV  s\    G$Arvvq>3H]]:S1 	*MMM)	* 	* 	*s   A//A8r"   r   c                    t        j                  d       t        dt        j                  dgt        dd|            }|dk(  rD|j                  |      }t        g d	t        dd|            }t        j                  ||       y d
}t        j                  t        |      5  |j                  |       d d d        y # 1 sw Y   y xY w)Nrf   r   rz   1/1/2000r/   tzrH   r   rG   )rp   rp   rx   r   r\   )r_   r{   r   rK   rO   r   r7   r8   r9   r`   ra   )r:   r"   tz_naive_fixturedfr   r   rc   s          r$   test_interp_datetime64z0TestSeriesInterpolateData.test_interp_datetime64]  s    G$N*ZGW"X
 Y^^6^2F Q;KLH ""6847Cz5 .f-. . .s   &CCc                     t        ddd      }t        |      }t        j                  |d<   d}t	        j
                  t        |      5  |j                  d	       d d d        y # 1 sw Y   y xY w)
Nz
2015-04-05rz   z
US/Centralr  r   r   r\   r   rG   )r   r   r3   r4   r_   r`   ra   r7   )r:   dtir<   rc   s       r$   #test_interp_pad_datetime64tz_valuesz=TestSeriesInterpolateData.test_interp_pad_datetime64tz_valuesp  s\    q\BSkA3]]:S1 	*OO5O)	* 	* 	*s   
A&&A/c                 r    t        g d      }|j                  d      }|}t        j                  ||       y )Nrp   rt   rx   r   )r   )r   r7   r8   r9   r   s       r$   test_interp_limit_no_nansz3TestSeriesInterpolateData.test_interp_limit_no_nansz  s1    ?#Q'
vx0r&   r   c                     t        j                  d       t        ddt        j                  dg      }d}t        j
                  t        |      5  |j                  |       d d d        y # 1 sw Y   y xY w)Nrf   r   r   rz   z6You must specify the order of the spline or polynomialr\   rG   r  )r:   r"   r   rc   s       r$   test_no_orderz'TestSeriesInterpolateData.test_no_order  s_     	G$Aq"&&!$%F]]:S1 	)MMM(	) 	) 	)s   A,,A5r   g      r   c                     t        j                  d       t        ddt        j                  dg      }d}t        j
                  t        |      5  |j                  d|       d d d        y # 1 sw Y   y xY w)	Nrf   r   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_    G$Aq"&&!$%>]]:S1 	8MMM7	8 	8 	8s   A--A6c           	          t        j                  d       t        ddt        j                  ddt        j                  dg      }|j                  dd      }t        g d	      }t        j                  ||       y )
Nrf   r   r0   rD   r.   r   r   r   rp   rt   rx   r   r   r   r   r   r   s       r$   test_splinez%TestSeriesInterpolateData.test_spline  s^    G$Aq"&&!Q23ha8=>
vx0r&   c           	      f   t        j                  d       t        ddddt        j                  dt        j                  g      }|j                  ddd      }t        g d	      }t        j                  ||       |j                  ddd
      }t        g d      }t        j                  ||       y )Nrf   r   r0   rz   rD   rE   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    G$Aq!Q26623--xqa-@>?	
w	2--xqa-@>?	
w	2r&   c           	          t        j                  d       t        ddt        j                  ddt        j                  dg      }|j                  ddd	
      d   |j                  dd      d   k7  sJ y )Nrf   r   r0   rD   gffffff@r   r   rz   r   )r"   r   r   r.   r   )r_   r{   r   rK   rO   r7   )r:   r   s     r$   test_spline_smoothz,TestSeriesInterpolateData.test_spline_smooth  sl    G$Aq"&&!S"&&!45MMaM8;}}HA}6q9:	
:r&   c                 n   t        j                  d       t        t        j                  d      dz  d      }t        j
                  |t        j                  j                  d      j                  ddd      <   |j                  d	d
      }|j                  d	d
      }t        j                  ||       y )Nrf   rI   r0   rN   rB   r   rF   rz   r   r   r   )r_   r{   r   rK   rL   rO   r   r   integersr7   r8   r9   )r:   r   r!  r"  s       r$   test_spline_interpolationz3TestSeriesInterpolateData.test_spline_interpolation  s    G$299R=A%W58:"))


"
+
+Aq!
45--xq-9MMM;	
w	2r&   c                     t        dt        j                  dgt        j                  g d            }|j                  d      }t        g dt        j                  g d            }t        j                  ||       t        dt        j                  dgt        j                  g d            }|j                  d      }t        g d	t        j                  g d            }t        j                  ||       y )
Nr   rz   r   rH   rJ   rG   r  )r   r0   rD   )rp   g(%?rx   )r   rK   rO   r3   to_timedeltar7   r8   r9   )r:   r  r   r   s       r$   test_interp_timedelta64z1TestSeriesInterpolateData.test_interp_timedelta64  s    QN"//)*DEv./1KL
vx0 QN"//)*DEv..booi6PQ
vx0r&   c                 @   t        ddd      }t        t        j                  j	                  d      j                  t        |            |      }t        j                  |d d d<   |j                  d      }|j                         }t        j                  ||       y )	Nr
  z	1/20/2000r1   )freqr0   rH   r
   rG   )r   r   rK   r   r   r   rM   rO   r7   r8   r9   )r:   rngrS   r   exps        r$   %test_series_interpolate_method_valuesz?TestSeriesInterpolateData.test_series_interpolate_method_values  sw    [s;BII))!,<<SXFcR&&3Q3x0nn
vs+r&   c                 $   t        ddd      }t        g d|      }|j                  |t        j                  d      z         j                         }|j                  |      j                  d	      }t        ddd
      }t        g d|      }|j                  |t        j                  d      z         j                         }|j                  |      j                  d	      }t        j                  |j                  |j                         y )Nz1/1/2012rD   12D)r/   r-  )r   ri      $   r   )daysrJ   rG   12h)hours)r   r   appendr3   
DateOffsetsort_valuesr}   r7   r8   assert_numpy_array_equalr
   )r:   r	   rS   r   r/  r   s         r$    test_series_interpolate_intradayz:TestSeriesInterpolateData.test_series_interpolate_intraday  s    :qu=OU+LLA)>!>?KKM	jj#//v/>:qu=OU+LLQ)?!?@LLN	I&22&2A
##FMM3::>r&   ind)r   r  r  rV   z
2019-01-01rD   startr/   )r?  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                  ||       y d
| d}t	        j                  t        |      5   |d   j                  dd|i| d d d        y # 1 sw Y   y xY w)Nr   r   rz   rH   r   rf   r   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"   r   )r3   	DataFramerK   rO   r_   r{   r7   r   r8   r9   r`   ra   )	r:   r(   r=  r  r"   r#   r   r   expected_errors	            r$   test_interp_non_timedelta_indexz9TestSeriesInterpolateData.test_interp_non_timedelta_index  s     \\1a+37+W(X&RU&&00F2#FH""684 !!!  z@ ;!1!!::6:; ; ;s   +CCc                    t        j                  d       t        j                  dd      }t        j                  ddt
        j                  dg|      }|\  }}|dv r2|j                  t         j                  j                  | d	
              |d   j                  dd|i|}t        g dd|      }t        j                  ||       y)z
        Tests for non numerical index types  - object, period, timedelta
        Note that all methods except time, index, nearest and values
        are tested here.
        rf   r   rD   r>  r   rz   rH   >   r   r   z2 interpolation is not supported for TimedeltaIndexr+   r"   r   rB  Nr   )r_   r{   r3   timedelta_rangerD  rK   rO   applymarkermarkxfailr7   r   r8   r9   )	r:   r!   r(   r=  r  r"   r#   r   r   s	            r$    test_interpolate_timedelta_indexz:TestSeriesInterpolateData.test_interpolate_timedelta_index  s     	G$  q!4\\1a+37+&&!!$X%WX " 
 #A"";&;F;.QcB
vx0r&   zascending, expected_values)r   r0   rz   rF   rI   rI   rF   rz   r0   r   c                     t        ddt        j                  ddgg d      }|j                  |      j	                  d	      }t        ||t
        
      }t        j                  ||       y )NrI   rF   r0   r   rM  )r   r	   )	ascendingr	   rG   )r   r	   rC   )r   rK   rO   
sort_indexr7   rN   r8   r9   )r:   rO  expected_valuesrS   r   r   s         r$   test_interpolate_unsorted_indexz9TestSeriesInterpolateData.test_interpolate_unsorted_index  s\     "aA.6FG3??w?OoUS
vx0r&   c                     t        g dt              }d}t        j                  t        |      5  |j                  d       d d d        y # 1 sw Y   y xY w)N)r   Nr  rB   z&Can not interpolate with method=asfreqr\   asfreqrG   )r   r   r_   r`   ra   r7   )r:   r<   rc   s      r$   test_interpolate_asfreq_raisesz8TestSeriesInterpolateData.test_interpolate_asfreq_raises  sE    %V46]]:S1 	-OO8O,	- 	- 	-s   AAc                 4   t        j                  d       t        t        j                  ddt        j                  dt        j                  g      }|j                  dd      }t        t        j                  dddddg      }t        j                  ||       y )Nrf   r   r   rz   r   )r"   
fill_valuer   )r:   r<   r   r   s       r$   test_interpolate_fill_valuez5TestSeriesInterpolateData.test_interpolate_fill_value"  sp    G$bffaBFFArvv67	a@2661aAq12
vx0r&   )A__name__
__module____qualname__r_   rJ  rK  r@   rZ   rd   r   r   r   r   r   parametrizer   td
skip_if_nor   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rK   rO   ranger   r   r   r   r   r   r  r  r  r  r  r  r  r  r#  r%  r(  r+  r0  r<  r3   period_rangeinterval_rangerF  rL  rR  rU  rX  r   r&   r$   r*   r*   P   s   [[IJ	6 K	640.1
<4<< [[FLL'!4MBMM'<R	
;;<,) [[FLL'!4MBMM'<R	
11111"1H1 [[Wr1g.@ /@@ [[-6J/KL; M;
11B-=^ [[ BFFBFFBFFArvvrvvN 9
 BFFBFFBFFArvvrvvN 1E
 BFFBFFBFFArvvrvvN 	:
 BFFBFFBFFArvvrvvN 	AF
 H 	AF
 a 	AF+	
:$;:$ [[ BFFBFFBFFArvvrvvN"(;
 BFFBFFBFFArvvrvvN"(QG
 BFFBFFBFFArvvrvvN")<
 BFFBFFBFFArvvrvvN")aH	
*$+*$12
11 * [[|v||Dg8NOP<<* [[X	5'9:. ;.$*1 [[Xh'?@) A) [[Wr4C&@A8 B81	3
31	,? [[ BOO,:BA1-	
;;,1. [[$
 	!E+;#<=1	1-1r&   r*   )numpyrK   r_   pandas.util._test_decoratorsutil_test_decoratorsr]  pandasr3   r   r   r   r   r   pandas._testing_testingr8   fixturer%   r(   r*   r   r&   r$   <module>rj     sw      ) )    *	+*	 $	%$	X1 X1r&   