U
    >vf{                     @   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-vdrwu74i/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ejjddd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/d0 Zejd1d2d3gd4d5 Zd6d7 Zd8d9 Zd:d; Z d<d= Z!d>d? Z"ejd@dAdBdCdDdEdFdGdHgdIdJ Z#ejdKe$j%e$j%dLe$j%e$j%e$j%dMe$j%e$j%g	e$j%e$j%dNdNdNdNdOe$j%e$j%g	dPdQdRfe$j%e$j%dLe$j%e$j%e$j%dMe$j%e$j%g	e$j%e$j%dNdNe$j%e$j%dOe$j%e$j%g	dPdQddSfe$j%e$j%dLe$j%e$j%e$j%dMe$j%e$j%g	e$j%e$j%dNe$j%e$j%e$j%dOdOdOg	dPdTdRfe$j%e$j%dLe$j%e$j%e$j%dMe$j%e$j%g	e$j%e$j%dNe$j%e$j%e$j%dOdOe$j%g	dPdTddS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dPdTddSfe&dUe&dUdPdTddSffdVdW Z'ejdKe$j%e$j%dLe$j%e$j%e$j%dMe$j%e$j%g	e$j%e$j%dNdOdOdOdOe$j%e$j%g	dXdQdRfe$j%e$j%dLe$j%e$j%e$j%dMe$j%e$j%g	e$j%e$j%dNe$j%e$j%dOdOe$j%e$j%g	dXdQddSfe$j%e$j%dLe$j%e$j%e$j%dMe$j%e$j%g	dNdNdNe$j%e$j%e$j%dOe$j%e$j%g	dXdTdRfe$j%e$j%dLe$j%e$j%e$j%dMe$j%e$j%g	e$j%dNdNe$j%e$j%e$j%dOe$j%e$j%g	dXdTddSffdYdZ Z(d[d\ Z)d]d^ Z*d_d` Z+e	j
dadb Z,ejdcddejdee	j
dgdfdg Z-e	j
dhdi Z.e	j
ejdjdkdPgdldm Z/dndo Z0dpdq Z1e	j
ejdjddrgdsdt Z2e	j
ejdud+dvd,dwe$j%gdxdy Z3e	j
dzd{ Z4e	j
d|d} Z5e	j
d~d Z6e	j
dd Z7dd Z8dd Z9dd Z:ejdddddge;j<ddde;j=d,ddgdd Z>e	j
dd Z?ejddedddLddgfdddddLddgfgdd Z@d2S )TestSeriesInterpolateDataz)EA.fillna does not handle 'linear' methodreasonc                 C   sR   t tddd}| }tj|d< |jd}| }|jd}t	|| d S )Nz
2012-01-01   )periods   D)
r   r   copypdNaTdtZ	to_periodinterpolatetmassert_series_equal)selforigserZser_perZres_perZexpected_perr!   r!   r"   test_interpolate_period_valuesQ   s    
z8TestSeriesInterpolateData.test_interpolate_period_valuesc                 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dtyper(   
   r   r   c                 S   s   g | ]}|  qS r!   )	toordinal).0dr!   r!   r"   
