小编use*_*534的帖子

ValueError:x和y必须具有相同的第一个维度

我收到一条错误消息

ValueError:x和y必须具有相同的第一个维度.

这是代码:

import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import numpy as np

date,bid,ask = np.loadtxt('GBPUSD1d.txt', unpack=True,
               delimiter =',',converters={0:mdates.strpdate2num('%Y%m%d%H%M%S')}) 
avgLine = ((bid+ask)/2)
patternAr = []
performanceAr = []
patForRec = []
eachPattern = []

def percentChange(startPoint, currentPoint):
        return ((float(currentPoint)- startPoint)/abs(startPoint))*100.00

def patternStorage():
        patStartTime = time.time()
        x = (len(avgLine))-30
        y = 11
        while y < x:
                pattern = []
                p1 = percentChange(avgLine[y-10], avgLine[y-9])
                ...
                p10 = percentChange(avgLine[y-10], avgLine[y])

                outcomeRange = avgLine[y+20:y+30]
                currentPoint = avgLine[y]
                try:
                        avgOutcome = reduce(lambda x, …
Run Code Online (Sandbox Code Playgroud)

python matplotlib

5
推荐指数
1
解决办法
3万
查看次数

标签 统计

matplotlib ×1

python ×1