U
    *ifa|                     @   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 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)Versionlinearindexvaluesnearestslinearzero	quadraticcubic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#   _/home/mars/bis/venv/lib/python3.8/site-packages/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_ind3   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_seriesZstring_seriestsZts_copyZlinear_interpZord_tsZord_ts_copyZtime_interpr#   r#   r$   test_interpolateR   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matchr2   r,   )r   r3   r8   pytestraises
ValueErrorr9   )r=   Znon_tsmsgr#   r#   r$   /test_interpolate_time_raises_for_non_timeseriese   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+                  &@     &@      '@     '@      (@     (@      )@     )@      *@      ?      ?      ?      ?       @      @      @      @      @r1   r   r,   r      
r   r   r	   unionr<   r6   reindexr9   r:   r;   )r=   serexpected	new_indexresultr#   r#   r$   test_interpolate_cubicsplinem   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   r3   sortrandomuniformr	   r_   r   r<   r6   r`   r9   )r=   ra   rc   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+   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r1   r   r,   r   r]   )r!   Zderr^   r=   ra   rb   rc   rm   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+   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r1   r   r,   r   r]   r^   ro   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+   rH   rI   rJ   rK   rL   rM   rN   rO   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r1   r   r,   r   r]   r^   ro   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   r3   nanr:   r;   r9   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   r1   r+   r]   r	   r,   r
   )r   r3   rt   rj   rk   Zrandrandnr	   r
   r<   r6   r9   r7   r   Zinterpr:   r;   )r=   rv   valsrd   rb   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]   rH   zStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexrA   r2   r,   r   r3   rt   rC   rD   rE   r9   r=   rv   rF   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]           rT   rX   r\   r   r3   rt   r9   r:   r;   )r=   r"   rv   rd   rb   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*   	   r1   rT   rX   r\         @r   r=   rv   rd   rb   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@   abcdr1   r   rT   rX   )r   r3   rt   listr9   r:   r;   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]   r1   r   r,   rT   r         "@g      0@r   )r=   sqrd   rb   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]   rI      rT   r\   g      @rO   g     2@g      9@r   r,   Zinfer)r!   Zdowncastr   r6   r   g:/KK@gL82@r   g333333@g3333332@r   )r   r3   rt   r9   r:   r;   r<   r=   rv   rb   rd   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]   rH   rT   r\         @      @rK   r   r@   r!   limitr   r   r#   r#   r$   test_interp_limit:  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 0rA   r   r!   r}   )r=   r%   r   rv   r!   r"   r#   r#   r$   *test_interpolate_invalid_nonpositive_limitA  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   rX   zLimit must be an integerrA   r   r}   )r=   r%   rv   r!   r"   r   r#   r#   r$   $test_interpolate_invalid_float_limitI  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]   rI   r   zmethod must be one of.* Got 'z	' insteadrA   r,   r   r   r}   )r=   r   rv   rF   r#   r#   r$   test_interp_invalid_methodQ  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]   rI   r   z&Cannot pass both fill_value and methodrA   pad)Z
