我正在尝试使用sklearn.LinearRegression查找大量短序列的对数斜率。数据是从熊猫数据框的行中提取的,如下所示:
bp01 1.12
bp02 1.12
bp03 1.08
bp04 0.99
bp05 1.08
bp06 1.19
bp07 1.17
bp08 1.05
bp09 0.8
bp10 0.96
bp11 0.97
bp12 1.12
bp13 0.91
bp14 0.96
bp15 1.05
bp16 0.93
bp17 0.97
bp18 0.92
bp19 0.89
bp20 0
Name: 42029, dtype: object
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试使用np.log10时,在该系列上出现以下错误:
In[27]: test.apply(np.log10)
Traceback (most recent call last):
File "<ipython-input-27-bccff3ed525b>", line 1, in <module>
test.apply(np.log10)
File "C:\location", line 2348, in apply
return f(self)
AttributeError: 'numpy.float64' object has no attribute 'log10'
Run Code Online (Sandbox Code Playgroud)