英文:
AttributeError: Cutoff time DataFrame must contain a column with either the same name as the target dataframe index or a column named "instance_id"
问题
我正在学习如何使用Featuretools,参考了这个教程,并且已经到达了位于这段文字下方的代码段:
from featuretools.tsfresh import CidCe
import featuretools as ft
fm, features = ft.dfs(
entityset=es,
target_dataframe_name='RUL data',
agg_primitives=['last', 'max'],
trans_primitives=[],
chunk_size=.26,
cutoff_time=cutoff_time_list[0],
max_depth=3,
verbose=True,
)
fm.to_csv('advanced_fm.csv')
fm.head()
变量es
保存了数据集:
然后,cutoff_time_list[0]
有一个表格,看起来像这样:
然而,我遇到了这个错误:
AttributeError: 截止时间数据框必须包含一个与目标数据框索引相同名称的列,或者一个名为"instance_id"的列
即使数据框和截止表格都有一个"engine_no"列。这是为什么?我正在使用featuretools
的版本1.27.0
。
英文:
I'm learning how to use Featuretools with this tutorial and I've made it to a snippet which is right below this paragraph:
from featuretools.tsfresh import CidCe
import featuretools as ft
fm, features = ft.dfs(
entityset=es,
target_dataframe_name='RUL data',
agg_primitives=['last', 'max'],
trans_primitives=[],
chunk_size=.26,
cutoff_time=cutoff_time_list[0],
max_depth=3,
verbose=True,
)
fm.to_csv('advanced_fm.csv')
fm.head()
The variable es
holds the dataset:
Then, the cutoff_time_list[0]
has a table which looks like this:
However, I get this error:
AttributeError: Cutoff time DataFrame must contain a column with either the same name as the target dataframe index or a column named "instance_id"
Even when the dataframe and the cut-off table both have an "engine_no" column. Why is this caused? I'm using the version 1.27.0
of featuretools
.
答案1
得分: 1
这里的错误消息确实指向了正确的方向。它说截止时间数据框必须有一个与目标数据框的索引列同名的列。在你的示例中,你将目标数据框设置为 RUL data
,但该数据框的索引设置为名为 index
的列。由于截止时间数据框中没有名为 index
的列,所以你会收到这个错误。
根据你提供的示例笔记本,我认为你实际上希望将 target_dataframe_name
设置为 normalRUL
数据框,该数据框的索引已设置为 engine_no
。
英文:
The error message here is really pointing you in the right direction. It says that the cutoff time dataframe must have a column with the same name as the index column of the target dataframe. In your example, you set the target dataframe to RUL data
, but the index of that dataframe is set to the column named index
. Since there is no column in the cutoff time dataframe named index
you are getting this error.
Based on the example notebook you have linked, I think you really want to have target_dataframe_name
set to the normalRUL
dataframe, which has its index set as engine_no
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论