zoukankan      html  css  js  c++  java
  • pandas 时间序列分析(一)—— 基础

    0. 以时间作为序列的索引

    >> from datetime import datetime
    >> dates = [datetime(2011, 1, i) for i in [2, 5, 7, 8, 10, 12]]
    >> ts = pd.Series(np.random.randn(6), index=dates)
    >> ts
    2011-01-02   -1.157516
    2011-01-05    0.755876
    2011-01-07    0.299113
    2011-01-08    0.446367
    2011-01-10   -1.700069
    2011-01-12    0.261344
    dtype: float64

    进一步查看 ts 的成员:

    >> type(ts)
    pandas.core.series.Series
    >> ts.index
    ...
    >> ts.index.dtype
    dtype('<M8[ns]')            # 这是对于小端机的结果;
    
    >> ts.index[0]
    Timestamp('2011-01-02 00:00:00')
  • 相关阅读:
    对白
    泰芒了
    下雨
    聚会
    周末了
    One English Sentence
    Struts拦截器使用
    JAVA语法题
    jquery全选框的实现
    实战3--设计实体, 映射实体
  • 原文地址:https://www.cnblogs.com/mtcnn/p/9421721.html
Copyright © 2011-2022 走看看