小编Tom*_*son的帖子

Python'AttributeError:'function'对象没有属性'min''

首先,对这两个问题的明显程度表示道歉; 我对此非常陌生,并且不知道我在做什么.

我正在尝试编写一些内容来将样条插值的Scipy函数应用于值数组.我的代码目前看起来像这样:

import numpy as np
import scipy as sp
from scipy.interpolate import interp1d

x=var
x1 = ([0.1,0.3,0.4])
y1 = [0.2,0.5,0.6]

new_length = 25
new_x = np.linspace(x.min(), x.max(), new_length)
new_y = sp.interpolate.interp1d(x, y, kind='cubic')(new_x)
Run Code Online (Sandbox Code Playgroud)

但当它到达线

new_x = np.linspace(x.min(), x.max(), new_length)
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

AttributeError: 'function' object has no attribute 'min'
Run Code Online (Sandbox Code Playgroud)

到目前为止,谷歌搜索等没有发现任何我理解的内容.这是什么意思,我该如何解决?

第二个问题:如何一次输入多行代码?目前,如果我尝试复制整个内容然后将其粘贴到PyLab中,它只输入我的代码的顶行,所以我必须一次将整个内容粘贴到一行中.我怎么绕这个?

python attributes numpy attributeerror

12
推荐指数
2
解决办法
7万
查看次数

标签 统计

attributeerror ×1

attributes ×1

numpy ×1

python ×1