- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当我使用下面的日志功能时,我在我的 jupyter notebook 中收到以下错误消息。data1 = np.log(mdata).diff().dropna()我试图做 Actor 但无法摆脱这个问题。---------------------------------------------- --------------------------AttributeError Traceback(最后一次调用)AttributeError: 'str' 对象没有属性 'log'
The above exception was the direct cause of the following exception:
TypeError Traceback (most recent call last)
<ipython-input-13-b6f1878a7619> in <module>
----> 1 data1 = np.log(mdata).diff().dropna()
TypeError: loop of ufunc does not support argument 0 of type str which has no callable log method
数据:
Field1 Field2 Field3 Field4
TS
2020-11-02 00:43:58.500 1595000 849332 205 69
2020-11-02 00:43:58.500 1408000 820332 198 51
2020-11-02 00:43:58.500 1770000 926054 213 56
2020-11-02 00:43:58.500 1760000 1002332 216 72
2020-11-02 00:43:58.500 1850000 957054 213 59
... ... ... ... ...
数据索引:
DatetimeIndex(['2020-11-02 00:43:58.500000', '2020-11-02 00:43:58.500000',
'2020-11-02 00:43:58.500000', '2020-11-02 00:43:58.500000',
'2020-11-02 00:43:58.500000', '2020-11-02 00:43:58.500000',
'2020-11-02 00:43:58.500000', '2020-11-02 00:43:58.500000',
'2020-11-02 00:43:58.600000', '2020-11-02 00:43:58.600000',
...
'2020-11-02 00:44:00.400000', '2020-11-02 00:44:00.500000'],
dtype='datetime64[ns]', name='TS', length=199, freq=None)
完整代码为
df1 = pd.read_csv('inputdata.csv')
cols = ['Field1','Field2','Field3','Field4']
data_x = pd.to_datetime(data_x)
mdata = df1[cols]
mdata.index = pd.DatetimeIndex(data_x)
data1 = np.log(mdata).diff().dropna()
The following statements are not executed due to the issue in the above statement
model = VAR(data)
results = model.fit(2)
results.summary()
最佳答案
问题是您的数据列不是数字类型,numpy.log()
需要数字数据。您可以使用 pandas.to_numeric()
mdata = df1[cols].apply(pd.to_numeric)
或使用 DataFrame.astype()
mdata = df1[cols].astype(float)
关于python - ufunc 的到期循环错误不支持没有可调用日志方法的 str 类型的参数 0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64636018/
我正在使用 Gunicorn 为 Django 应用程序提供服务,它工作正常,直到我将其超时时间从 30 秒更改为 900000 秒,我不得不这样做,因为我有一个用例需要上传和处理一个巨大的文件(过程
我有一个带有非常基本的管道的Jenkinsfile,它可以旋转docker容器: pipeline { agent { dockerfile { args '-u root' } } stag
在学习 MEAN 堆栈的过程中,我遇到了一个问题。每当我尝试使用 Passport 验证方法时,它都不会返回任何响应。我总是收到“localhost没有发送任何数据。ERR_EMPTY_RESPONS
在当今的大多数企业堆栈中,数据库是我们存储所有秘密的地方。它是安全屋,是待命室,也是用于存储可能非常私密或极具价值的物品的集散地。对于依赖它的数据库管理员、程序员和DevOps团队来说,保护它免受所
是否可以创建像图片上那样的边框?只需使用 css 边框属性。最终结果将是没 Angular 盒子。我不想添加额外的 html 元素。我只想为每个 li 元素添加 css 边框信息。 假设这是一个 ul
我是一名优秀的程序员,十分优秀!