U
    sVc{                     @   s   d dl Zd dlZd dlm  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ddddddd	d
dddddddddgddd Zejdddd	d
dddddddddgddd ZG dd dZdS )    N)Index
MultiIndexSeries
date_rangeisnalinearindexvaluesnearestslinearzero	quadraticcubicZbarycentrickrogh
polynomialsplinepiecewise_polynomialfrom_derivativespchipakimacubicspline)paramsc                 C   s"   | j }|dk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kwargs r!   P/tmp/pip-unpacked-wheel-xj8nt62q/pandas/tests/series/methods/test_interpolate.pynontemporal_method   s    r#   c                 C   s"   | j }|dk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   r!   r!   r"   interp_methods_ind2   s    r$   c                   @   s  e Zd Zdd Zdd Zejdd Zejdd Zejd	d
 Z	ejdd Z
ejdd Zejdi ejdddejdgdd Zdd Zdd Zejdi ejdddejdgdd Zdd Zdd Zejd d! Zejd"d# Zd$d% Zejd&d'd(gd)d* Zd+d, Zejd-d.d/gd0d1 Zd2d3 Zd4d5 Zd6d7 Zd8d9 Zd:d; Z ejd<d=d>d?d@dAdBdCdDgdEdF Z!ejdGe"j#e"j#dHe"j#e"j#e"j#dIe"j#e"j#g	e"j#e"j#dJdJdJdJdKe"j#e"j#g	dLdMdNfe"j#e"j#dHe"j#e"j#e"j#dIe"j#e"j#g	e"j#e"j#dJdJe"j#e"j#dKe"j#e"j#g	dLdMddOfe"j#e"j#dHe"j#e"j#e"j#dIe"j#e"j#g	e"j#e"j#dJe"j#e"j#e"j#dKdKdKg	dLdPdNfe"j#e"j#dHe"j#e"j#e"j#dIe"j#e"j#g	e"j#e"j#dJe"j#e"j#e"j#dKdKe"j#g	dLdPddO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dLdPddOfe$dQe$dQdLdPddOffdRdS Z%ejdGe"j#e"j#dHe"j#e"j#e"j#dIe"j#e"j#g	e"j#e"j#dJdKdKdKdKe"j#e"j#g	dTdMdNfe"j#e"j#dHe"j#e"j#e"j#dIe"j#e"j#g	e"j#e"j#dJe"j#e"j#dKdKe"j#e"j#g	dTdMddOfe"j#e"j#dHe"j#e"j#e"j#dIe"j#e"j#g	dJdJdJe"j#e"j#e"j#dKe"j#e"j#g	dTdPdNfe"j#e"j#dHe"j#e"j#e"j#dIe"j#e"j#g	e"j#dJdJe"j#e"j#e"j#dKe"j#e"j#g	dTdPddOffdUdV Z&dWdX Z'dYdZ Z(d[d\ Z)ejd]d^ Z*ejd_d`ejdaejdgdbdc Z+ejddde Z,ejejdfdgdLgdhdi Z-djdk Z.dldm Z/ejejdfddngdodp Z0ejejdqd'drd(dse"j#gdtdu Z1ejdvdw Z2ejdxdy Z3ejdzd{ Z4ejd|d} Z5d~d Z6dd Z7dd Z8ejdddddge9j:ddde9j;d(ddgdd Z<ejdd Z=ejddadddHddgfd`dddHddgfgdd Z>dd Z?d.S )TestSeriesInterpolateDatac                 C   s   t tjt|td|j}| }tj|dd< |jdd}t	
|| t dd |jD |jdt}| }tj|dd< |jd	d}t	
|| d S )
Ndtype   
   r   r   c                 S   s   g | ]}|  qS r!   )	toordinal).0dr!   r!   r"   
