series.py 460 字节
Newer Older
F
feilong 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
# -*- coding: UTF-8 -*-
# 作者:幻灰龙
# 标题:pandas Series
# 描述:打印 cos 函数 0-3.14 区间内,步长 3.14/1000 的数值序列

import pandas as pd
import math

if __name__ == '__main__':
    d = {}
    count = 1000
    step = 3.14/1000
    index = []
    for i in range(0, count):
        x = i*step
        y = math.cos(x)
        index.append(x)
        d[x] = y

    ser = pd.Series(data=d, index=index, dtype=float)
    print(ser)