alteryx/featuretools

Support Datetime Feature +/- pd.Timedelta

Open

#629 创建于 2019年6月28日

在 GitHub 查看
 (7 评论) (0 反应) (0 负责人)Python (6,895 star) (853 fork)batch import
good first issue

描述

Bug/Feature Request Description

In [1]: import featuretools as ft                                                                                                                             

In [2]: es = ft.demo.load_mock_customer(return_entityset=True)                                                                                                

In [3]: import pandas as pd                                                                                                                                   

In [4]: f = ft.Feature(es['customers']['date_of_birth'])                                                                                                      

In [5]: ft.calculate_feature_matrix([f + pd.Timedelta(1, 'y')], es)                                                                                           
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-5-340973cfbfbd> in <module>
----> 1 ft.calculate_feature_matrix([f + pd.Timedelta(1, 'y')], es)

/usr/local/lib/python3.7/site-packages/featuretools/feature_base/feature_base.py in __add__(self, other)
    242     def __add__(self, other):
    243         """Add other"""
--> 244         return self._handle_binary_comparision(other, primitives.AddNumeric, primitives.AddNumericScalar)
    245 
    246     def __radd__(self, other):

/usr/local/lib/python3.7/site-packages/featuretools/feature_base/feature_base.py in _handle_binary_comparision(self, other, Primitive, PrimitiveScalar)
    214             return Feature([self, other], primitive=Primitive)
    215 
--> 216         return Feature([self], primitive=PrimitiveScalar(other))
    217 
    218     def __eq__(self, other):

/usr/local/lib/python3.7/site-packages/featuretools/feature_base/feature_base.py in __new__(self, base, entity, groupby, parent_entity, primitive, use_previous, where)
    733                                                primitive=primitive,
    734                                                groupby=groupby)
--> 735             return TransformFeature(base, primitive=primitive)
    736 
    737         raise Exception("Unrecognized feature initialization")

/usr/local/lib/python3.7/site-packages/featuretools/feature_base/feature_base.py in __init__(self, base_features, primitive, name)
    637                                                relationship_path=RelationshipPath([]),
    638                                                primitive=primitive,
--> 639                                                name=name)
    640 
    641     @classmethod

/usr/local/lib/python3.7/site-packages/featuretools/feature_base/feature_base.py in __init__(self, entity, base_features, relationship_path, primitive, name)
     53         self._name = name
     54 
---> 55         assert self._check_input_types(), ("Provided inputs don't match input "
     56                                            "type requirements")
     57 

AssertionError: Provided inputs don't match input type requirements

贡献者指南