<listcomp>[   s     z>TestSeriesInterpolateData.test_interpolate.<locals>.<listcomp>r   time)r   nparangelenfloatr   copyNaNinterpolatetmassert_series_equalastype)selfZdatetime_seriestsZts_copyZlinear_interpZord_tsZord_ts_copyZtime_interpr!   r!   r"   test_interpolateQ   s     z*TestSeriesInterpolateData.test_interpolatec              	   C   s@   t dddtjg}d}tjt|d |jdd W 5 Q R X d S )Nr   r      zGtime-weighted interpolation only works on Series.* with a DatetimeIndexmatchr0   r*   )r   r1   r6   pytestraises
ValueErrorr7   )r;   Znon_tsmsgr!   r!   r"   /test_interpolate_time_raises_for_non_timeseriesd   s    zITestSeriesInterpolateData.test_interpolate_time_raises_for_non_timeseriesc                 C   s   t ddddg}t ddddd	d
dddg	tdddddddddg	d}|jtddddddgt}||jdddd }t	|| d S )Nr)                  &@     &@      '@     '@      (@     (@      )@     )@      *@      ?      ?      ?      ?       @      @      @      @      @r/   r   r*   r      
r   r   r   unionr:   r4   reindexr7   r8   r9   )r;   serexpected	new_indexresultr!   r!   r"   test_interpolate_cubicsplinel   s    z6TestSeriesInterpolateData.test_interpolate_cubicsplinec              	   C   s\   t ttjjdd}|jtddddddgt	}|
|jd	d
}|dd  d S )Nd   )sizeg     H@g     H@g     H@g      I@g     @I@g     `I@r   r*   1   3   )r   r1   sortrandomuniformr   r]   r   r:   r4   r^   r7   )r;   r_   ra   interp_sr!   r!   r"   test_interpolate_pchip|   s    z0TestSeriesInterpolateData.test_interpolate_pchipc                 C   s  t ddddg}t ddddd	d
dddg	tdddddddddg	d}|jtddddddgt}||jdd}t	|dd | t ddddd	ddddg	tdddddddddg	d}|jtddddddgt}||jddd}t	|dd | d S )Nr)   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r/   r   r*   r   r[   )r   Zderr\   r;   r_   r`   ra   rk   r!   r!   r"   test_interpolate_akima   s&    z0TestSeriesInterpolateData.test_interpolate_akimac                 C   s   t ddddg}t ddddd	d
dddg	tdddddddddg	d}|jtddddddgt}||jdd}t	|dd | d S )Nr)   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r/   r   r*   r   r[   r\   rm   r!   r!   r"   %test_interpolate_piecewise_polynomial   s    z?TestSeriesInterpolateData.test_interpolate_piecewise_polynomialc                 C   s   t ddddg}t ddddd	d
dddg	tdddddddddg	d}|jtddddddgt}||jdd}t	|dd | d S )Nr)   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r/   r   r*   r   r[   r\   rm   r!   r!   r"   !test_interpolate_from_derivatives   s    z;TestSeriesInterpolateData.test_interpolate_from_derivativesr    r   r   r   r   )Zmarksc                 C   sL   t tjtjg}t|jf || t g td }t|jf || d S )Nr&   )r   r1   nanr8   r9   r7   object)r;   r    sr!   r!   r"   test_interpolate_corners   s    
z2TestSeriesInterpolateData.test_interpolate_cornersc                 C   s   t tjttjdd}tjd|d d d< |jj	t
}|jdd}| }t|j}| }t t|| || |j| |j| d}t|| | |jdd}t|| t|| | d S )N   r/   r)   r[   r   r*   r	   )r   r1   rr   rh   ri   Zrandrandnr   r	   r:   r4   r7   r5   r   Zinterpr8   r9   )r;   rt   valsrb   r`   badZgoodZother_resultr!   r!   r"   test_interpolate_index_values   s    
 z7TestSeriesInterpolateData.test_interpolate_index_valuesc              	   C   sH   t ddtjtjtjdg}d}tjt|d |jdd W 5 Q R X d S )Nr   r[   rF   zStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexr?   r0   r*   r   r1   rr   rA   rB   rC   r7   r;   rt   rD   r!   r!   r"   test_interpolate_non_ts   s
    z1TestSeriesInterpolateData.test_interpolate_non_tsc                 C   s>   t ddtjdg}|jf |}t ddddg}t|| d S )Nr   r   r[           rR   rV   rZ   r   r1   rr   r7   r8   r9   )r;   r    rt   rb   r`   r!   r!   r"   test_nan_interpolate   s    
