date,jz0,jz1,jz2,jz3,jz4,jz52012-12-28,0.9326,0.8835,1.0289,1.0027,1.1067,1.00232012-12-31,0.9435,0.8945,1.0435,1.0031,1.1229,1.00272013-01-04,0.9403,0.8898,1.0385,1.0032,1.1183,1.0030... ...
# -*- coding: utf-8 -*-import os, sysif len(sys.argv) ==2: i = sys.argv[1]else: print 'usage: pd_roll_mean1.py i ' sys.exit(1) import pandas as pd# dataFrame 第6章 数据加载 读写文本格式的数据 第167页df = pd.read_csv('/python/66001_.txt', parse_dates=True, index_col=0 ) df.head() # 预览前5行数据df.describe() # 数据基本统计量 import matplotlib.pyplot as plt# 加这个两句 可以显示中文plt.rcParams['font.sans-serif'] = [u'SimHei']plt.rcParams['axes.unicode_minus'] = False jz = 'jz'+str(i)df[jz].plot(figsize=(12,6), grid=True, legend=jz, label='66001'+str(i)) # 画30日移动平均线 pd.rolling_mean(df[jz], 30).plot(grid=True)plt.show()