A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/11312 below:

interpolation of datetime values (NaT) · Issue #11312 · pandas-dev/pandas · GitHub

I didn't directly found an open issue about it, but is there a reason we do not implement interpolation of datetime values (so not in the index)?

Example:

In [14]: s = pd.Series(pd.date_range('2012-01-01', periods=5))

In [16]: s[2] = np.nan

In [17]: s
Out[17]:
0   2012-01-01
1   2012-01-02
2          NaT
3   2012-01-04
4   2012-01-05
dtype: datetime64[ns]

In [18]: s.interpolate()
Out[18]:
0   2012-01-01
1   2012-01-02
2          NaT
3   2012-01-04
4   2012-01-05
dtype: datetime64[ns]

A crude manual work around:

In [20]: s2 = pd.Series(s.values.astype('int64'))

In [21]: s2[s2<0] = np.nan

In [22]: s2
Out[22]:
0    1.325376e+18
1    1.325462e+18
2             NaN
3    1.325635e+18
4    1.325722e+18
dtype: float64

In [23]: pd.to_datetime(s2.interpolate(), unit='ns')
Out[23]:
0   2012-01-01
1   2012-01-02
2   2012-01-03
3   2012-01-04
4   2012-01-05
dtype: datetime64[ns]

altaurog, nirvana-msu, dhaitz, nielsuit227 and merillium


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4