How to use the featuretools.variable_types.variable.Variable function in featuretools

To help you get started, we’ve selected a few featuretools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
_default_pandas_dtype = np.datetime64


class NumericTimeIndex(TimeIndex, Numeric):
    """Represents time index of entity that is numeric"""
    type_string = "numeric_time_index"
    _default_pandas_dtype = float


class DatetimeTimeIndex(TimeIndex, Datetime):
    """Represents time index of entity that is a datetime"""
    type_string = "datetime_time_index"
    _default_pandas_dtype = np.datetime64


class Timedelta(Variable):
    """Represents variables that are timedeltas

    Args:
        range (list, optional) : List of start and end of allowed range in seconds. Can use inf and -inf to represent infinity. Unconstrained if not specified.
        start_inclusive (bool, optional) : Whether or not range includes the start value.
        end_inclusive (bool, optional) : Whether or not range includes the end value
    """
    type_string = "timedelta"
    _default_pandas_dtype = np.timedelta64

    def __init__(self,
                 id,
                 entity,
                 name=None,
                 range=None,
                 start_inclusive=True,
github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
"""Represents a computer network address. Represented
    in dotted-decimal notation. IPv4 and IPv6 are supported.
    """
    type_string = "ip"
    _default_pandas_dtype = str


class FullName(Variable):
    """Represents a person's full name. May consist of a
    first name, last name, and a title.
    """
    type_string = "full_name"
    _default_pandas_dtype = str


class EmailAddress(Variable):
    """Represents an email box to which email message are sent.
    Consists of a local-part, an @ symbol, and a domain.
    """
    type_string = "email"
    _default_pandas_dtype = str


class URL(Variable):
    """Represents a valid web url (with or without http/www)"""
    type_string = "url"
    _default_pandas_dtype = str


class PhoneNumber(Variable):
    """Represents any valid phone number.
    Can be with/without parenthesis.
github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
"""Represents a person's full name. May consist of a
    first name, last name, and a title.
    """
    type_string = "full_name"
    _default_pandas_dtype = str


class EmailAddress(Variable):
    """Represents an email box to which email message are sent.
    Consists of a local-part, an @ symbol, and a domain.
    """
    type_string = "email"
    _default_pandas_dtype = str


class URL(Variable):
    """Represents a valid web url (with or without http/www)"""
    type_string = "url"
    _default_pandas_dtype = str


class PhoneNumber(Variable):
    """Represents any valid phone number.
    Can be with/without parenthesis.
    Can be with/without area/country codes.
    """
    type_string = "phone_number"
    _default_pandas_dtype = str


class DateOfBirth(Datetime):
    """Represents a date of birth as a datetime"""
github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
self.range = None or []
        self.start_inclusive = start_inclusive
        self.end_inclusive = end_inclusive
        super(Numeric, self).__init__(id, entity, name=name)

    def to_data_description(self):
        description = super(Numeric, self).to_data_description()
        description['type'].update({
            'range': self.range,
            'start_inclusive': self.start_inclusive,
            'end_inclusive': self.end_inclusive,
        })
        return description


class Index(Variable):
    """Represents variables that uniquely identify an instance of an entity

    Attributes:
        count (int)
    """
    type_string = "index"
    _default_pandas_dtype = int


class Datetime(Variable):
    """Represents variables that are points in time

    Args:
        format (str): Python datetime format string documented `here `_.
    """
    type_string = "datetime"
github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
_default_pandas_dtype = np.datetime64

    def __init__(self, id, entity, name=None, format=None):
        self.format = format
        super(Datetime, self).__init__(id, entity, name=name)

    def __repr__(self):
        return u"".format(self.name, self.type_string, self.format)

    def to_data_description(self):
        description = super(Datetime, self).to_data_description()
        description['type'].update({'format': self.format})
        return description


class TimeIndex(Variable):
    """Represents time index of entity"""
    type_string = "time_index"
    _default_pandas_dtype = np.datetime64


class NumericTimeIndex(TimeIndex, Numeric):
    """Represents time index of entity that is numeric"""
    type_string = "numeric_time_index"
    _default_pandas_dtype = float


class DatetimeTimeIndex(TimeIndex, Datetime):
    """Represents time index of entity that is a datetime"""
    type_string = "datetime_time_index"
    _default_pandas_dtype = np.datetime64
github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
'end_inclusive': self.end_inclusive,
        })
        return description


class Index(Variable):
    """Represents variables that uniquely identify an instance of an entity

    Attributes:
        count (int)
    """
    type_string = "index"
    _default_pandas_dtype = int


class Datetime(Variable):
    """Represents variables that are points in time

    Args:
        format (str): Python datetime format string documented `here `_.
    """
    type_string = "datetime"
    _default_pandas_dtype = np.datetime64

    def __init__(self, id, entity, name=None, format=None):
        self.format = format
        super(Datetime, self).__init__(id, entity, name=name)

    def __repr__(self):
        return u"".format(self.name, self.type_string, self.format)

    def to_data_description(self):
github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
def find_variable_types():
    return {str(vtype.type_string): vtype for vtype in find_descendents(
        Variable) if hasattr(vtype, 'type_string')}
github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
self.range = range or []
        self.start_inclusive = start_inclusive
        self.end_inclusive = end_inclusive
        super(Timedelta, self).__init__(id, entity, name=name)

    def to_data_description(self):
        description = super(Timedelta, self).to_data_description()
        description['type'].update({
            'range': self.range,
            'start_inclusive': self.start_inclusive,
            'end_inclusive': self.end_inclusive,
        })
        return description


class Text(Variable):
    """Represents variables that are arbitary strings"""
    type_string = "text"
    _default_pandas_dtype = str


class PandasTypes(object):
    _all = 'all'
    _categorical = 'category'
    _pandas_datetimes = ['datetime64[ns]', 'datetime64[ns, tz]']
    _pandas_timedeltas = ['Timedelta']
    _pandas_numerics = ['int16', 'int32', 'int64',
                        'float16', 'float32', 'float64']


class LatLong(Variable):
    """Represents an ordered pair (Latitude, Longitude)
github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
super(Discrete, self).__init__(id, entity, name)
        self._interesting_values = pd.Series()

    @property
    def interesting_values(self):
        return self._interesting_values

    @interesting_values.setter
    def interesting_values(self, values):
        seen = set()
        seen_add = seen.add
        self._interesting_values = pd.Series([v for v in values if not
                                              (v in seen or seen_add(v))])


class Boolean(Variable):
    """Represents variables that take on one of two values

    Args:
        true_values (list) : List of valued true values. Defaults to [1, True, "true", "True", "yes", "t", "T"]
        false_values (list): List of valued false values. Defaults to [0, False, "false", "False", "no", "f", "F"]
    """
    type_string = "boolean"
    _default_pandas_dtype = bool

    def __init__(self,
                 id,
                 entity,
                 name=None,
                 true_values=None,
                 false_values=None):
        default = [1, True, "true", "True", "yes", "t", "T"]
github FeatureLabs / featuretools / featuretools / variable_types / variable.py View on Github external
To make a latlong in a dataframe do
    data['latlong'] = data[['latitude', 'longitude']].apply(tuple, axis=1)
    """
    type_string = "latlong"


class ZIPCode(Categorical):
    """Represents a postal address in the United States.
    Consists of a series of digits which are casts as
    string. Five digit and 9 digit zipcodes are supported.
    """
    type_string = "zipcode"
    _default_pandas_dtype = str


class IPAddress(Variable):
    """Represents a computer network address. Represented
    in dotted-decimal notation. IPv4 and IPv6 are supported.
    """
    type_string = "ip"
    _default_pandas_dtype = str


class FullName(Variable):
    """Represents a person's full name. May consist of a
    first name, last name, and a title.
    """
    type_string = "full_name"
    _default_pandas_dtype = str


class EmailAddress(Variable):