Closed
Description
Hello,
interpolate
doesn't work with NaT
see http://stackoverflow.com/questions/33921795/fill-timestamp-nat-with-a-linear-interpolation/33922824#33922824
Here is a trivial example to show the situation:
s = pd.Series(pd.date_range('2015-01-01' , '2015-01-30'), name='t')
s[3], s[4], s[5] = pd.NaT, pd.NaT, pd.NaT
s[13], s[14], s[15] = pd.NaT, pd.NaT, pd.NaT
print(s)
0 2015-01-01
1 2015-01-02
2 2015-01-03
3 NaT
4 NaT
5 NaT
6 2015-01-07
7 2015-01-08
8 2015-01-09
9 2015-01-10
10 2015-01-11
11 2015-01-12
12 2015-01-13
13 NaT
14 NaT
15 NaT
16 2015-01-17
17 2015-01-18
18 2015-01-19
19 2015-01-20
20 2015-01-21
21 2015-01-22
22 2015-01-23
23 2015-01-24
24 2015-01-25
25 2015-01-26
26 2015-01-27
27 2015-01-28
28 2015-01-29
29 2015-01-30
Name: t, dtype: datetime64[ns]
print(s.interpolate())
0 2015-01-01
1 2015-01-02
2 2015-01-03
3 NaT
4 NaT
5 NaT
6 2015-01-07
7 2015-01-08
8 2015-01-09
9 2015-01-10
10 2015-01-11
11 2015-01-12
12 2015-01-13
13 NaT
14 NaT
15 NaT
16 2015-01-17
17 2015-01-18
18 2015-01-19
19 2015-01-20
20 2015-01-21
21 2015-01-22
22 2015-01-23
23 2015-01-24
24 2015-01-25
25 2015-01-26
26 2015-01-27
27 2015-01-28
28 2015-01-29
29 2015-01-30
Name: t, dtype: datetime64[ns]
assert s.interpolate().isnull().sum() == 0
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-150-8a59e397a174> in <module>()
----> 1 assert s.interpolate().isnull().sum() == 0
AssertionError:
Kind regards