z.TestSeriesInterpolateData.test_nan_interpolatec                 C   sR   t ddtjdgddddgd}| }t dd	d
dgddddgd}t|| d S )Nr   r>      r[   r(   	   r/   rR   rV   rZ         @r   r;   rt   rb   r`   r!   r!   r"   test_nan_irregular_index  s    z2TestSeriesInterpolateData.test_nan_irregular_indexc                 C   sJ   t dddtjgtdd}| }t ddddgtdd}t|| d S )	Nr   r   r>   Zabcdr/   r~   rR   rV   )r   r1   rr   listr7   r8   r9   r   r!   r!   r"   test_nan_str_index  s    z,TestSeriesInterpolateData.test_nan_str_indexc                 C   sV   t ddtjdgddddgd}|jdd}t d	d
ddgddddgd}t|| d S )Nr   r      r>   r[   r/   r   r*   rR   r         "@g      0@r   )r;   sqrb   r`   r!   r!   r"   test_interp_quad  s    z*TestSeriesInterpolateData.test_interp_quadc                 C   sl  t ddtjdtjdg}t ddddd	d
g}|jdd}t|| |jddd}t|| t ddddddg}|jdd}t||d |jddd}t|| t ddddddg}|jdd}t||d |jddd}t|| t dddddd
g}|jdd}t|| |jddd}t|| t dddddd
g}|jdd}t|| d S )Nr   r[   rG      rR   rZ   g      @rM   g     2@g      9@r   r*   Zinfer)r   Zdowncastr
   r4   r   g:/KK@gL82@r   g333333@g3333332@r   )r   r1   rr   r7   r8   r9   r:   r;   rt   r`   rb   r!   r!   r"   test_interp_scipy_basic  s0    z1TestSeriesInterpolateData.test_interp_scipy_basicc                 C   sN   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|| d S )Nr   r[   rF   rR   rZ         @      @rI   r   r>   r   limitr   r   r!   r!   r"   test_interp_limit9  s    z+TestSeriesInterpolateData.test_interp_limitr   r   c              	   C   sN   t ddtjdg}|\}}tjtdd |jf ||d| W 5 Q R X d S )Nr   r>   r   zLimit must be greater than 0r?   r   r   r{   )r;   r#   r   rt   r   r    r!   r!   r"   *test_interpolate_invalid_nonpositive_limit@  s    zDTestSeriesInterpolateData.test_interpolate_invalid_nonpositive_limitc              	   C   sR   t ddtjdg}|\}}d}tjtdd |jf ||d| W 5 Q R X d S )Nr   r>   r   rV   zLimit must be an integerr?   r   r{   )r;   r#   rt   r   r    r   r!   r!   r"   $test_interpolate_invalid_float_limitH  s
    z>TestSeriesInterpolateData.test_interpolate_invalid_float_limitinvalid_methodNZnonexistent_methodc              	   C   sv   t ddtjdtjdg}d| d}tjt|d |j|d W 5 Q R X tjt|d |j|d	d
 W 5 Q R X d S )Nr   r[   rG   r   zmethod must be one of.* Got 'z	' insteadr?   r*   r   r   r{   )r;   r   rt   rD   r!   r!   r"   test_interp_invalid_methodP  s    z4TestSeriesInterpolateData.test_interp_invalid_methodc              	   C   sH   t ddtjdtjdg}d}tjt|d |jddd W 5 Q R X d S )	Nr   r[   rG   r   z&Cannot pass both fill_value and methodr?   pad)Z
fill_valuer   r{   )r;   r_   rD   r!   r!   r"   $test_interp_invalid_method_and_value]  s    z>TestSeriesInterpolateData.test_interp_invalid_method_and_valuec                 C   sl   t ddtjtjtjdg}t ddddtjdg}|jd	d
dd}t|| |jd	d
dd}t|| d S )Nr   r[   rF   rR   rZ   r   r   rI   r   r>   forwardr   r   limit_directionFORWARDr   r   r!   r!   r"   test_interp_limit_forwarde  s    z3TestSeriesInterpolateData.test_interp_limit_forwardc              	   C   s   t tjddtjtjtjdtjg}t ddddddddg}|jddd	}t|| t tjdddddddg}|jdd
d	}t|| t dddddddtjg}|jddd	}t|| d S )NrR   rZ   rI   r   r   r   r   bothr   r   r   backwardr   r   r!   r!   r"   test_interp_unlimitedq  s    "z/TestSeriesInterpolateData.test_interp_unlimitedc              	   C   st   t ddtjtjtjdg}d}tjt|d |jdddd	 W 5 Q R X tjt|d |jddd
 W 5 Q R X d S )Nr   r[   rF   zVInvalid limit_direction: expecting one of \['forward', 'backward', 'both'\], got 'abc'r?   r   r>   abcr   r   r{   r|   r!   r!   r"   test_interp_limit_bad_direction  s    z9TestSeriesInterpolateData.test_interp_limit_bad_directionc              
   C   s  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	d
}t|| t tjtjddtjtjdtjtjg	}|jdd	dd}t|| t tjtjddtjddtjtjg	}|jdd	ddd}t|| t tjtjdtjtjtjdddg	}|jddd
}t|| t tjtjdtjtjtjddtjg	}|jdddd}t|| t tjddtjtjtjddtjg	}|jddddd}t|| t dddtjtjtjdtjtjg	}|jdddd}t|| d}tjt|d |jddd
 W 5 Q R X d S )Nr[      rZ   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   r1   rr   r7   r8   r9   rA   rB   rC   )r;   rt   r`   rb   rD   r!   r!   r"   test_interp_limit_area  sV    (" $   $ $   $  z0TestSeriesInterpolateData.test_interp_limit_areaz!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              	   C   sL   t dddg}d| d| d}tjt|d |j||d W 5 Q R X d S )	Nr   r>   r[   z`limit_direction` must be 'z' for method ``r?   r   )r   rA   rB   rC   r7   )r;   r   r   r`   rt   rD   r!   r!   r"   "test_interp_limit_direction_raises  s    z<TestSeriesInterpolateData.test_interp_limit_direction_raiseszdata, expected_data, kwargsr[   r   rZ   r   r   r   r   r   r   r(   c                 C   s,   t |}t |}|jf |}t|| d S Nr   r7   r8   r9   r;   dataZexpected_datar    rt   r`   rb   r!   r!   r"   test_interp_limit_area_with_pad  s    &z9TestSeriesInterpolateData.test_interp_limit_area_with_padr   c                 C   s,   t |}t |}|jf |}t|| d S r   r   r   r!   r!   r"   $test_interp_limit_area_with_backfill  s    z>TestSeriesInterpolateData.test_interp_limit_area_with_backfillc                 C   s"  t ddtjtjtjdg}t ddtjdddg}|jd	d
