-
StackOverflow 文档
-
pandas 教程
-
系列
-
系列与日期时间
import pandas as pd
import numpy as np
np.random.seed(0)
rng = pd.date_range('2015-02-24', periods=5, freq='T')
s = pd.Series(np.random.randn(len(rng)), index=rng)
print (s)
2015-02-24 00:00:00 1.764052
2015-02-24 00:01:00 0.400157
2015-02-24 00:02:00 0.978738
2015-02-24 00:03:00 2.240893
2015-02-24 00:04:00 1.867558
Freq: T, dtype: float64
rng = pd.date_range('2015-02-24', periods=5, freq='T')
s1 = pd.Series(rng)
print (s1)
0 2015-02-24 00:00:00
1 2015-02-24 00:01:00
2 2015-02-24 00:02:00
3 2015-02-24 00:03:00
4 2015-02-24 00:04:00
dtype: datetime64[ns]