featuretools.primitives.PartOfDay#

class featuretools.primitives.PartOfDay[source]#

Determines the part of day of a datetime.

Description:

For a list of datetimes, determines the part of day the datetime falls into, based on the hour. If the hour falls from 4 to 5, the part of day is ‘dawn’. If the hour falls from 6 to 7, the part of day is ‘early morning’. If the hour falls from 8 to 10, the part of day is ‘late morning’. If the hour falls from 11 to 13, the part of day is ‘noon’. If the hour falls from 14 to 16, the part of day is ‘afternoon’. If the hour falls from 17 to 19, the part of day is ‘evening’. If the hour falls from 20 to 22, the part of day is ‘night’. If the hour falls into 23, 24, or 1 to 3, the part of day is ‘midnight’.

Examples

>>> from datetime import datetime
>>> dates = [datetime(2020, 1, 11, 6, 2, 1),
...          datetime(2021, 3, 31, 4, 2, 1),
...          datetime(2020, 3, 4, 9, 2, 1)]
>>> part_of_day = PartOfDay()
>>> part_of_day(dates).tolist()
['early morning', 'dawn', 'late morning']
__init__()#

Methods

__init__()

construct_replacement_dict()

flatten_nested_input_types(input_types)

Flattens nested column schema inputs into a single list.

generate_name(base_feature_names)

generate_names(base_feature_names)

get_args_string()

get_arguments()

get_description(input_column_descriptions[, ...])

get_filepath(filename)

get_function()

Attributes

base_of

base_of_exclude

commutative

default_value

Default value this feature returns if no data found.

description_template

input_types

woodwork.ColumnSchema types of inputs

max_stack_depth

name

Name of the primitive

number_output_features

Number of columns in feature matrix associated with this feature

return_type

ColumnSchema type of return

stack_on

stack_on_exclude

stack_on_self

uses_calc_time

uses_full_dataframe