dd}t|| t dddtjddg}|jd	ddd}t|| t ddtjtjtjddtjtjdtjg}t dddddddddddg}|jd	d
dd}t|| t dddtjdddddddg}|jd	ddd}t|| d S )Nr   r[   rF   rR   rZ   r   r   rI   r   r>   r   r   r   r   r   r   rG   r   r   g      $@rM   r   r   r!   r!   r"   test_interp_limit_direction  s     *z5TestSeriesInterpolateData.test_interp_limit_directionc                 C   s   t tjtjdddtjg}t dddddtjg}|jddd	d
}t|| t ddddddg}|jdddd
}t|| d S )Nr(   r   r   r   r   r   r   r>   r   r   r   r   r   r!   r!   r"   test_interp_limit_to_ends8  s    z3TestSeriesInterpolateData.test_interp_limit_to_endsc                 C   s   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d}t|| t tjdddtjtjg}|jddd	d}t|| t tjddddtjg}|jddd
d}t|| d S )Nr(   r   r   r   r   r   r   r   r   r   r   r   r!   r!   r"   test_interp_limit_before_endsD  s    z7TestSeriesInterpolateData.test_interp_limit_before_endsc                 C   s@   t dddg}|jddd}t|| | }t|| d S )Nr   r>   r[   r   rq   r   )r;   rt   rb   r!   r!   r"   test_interp_all_goodT  s
    z.TestSeriesInterpolateData.test_interp_all_goodcheck_scipyFTc              	   C   s~   t dddg}tddtjg|d}| }d|jd< | }t	|| d}|rzt