<listcomp>g   s     z>TestSeriesInterpolateData.test_interpolate.<locals>.<listcomp>r   time)r   nparangelenfloatr   r,   NaNr0   r1   r2   astype)r3   Zdatetime_seriestsZts_copyZlinear_interpZord_tsZord_ts_copyZtime_interpr!   r!   r"   test_interpolate]   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   r*   zGtime-weighted interpolation only works on Series.* with a DatetimeIndexmatchr@   r:   )r   rA   rE   pytestraises
ValueErrorr0   )r3   Znon_tsmsgr!   r!   r"   /test_interpolate_time_raises_for_non_timeseriesp   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 )Nr9                  &@     &@      '@     '@      (@     (@      )@     )@      *@      ?      ?      ?      ?       @      @      @      @      @r?   r   r:   r      
r   r   r   unionrF   rD   reindexr0   r1   r2   )r3   r5   expected	new_indexresultr!   r!   r"   test_interpolate_cubicsplinex   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   rA   sortrandomuniformr   rg   r   rF   rD   rh   r0   )r3   r5   rj   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 )Nr9   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   r?   r   r:   r   re   )r   Zderrf   r3   r5   ri   rj   rt   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 )Nr9   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   r?   r   r:   r   re   rf   rv   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 )Nr9   rP   rQ   rR   rS   rT   rU   rV   rW   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   r?   r   r:   r   re   rf   rv   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 )Nr7   )r   rA   nanr1   r2   r0   object)r3   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?   r9   re   r   r:   r	   )r   rA   r{   rq   rr   Zrandrandnr   r	   rF   rD   r0   r,   r   Zinterpr1   r2   )r3   r}   valsrk   ri   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   re   rP   zStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexrI   r@   r:   r   rA   r{   rK   rL   rM   r0   r3   r}   rN   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   re           r\   r`   rd   r   rA   r{   r0   r1   r2   )r3   r    r}   rk   ri   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*      re   r(   	   r?   r\   r`   rd         @r   r3   r}   rk   ri   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   r\   r`   )r   rA   r{   listr0   r1   r2   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*   re   r?   r   r:   r\   r         "@g      0@r   )r3   sqrk   ri   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   re   rQ      r\   rd   g      @rW   g     2@g      9@r   r:   Zinfer)r   Zdowncastr
   rD   r   g:/KK@gL82@r   g333333@g3333332@r   )r   rA   r{   r0   r1   r2   rF   r3   r}   ri   rk   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   re   rP   r\   rd         @      @rS   r   r*   r   limitr   r   r!   r!   r"   test_interp_limitB  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 0rI   r   r   r   )r3   r#   r   r}   r   r    r!   r!   r"   *test_interpolate_invalid_nonpositive_limitI  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   r`   zLimit must be an integerrI   r   r   )r3   r#   r}   r   r    r   r!   r!   r"   $test_interpolate_invalid_float_limitQ  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   re   rQ   r   zmethod must be one of.* Got 'z	' insteadrI   r:   r   r   r   )r3   r   r}   rN   r!   r!   r"   test_interp_invalid_methodY  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   re   rQ   r   z&Cannot pass both fill_value and methodrI   pad)Z
fill_valuer   r   )r3   r5   rN   r!   r!   r"   $test_interp_invalid_method_and_valuef  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   re   rP   r\   rd   r   r   rS   r   r*   forwardr   r   limit_directionFORWARDr   r   r!   r!   r"   test_interp_limit_forwardn  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 )Nr\   rd   rS   r   r   r   r   bothr   r   r   backwardr   r   r!   r!   r"   test_interp_unlimitedz  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   re   rP   zVInvalid limit_direction: expecting one of \['forward', 'backward', 'both'\], got 'abc'rI   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 )Nre      rd   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 abcrI   r   )	r   rA   r{   r0   r1   r2   rK   rL   rM   )r3   r}   ri   rk   rN   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*   re   z`limit_direction` must be 'z' for method ``rI   r   )r   rK   rL   rM   r0   )r3   r   r   ri   r}   rN   r!   r!   r"   "test_interp_limit_direction_raises  s    z<TestSeriesInterpolateData.test_interp_limit_direction_raiseszdata, expected_data, kwargsre   r   rd   r   r   r   r   r   r   r(   c                 C   s,   t |}t |}|jf |}t|| d S Nr   r0   r1   r2   r3   dataZexpected_datar    r}   ri   rk   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   re   rP   r\   rd   r   r   rS   r   r*   r   r   r   r   r   r   rQ   r   r   g      $@rW   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_endsA  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_endsM  s    z7TestSeriesInterpolateData.test_interp_limit_before_endsc                 C   s@   t dddg}|jddd}t|| | }t|| d S )Nr   r*   re   r   rz   r   )r3   r}   rk   r!   r!   r"   test_interp_all_good]  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 MultiIndexesrI   r   rz   )r   from_tuplesr   rA   r{   r,   locr0   r1   r2   rK   rL   rM   )r3   r   idxr}   ri   rk   rN   r!   r!   r"   test_interp_multiIndexg  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   re   r   r*   r?   z8krogh interpolation requires that the index be monotonicrI   r   r:   r   r   r!   r!   r"   test_interp_nonmono_raisex  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   re   1/1/2000r)   tzr?   r:   r\   rd   )r   rA   r{   r   r0   r1   r2   )r3   r   Ztz_naive_fixturedfrk   ri   r!   r!   r"   test_interp_datetime64  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-05re   z
US/Centralr   r   r   r:   r   )r   r   r-   r.   r0   r1   r2   )r3   Zdtir5   rk   ri   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 )Nr\   r`   rd   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   re   z6You must specify the order of the spline or polynomialrI   r:   r   )r3   r   r}   rN   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   re   z.order needs to be specified and greater than 0rI   r   rz   r   )r3   r   r}   rN   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   rz   r\   r`   rd   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*   re   r      r   )r   r   extr\   r`   rd   r   r   r   r   r   r   )r3   r}   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   re   r   )r   r   r}   r(   rz   )r   rA   r{   r0   AssertionError)r3   r}   r!   r!   r"   test_spline_smooth  s
    z,TestSeriesInterpolateData.test_spline_smoothc                 C   sX   t tdd dd}tj|tjddd< |jdd	d
}|jdd	d
}t|| d S )Nr9   r*   rD   r7   r   r   re   r   r   rz   )	r   rA   rB   r{   rr   randintr0   r1   r2   )r3   r}   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   re   r*   r?   r@   r:   r\   r`   rd   r   g(%?)r   rA   r{   r-   Zto_timedeltar0   r1   r2   )r3   r   rk   ri   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/2000r+   )freqr?   r*   r	   r:   )
r   r   rA   rr   r   rC   r{   r0   r1   r2   )r3   rngrG   rk   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   rQ      $   r   )daysr@   r:   Z12H)hours)r   r   appendr-   Z
DateOffsetZsort_valuesrh   r0   r1   Zassert_numpy_array_equalr	   )r3   r   rG   rj   r   rk   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   re   r?   r   Zscipyr   r   r\   r`   rd   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.rI   r   )r-   	DataFramerA   r{   rK   Zimportorskipr0   r   r1   r2   rL   rM   )	r3   r$   r   r   r   r    rk   ri   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   re   r?   >   r   r   z2 interpolation is not supported for TimedeltaIndexr&   r   r   r\   r`   rd   r   N)r-   Ztimedelta_ranger   rA   r{   nodeZ
add_markerrK   markxfailr0   r   r1   r2   )	r3   r   r$   r   r   r   r    rk   ri   r!   r!   r"    test_interpolate_timedelta_index  s    z:TestSeriesInterpolateData.test_interpolate_timedelta_indexzascending, expected_valuesr*   r   r9   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 )Nr9   r   r*   r   re   )r   r   )	ascendingr   r:   )r   r   r8   )r   rA   r{   Z
sort_indexr0   rD   r1   r2   )r3   r   Zexpected_valuesrG   rk   ri   r!   r!   r"   test_interpolate_unsorted_index.  s    "z9TestSeriesInterpolateData.test_interpolate_unsorted_index)A__name__
__module____qualname__rK   r   r   r6   rH   rO   tdZskip_if_no_scipyrl   ru   rw   rx   ry   Zparametrizer   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rA   r{   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%   P   sJ  





 	
	 	


$

/
"" 
"" 


#
"" 
"" 


	 




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