Python 3.x 如何修复colab上的FeatureTools类型错误

Python 3.x 如何修复colab上的FeatureTools类型错误,python-3.x,google-colaboratory,featuretools,Python 3.x,Google Colaboratory,Featuretools,在下面的代码中,当我从数据帧(..)在es.entity_中输入time_index='date'参数时,ft.dfs(..)就会抛出一长串从类型Error开始的错误。我正在使用google colab和featuretools版本0.4.1 import pandas as pd import featuretools as ft df1 = pd.DataFrame({'df_index' : [1,2,3,4,5], 'location':['aust

在下面的代码中,当我从数据帧(..)在es.entity_中输入time_index='date'参数时,ft.dfs(..)就会抛出一长串从类型Error开始的错误。我正在使用google colab和featuretools版本0.4.1

import pandas as pd

import featuretools as ft

df1 = pd.DataFrame({'df_index' : [1,2,3,4,5],
                 'location':['aust','aust','aust','canada','canada'],
                  'prices':[34,52,46,25,67],
                   'values':[786,345,123,654,841]
                  })

es = ft.EntitySet(id='Transactions')

es.entity_from_dataframe(entity_id='log', 
                         dataframe=df1, 
                         index='df_index',
                         time_index='date'
                        )

es.normalize_entity(base_entity_id='log', new_entity_id='loc', index= 'location' )


fm, features = ft.dfs(entityset=es, target_entity='log',
                      trans_primitives = ['add', 'multiply'],
                      agg_primitives = ['sum', 'mean'],
                      max_depth = 2,
                      verbose = 2
                     )

Colab目前捆绑了featuretools 0.4.1,我怀疑您正在使用更新的API。我首先要升级featuretools库,如下所示:

!pip安装-U功能工具

之后,需要使用Runtime->restart菜单重新启动Python进程

然后,您将看到一个不同的错误,如:

LookupError: Time index not found in dataframe
但是,我认为这是因为您引用的是数据帧变量
df1
中不存在的
date