jt|d |jd	dd
 W 5 Q R X d S )N)r   a)r   b)r>   cr   r>   r/   z?Only `method=linear` interpolation is supported on MultiIndexesr?   r   rq   )r   from_tuplesr   r1   rr   r5   locr7   r8   r9   rA   rB   rC   )r;   r   idxrt   r`   rb   rD   r!   r!   r"   test_interp_multiIndex^  s    
z0TestSeriesInterpolateData.test_interp_multiIndexc              	   C   sH   t dtjdgdddgd}d}tjt|d |jdd	 W 5 Q R X d S )
Nr   r[   r   r>   r/   z8krogh interpolation requires that the index be monotonicr?   r   r*   r{   r|   r!   r!   r"   test_interp_nonmono_raiseo  s    z3TestSeriesInterpolateData.test_interp_nonmono_raiser   r
   c                 C   sV   t dtjdgtdd|dd}|j|d}t dddgtdd|dd}t|| d S )	Nr   r[   1/1/2000periodstzr/   r*   rR   rZ   )r   r1   rr   r   r7   r8   r9   )r;   r   Ztz_naive_fixturedfrb   r`   r!   r!   r"   test_interp_datetime64v  s    
 z0TestSeriesInterpolateData.test_interp_datetime64c                 C   sP   t dddd}t|}tj|d< |jdd}t|}|d |d< t|| d S )	Nz
2015-04-05r[   z
US/Centralr   r   r   r*   r   )r   r   pdZNaTr7   r8   r9   )r;   Zdtir_   rb   r`   r!   r!   r"   #test_interp_pad_datetime64tz_values  s    
z=TestSeriesInterpolateData.test_interp_pad_datetime64tz_valuesc                 C   s.   t dddg}|jdd}|}t|| d S )NrR   rV   rZ   r   )r   r   r   r!   r!   r"   test_interp_limit_no_nans  s    z3TestSeriesInterpolateData.test_interp_limit_no_nansr   c              	   C   s@   t ddtjdg}d}tjt|d |j|d W 5 Q R X d S )Nr   r   r[   z6You must specify the order of the spline or polynomialr?   r*   r{   )r;   r   rt   rD   r!   r!   r"   test_no_order  s    z'TestSeriesInterpolateData.test_no_orderr   g      r~   c              	   C   sB   t ddtjdg}d}tjt|d |jd|d W 5 Q R X d S )Nr   r   r[   z.order needs to be specified and greater than 0r?   r   rq   r{   )r;   r   rt   rD   r!   r!   r"   %test_interpolate_spline_invalid_order  s    z?TestSeriesInterpolateData.test_interpolate_spline_invalid_orderc                 C   sN   t ddtjddtjdg}|jddd}t dd	d
ddddg}t|| d S )Nr   r>   r   r(   r   r   rq   rR   rV   rZ   r   r   r   r   r   r   r!   r!   r"   test_spline  s    z%TestSeriesInterpolateData.test_splinec                 C   s   t ddddtjdtjg}|jdddd}t dd	d
ddddg}t|| |jdddd}t dd	d
ddddg}t|| d S )Nr   r>   r[   r      r   )r   r   extrR   rV   rZ   r   r   r   r   r   r   )r;   rt   Zresult3Z	expected3result1	expected1r!   r!   r"   test_spline_extrapolate  s    z1TestSeriesInterpolateData.test_spline_extrapolatec                 C   sH   t ddtjddtjdg}|jdddd	d
 |jdddd
 ksDtd S )Nr   r>   r   gffffff@r   r   r[   r   )r   r   rt   r(   rq   )r   r1   rr   r7   AssertionError)r;   rt   r!   r!   r"   test_spline_smooth  s
    z,TestSeriesInterpolateData.test_spline_smoothc                 C   sT   t tdd }tj|tjddd< |jddd}|jddd}t|| d S )	Nr)   r>   r   r   r[   r   r   rq   )	r   r1   r2   rr   ri   randintr7   r8   r9   )r;   rt   r   r   r!   r!   r"   test_spline_interpolation  s
    z3TestSeriesInterpolateData.test_spline_interpolationc                 C   s   t dtjdgtdddgd}|jdd}t ddd	gtdddgd}t|| t dtjdgtddd
gd}|jdd}t ddd	gtddd
gd}t|| d S )Nr   r[   r>   r/   r0   r*   rR   rV   rZ   r   g(%?)r   r1   rr   r   Zto_timedeltar7   r8   r9   )r;   r   rb   r`   r!   r!   r"   test_interp_timedelta64  s      z1TestSeriesInterpolateData.test_interp_timedelta64c                 C   sZ   t dddd}ttjt||d}tj|d d d< |jdd}| }t	|| d S )	Nr   z	1/20/2000D)freqr/   r>   r	   r*   )
r   r   r1   ri   rw   r3   rr   r7   r8   r9   )r;   rngr<   rb   expr!   r!   r"   %test_series_interpolate_method_values  s    z?TestSeriesInterpolateData.test_series_interpolate_method_valuesc                 C   s   t dddd}tddddg|}||tjd	d
  }||jdd}t dddd}tddddg|}||tjd	d  }||jdd}t	|j
