Pandas 重新采样更改日期

Pandas resample changes dates

为什么 df.resample() 在我重新采样时更改日期?

X

我想要做的是插入一行,索引为“2014-07-01”,值为 NaN。

X.resample('12M').last()

`

试试 MS

out = df.resample('12MS').first()
Out[33]: 
              0
2014-07-01  1.0
2015-07-01  NaN
2016-07-01  2.0
2017-07-01  3.0