我正在尝试使用 FeatureTools 来规范化特征合成表。我的表格类似于 Max-Kanter 在How to apply Deep Feature Synthesis to a single table 中的回复。我遇到了一个例外,我希望能得到一些帮助。
异常起源于featuretools.entityset.entity.entityset_convert_variable_type
,它似乎不处理时间类型。
异常的性质是什么,我可以解决它吗?
表,df
:
PatientId | AppointmentID | Gender | ScheduledDay | AppointmentDay | Age | Neighbourhood | Scholarship | Hipertension | Diabetes | Alcoholism | Handcap | SMS_received | No-show
12345 | 5642903 | F | 2016-04-29 | 2016-04-29 | 62 | JARDIM DA | 0 | 1 | 0 | 0 | 0 | 0 | No
67890 | 3902943 | M | 2016-03-18 | 2016-04-29 | 44 | Other Nbh | 1 | 1 | 0 | 0 | 0 | 0 | Yes
...
我的代码:
appointment_entity_set = ft.EntitySet('appointments')
appointment_entity_set.entity_from_dataframe(
dataframe=df, entity_id='appointments',
index='AppointmentID', time_index='AppointmentDay')
# error generated here
appointment_entity_set.normalize_entity(base_entity_id='appointments',
new_entity_id='patients',
index='PatientId')
ScheduledDay 和 AppointmentDay 是类型pandas._libs.tslib.Timestamp
,就像Max-Kanter 的响应中的情况一样。
例外:
~/.virtualenvs/trane/lib/python3.6/site-packages/featuretools/entityset/entity.py in entityset_convert_variable_type(self, column_id, new_type, **kwargs)
474 df = self.df
--> 475 if df[column_id].empty:
476 return
477 if new_type == vtypes.Numeric:
Exception: Cannot convert column first_appointments_time to <class 'featuretools.variable_types.variable.DatetimeTimeIndex'>
功能工具==0.1.21