|j
 d S )Nz1/1/2012r   Z12D)r   r   r   rG      $   r   )daysr0   r*   Z12H)hours)r   r   appendr   Z
DateOffsetZsort_valuesr^   r7   r8   Zassert_numpy_array_equalr	   )r;   r   r<   ra   r   rb   r!   r!   r"    test_series_interpolate_intraday  s    z:TestSeriesInterpolateData.test_series_interpolate_intradayindr   r   r   r-   z
2019-01-01r   startr   )r   endc           	   	   C   s   t jddtjdg|d}|\}}|dkr2td |dkrn|d jf |}tdd	d
dgd|d}t	|| n>d| d}tj
t|d |d jf d|i| W 5 Q R X d S )Nr   r   r[   r/   r   Zscipyr   r~   rR   rV   rZ   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   	DataFramer1   rr   rA   Zimportorskipr7   r   r8   r9   rB   rC   )	r;   r$   r   r   r   r    rb   r`   Zexpected_errorr!   r!   r"   test_interp_non_timedelta_index  s    


z9TestSeriesInterpolateData.test_interp_non_timedelta_indexc           	      C   s   t jddd}t jddtjdg|d}|\}}|dkrR|jtjj	| dd	 |d j
f d
|i|}tddddgd|d}t|| 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   r   r   r[   r/   >   r   r   z2 interpolation is not supported for TimedeltaIndex)reasonr   r~   rR   rV   rZ   r   N)r   Ztimedelta_ranger   r1   rr   nodeZ
add_markerrA   markZxfailr7   r   r8   r9   )	r;   r   r$   r   r   r   r    rb   r`   r!   r!   r"    test_interpolate_timedelta_index  s    z:TestSeriesInterpolateData.test_interpolate_timedelta_indexzascending, expected_valuesr>   r   r)   c                 C   sT   t ddtjddgdddddgd}|j|djdd	}t ||td
}t|| d S )Nr)   r   r>   r   r[   )r   r   )	ascendingr   r*   )r   r   r'   )r   r1   rr   Z
sort_indexr7   r4   r8   r9   )r;   r   Zexpected_valuesr<   rb   r`   r!   r!   r"   test_interpolate_unsorted_index$  s    "z9TestSeriesInterpolateData.test_interpolate_unsorted_indexc              	   C   sV   t dddg}d}tjt|d |dd}W 5 Q R X t dddg}t|| d S )Nr   r>   r[   zwIn a future version of pandas all arguments of Series.interpolate except for the argument 'method' will be keyword-onlyr?   r   r   )r   r8   Zassert_produces_warningFutureWarningr7   r9   )r;   r_   rD   rb   r`   r!   r!   r"   %test_interpolate_pos_args_deprecation/  s    z?TestSeriesInterpolateData.test_interpolate_pos_args_deprecation)@__name__
__module____qualname__r=   rE   tdZskip_if_no_scipyrc   rl   rn   ro   rp   rA   r   Zparametrizer   ru   rz   r}   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r1   rr   ranger   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Zperiod_rangeZinterval_ranger   r   r   r   r!   r!   r!   r"   r%   P   sH  




 	
	 	


$

/
"" 
"" 


#
"" 
"" 


	 









"
r%   )Znumpyr1   rA   Zpandas.util._test_decoratorsutilZ_test_decoratorsr   Zpandasr   r   r   r   r   r   Zpandas._testingZ_testingr8   Zfixturer#   r$   r%   r!   r!   r!   r"   <module>   sZ   

