featuretools.primitives.IsWorkingHours#

class featuretools.primitives.IsWorkingHours(start_hour=8, end_hour=18)[source]#

判断一个日期时间是否在24小时制的工作时间内.可以配置start_hour和end_hour.

Parameters:
  • start_hour (int) – 工作日的开始小时.必须遵循24小时制.默认是8(上午8点).

  • end_hour (int) – 工作日的结束小时.必须遵循24小时制.默认是18(下午6点).

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]
__init__(start_hour=8, end_hour=18)[source]#

Methods

__init__([start_hour, end_hour])

flatten_nested_input_types(input_types)

将嵌套的列模式输入展平成一个列表.

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