featuretools.primitives.PartOfDay#

class featuretools.primitives.PartOfDay[source]#

确定日期时间的一天中的时段.

Description:

对于一个日期时间列表,根据小时确定日期时间所属的一天中的时段. 如果小时在4到5之间,时段为’dawn’(黎明). 如果小时在6到7之间,时段为’early morning’(清晨). 如果小时在8到10之间,时段为’late morning’(上午). 如果小时在11到13之间,时段为’noon’(中午). 如果小时在14到16之间,时段为’afternoon’(下午). 如果小时在17到19之间,时段为’evening’(傍晚). 如果小时在20到22之间,时段为’night’(夜晚). 如果小时在23、24或1到3之间,时段为’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)

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

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