AttributeError: Cutoff time DataFrame must contain a column with either the same name as the target dataframe index or a column named "instance_id"

huangapple go评论77阅读模式
英文:

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保存了数据集:

AttributeError: Cutoff time DataFrame must contain a column with either the same name as the target dataframe index or a column named "instance_id"

然后,cutoff_time_list[0]有一个表格,看起来像这样:

AttributeError: Cutoff time DataFrame must contain a column with either the same name as the target dataframe index or a column named "instance_id"

然而,我遇到了这个错误:
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:

AttributeError: Cutoff time DataFrame must contain a column with either the same name as the target dataframe index or a column named "instance_id"

Then, the cutoff_time_list[0] has a table which looks like this:

AttributeError: Cutoff time DataFrame must contain a column with either the same name as the target dataframe index or a column named "instance_id"

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.

huangapple
  • 本文由 发表于 2023年7月27日 19:16:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76779213.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定