In [22]: ts
Out[22]:
<class 'pandas.tseries.index.DatetimeIndex'>
[NaT, ..., 2012-12-31 00:00:00]
Length: 11, Freq: None, Timezone: None
In [23]: ts.year
Out[23]: array([ -1, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012, 2012])
使用 apply 时也会发生这种情况
ts.apply(lambda x: pd.Timestamp(x).year)
0 -1
1 2012
2 2012
3 2012
4 2012
5 2012
6 2012
7 2012
8 2012
9 2012
10 2012
Name: Dates
NaT.year == -1 是一个错误吗?