我是 scipy 新手,无法使用该curve_fit
功能。我认为有一些 scipy/numpy 数据包装器需要用于独立和依赖的数据集。windowCurrent 和 windowVoltage 是从我的数据集中保存一组滑动点的队列。
如何包装电流/电压对列表以避免此错误?
TypeError: unsupported operand type(s) for -: 'numpy.ndarray' and 'numpy.ndarray'
代码:
for line in inputFileContents[:maxlen]:
print line
timeStamp,voltage,current = line.split(",")
if windowCurrent == None and windowVoltage == None:
windowCurrent = deque(current, maxlen)
windowVoltage = deque(voltage, maxlen)
else:
windowCurrent.append(current)
windowVoltage.append(voltage)
for lineConents in inputFileContents:
timeStamp,voltage,current = line.split(",")
windowCurrent.append(current)
windowVoltage.append(voltage)
curveList.append([timeStamp, op.curve_fit(logCurve, np.array(list(windowCurrent)), np.array(list(windowVoltage)))])
curveListPopulate(curveList)
另外:doing list(windowCurrent)
,离开np.array
包装,也会返回一个错误。
链接到错误的全文