fill_valuer!   r}   )r=   ra   rF   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]   rH   rT   r\   r   r   rK   r   r@   forwardr!   r   limit_directionZFORWARDr   r   r#   r#   r$   test_interp_limit_forwardf  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 )NrT   r\   rK   r   r   r   r   bothr!   r   r   backwardr   r   r#   r#   r$   test_interp_unlimitedr  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]   rH   zVInvalid limit_direction: expecting one of \['forward', 'backward', 'both'\], got 'abc'rA   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]      r\   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 abcrA   r   )	r   r3   rt   r9   r:   r;   rC   rD   rE   )r=   rv   rb   rd   rF   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 ``rA   r   )r   rC   rD   rE   r9   )r=   r!   r   rb   rv   rF   r#   r#   r$   "test_interp_limit_direction_raises  s    z<TestSeriesInterpolateData.test_interp_limit_direction_raiseszdata, expected_data, kwargsr]   r   r\   r   r   r   r   r   r   r*   c                 C   s,   t |}t |}|jf |}t|| d S Nr   r9   r:   r;   r=   dataZexpected_datar"   rv   rb   rd   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]   rH   rT   r\   r   r   rK   r   r@   r   r   r   r   r   r   rI   r   r   g      $@rO   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_ends9  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_endsE  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   rs   r   )r=   rv   rd   r#   r#   r$   test_interp_all_goodU  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@   r1   z?Only `method=linear` interpolation is supported on MultiIndexesrA   r   rs   )r   from_tuplesr   r3   rt   r7   locr9   r:   r;   rC   rD   rE   )r=   r   idxrv   rb   rd   rF   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@   r1   z8krogh interpolation requires that the index be monotonicrA   r   r,   r}   r~   r#   r#   r$   test_interp_nonmono_raisep  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tzr1   r,   rT   r\   )r   r3   rt   r   r9   r:   r;   )r=   r!   Ztz_naive_fixturedfrd   rb   r#   r#   r$   test_interp_datetime64w  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NaTr9   r:   r;   )r=   Zdtira   rd   rb   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 )NrT   rX   r\   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 polynomialrA   r,   r}   )r=   r!   rv   rF   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 0rA   r   rs   r}   )r=   r   rv   rF   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   rs   rT   rX   r\   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   extrT   rX   r\   r   r   r   r   r   r   )r=   rv   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   rv   r*   rs   )r   r3   rt   r9   AssertionError)r=   rv   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   rs   )	r   r3   r4   rt   rk   randintr9   r:   r;   )r=   rv   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@   r1   r2   r,   rT   rX   r\   r   g(%?)r   r3   rt   r   Zto_timedeltar9   r:   r;   )r=   r   rd   rb   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)freqr1   r@   r
   r,   )
r   r   r3   rk   ry   r5   rt   r9   r:   r;   )r=   rngr>   rd   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   rI      $   r   )daysr2   r,   Z12H)hours)r   r   appendr   Z
DateOffsetZsort_valuesr`   r9   r:   Zassert_numpy_array_equalr
   )r=   r	   r>   rc   r   rd   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]   r1   r   scipyr   r   rT   rX   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.rA   r!   )r   	DataFramer3   rt   rC   Zimportorskipr9   r   r:   r;   rD   rE   )	r=   r&   r   r   r!   r"   rd   rb   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dl}|dksX|d	krtt|jtd
k rt|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]   r1   N>   r   r   r   z1.5.0z2 interpolation is not supported for TimedeltaIndex)reasonr!   r   rT   rX   r\   r   )r   Ztimedelta_ranger   r3   rt   r   r   __version__nodeZ
add_markerrC   markZxfailr9   r   r:   r;   )
r=   r    r&   r   r   r!   r"   r   rd   rb   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   r3   rt   Z
sort_indexr9   r6   r:   r;   )r=   r   Zexpected_valuesr>   rd   rb   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-onlyrA   r   r   )r   r:   Zassert_produces_warningFutureWarningr9   r;   )r=   ra   rF   rd   rb   r#   r#   r$   %test_interpolate_pos_args_deprecation3  s    z?TestSeriesInterpolateData.test_interpolate_pos_args_deprecation)@__name__
__module____qualname__r?   rG   tdZskip_if_no_scipyre   rn   rp   rq   rr   rC   r   Zparametrizer   rw   r|   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r3   rt   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'   Q   sH  




 	
	 	


$

/
"" 
"" 


#
"" 
"" 


	 









"
r'   )numpyr3   rC   Zpandas.util._test_decoratorsutilZ_test_decoratorsr   Zpandasr   r   r   r   r   r   Zpandas._testingZ_testingr:   Zpandas.util.versionr   Zfixturer%   r&   r'   r#   r#   r#   r$   <module>   s\   

