alteryx / alteryx/featuretools
Remove empty_dataframe function from deserialization
- 主要语言
- Python
- 星标
- 7.7k
- 派生
- 915
- PR 合并指标
- 30 天内没有已合并 PR
描述
in `deserialize.py` there is a function to create an empty dataframe from an entityset description file. This is primarily used to create an entityset with empty dataframes that serves as the entityset metadata. We could update the entityset metadata property to directly generate an empty dataframe from the corresponding entityset dataframe instead of serializing and deserializing to a description.
An approach similar to this could be used:
```python
@property
def metadata(self):
'''Returns the metadata for this EntitySet. The metadata will be recomputed if it does not exist.'''
if self._data_description is None:
metadata_es = EntitySet(self.id)
for df in self.dataframes:
empty_df = df.loc[[], :]
empty_df.ww.init(schema=df.ww.schema, validate=False)
metadata_es.add_dataframe(empty_df)
metadata_es.add_relationships(self.relationships)
self._data_description = metadata_es
return self._data_description
```
Note, the current metadata always creates empty pandas dataframes, but the approach shown above would create Dask and Koalas dataframes as well, depending on the EntitySet type. That might create other issues that need to be addressed.
Making this change might also require refactoring a couple tests in `test_serialization.py` that currently rely on deserializing a description into an entityset with empty dataframes.
If this change is made, we should also look to see if the Woodwork typing information can be removed from the entityset description that is generated in `entityset_to_description` - maybe we can just store the minimum information needed to load the dataframe instead of the entire dataframe description.
贡献指南
评估
这个 Issue 还没有评估数据。