featuretools.primitives.IsWorkingHours#
- class featuretools.primitives.IsWorkingHours(start_hour=8, end_hour=18)[source]#
Determines if a datetime falls during working hours on a 24-hour clock. Can configure start_hour and end_hour.
- Parameters:
start_hour (int) – Start hour of workday. Must adhere to 24-hour clock. Default is 8 (8am).
end_hour (int) – End hour of workday. Must adhere to 24-hour clock. Default is 18 (6pm).
Examples
>>> import numpy as np >>> from datetime import datetime >>> dates = [datetime(2022, 6, 21, 16, 3, 3), ... datetime(2019, 1, 3, 4, 4, 4), ... datetime(2022, 1, 1, 12, 1, 2), ... np.nan] >>> is_working_hour = IsWorkingHours() >>> is_working_hour(dates).tolist() [True, False, True, False] >>> is_working_hour = IsWorkingHours(15, 17) >>> is_working_hour(dates).tolist() [True, False, False, False]
Methods
__init__([start_hour, end_hour])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_ofbase_of_excludecommutativedefault_valueDefault value this feature returns if no data found.
description_templateinput_typeswoodwork.ColumnSchema types of inputs
max_stack_depthnameName of the primitive
number_output_featuresNumber of columns in feature matrix associated with this feature
return_typeColumnSchema type of return
stack_onstack_on_excludestack_on_selfuses_calc_timeuses_full_dataframe