1,``导包连接python
from sys import dont_write_bytecode
import numpy as np
import datetime as dt
import matplotlib.dates as md #日期包
import matplotlib.pyplot as plt
from numpy.core.numeric import full
#时间转换的函数
def conver_data(datas):
#把时间转换成字符串类型
s_data = str(datas,encoding="utf-8")
#取出前后多余的空格,回车符 去空
da = dt.datetime.strptime(s_data,"%Y/%m/%d")
#修改日期的格式 "%Y%m%d"-----"%Y-%m-%d
format_data = da.strftime("%Y-%m-%d")
return format_data
#filePath = "E:\\桌面\\BABA.csv"
"""
converters={列:函数} 把需要的列放到函数中进行加工
M8:日期格式,D代表整数类型
f8:(flot64)
i1(int8) i2(int6) i4(int32) i8(int64)
"""
#读取数据
def read_csv(filaPash):
data,open_price,higth_price,low_price,close_price= np.loadtxt(filePath,\
delimiter=",",usecols=(