alteryx/featuretools

Support Datetime Feature +/- pd.Timedelta

Open

#629 aberto em 28 de jun. de 2019

Ver no GitHub
 (7 comments) (0 reactions) (0 assignees)Python (853 forks)batch import
good first issue

Métricas do repositório

Stars
 (6.895 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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

Guia do colaborador