featuretools.primitives.PartOfDay#
- class featuretools.primitives.PartOfDay[source]#
确定日期时间的时段。
- 描述
对于一个日期时间列表,根据小时确定日期时间所属的时段。如果小时在 4 到 5 之间,则时段为“黎明”。如果小时在 6 到 7 之间,则时段为“清晨”。如果小时在 8 到 10 之间,则时段为“上午晚些时候”。如果小时在 11 到 13 之间,则时段为“中午”。如果小时在 14 到 16 之间,则时段为“下午”。如果小时在 17 到 19 之间,则时段为“傍晚”。如果小时在 20 到 22 之间,则时段为“夜晚”。如果小时在 23、24 或 1 到 3 之间,则时段为“午夜”。
示例
>>> 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__()#
方法
__init__
()construct_replacement_dict
()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
()属性
base_of
base_of_exclude
commutative
default_value
如果未找到数据,此特征返回的默认值。
description_template
input_types
输入的 woodwork.ColumnSchema 类型
max_stack_depth
name
原语的名称
number_output_features
与此特征关联的特征矩阵中的列数
return_type
返回的 ColumnSchema 类型
stack_on
stack_on_exclude
stack_on_self
uses_calc_time
uses_full_dataframe