BusDateTime#

synthesized.metadata.value.BusDateTime

class BusDateTime(name, children=None, categories=None, nan_freq=None, num_rows=None, unit_meta=None, date_format=None, hours_min=None, hours_max=None)#

Business DateTime meta.

DateTime meta describes affine data than can be interpreted as a datetime, e.g the string ‘4/20/2020’.

date_format#

string representation of date format, e.g ‘%d/%m/%Y’.

Type

str, optional

hours_min#

The minimum hour of the day that times fall under. Defaults to 0.

Type

int, optional

hours_max#

The maximum hour of the day that times fall under. Defaults to 24.

Type

int, optional

Methods

children_from_dict(d)

rtype

Optional[Sequence[TypeVar(MetaType, bound= Meta, covariant=True)]]

convert_df_for_children(df)

Expands the dataframe to contain the columns of the metas children.

create_index(df)

rtype

DatetimeIndex

extract(df)

Extract the categories and their relative frequencies from a data frame, if not already set.

from_dict(d)

Construct a Meta from a dictionary.

from_name_and_dict(class_name, d)

Construct a Meta from a meta class name and a dictionary.

get(k[,d])

get_registry()

rtype

Dict[str, Type[TypeVar(MetaType, bound= Meta, covariant=True)]]

items()

keys()

less_than(x, y)

rtype

bool

parse_date_values(df)

rtype

DataFrame

revert_df_from_children(df)

Collapses the dataframe to no longer contain the meta's children columns.

sort(sr)

Sort pd.Series according to the ordering of this meta

to_dict()

Convert the Meta to a dictionary.

unfold(df)

rtype

DataFrame

update_meta(df)

Update the categories and nan_freq if required be

values()

Attributes

categories

rtype

Sequence[TypeVar(NType, bound= Union[str, bool_, datetime64, timedelta64, int64, float64])]

children

Return the children of this Meta.

class_name

dtype

max

rtype

Optional[TypeVar(OType, bound= Union[str, bool_, datetime64, timedelta64, int64, float64])]

min

rtype

Optional[TypeVar(OType, bound= Union[str, bool_, datetime64, timedelta64, int64, float64])]

unit_meta

rtype

TimeDelta

property children#

Return the children of this Meta.

Return type

Sequence[TypeVar(MetaType, bound= Meta, covariant=True)]

convert_df_for_children(df)#

Expands the dataframe to contain the columns of the metas children.

extract(df)#

Extract the categories and their relative frequencies from a data frame, if not already set.

classmethod from_dict(d)#

Construct a Meta from a dictionary.

See example in Meta.to_dict() for the required structure.

See also

Meta.to_dict: convert a Meta to a dictionary

Return type

BusDateTime

classmethod from_name_and_dict(class_name, d)#

Construct a Meta from a meta class name and a dictionary.

See also

Meta.from_dict: construct a Meta from a dictionary

Return type

TypeVar(MetaTypeArg, bound= Meta)

get(k[, d]) D[k] if k in D, else d.  d defaults to None.#
items() a set-like object providing a view on D's items#
keys() a set-like object providing a view on D's keys#
revert_df_from_children(df)#

Collapses the dataframe to no longer contain the meta’s children columns.

sort(sr)#

Sort pd.Series according to the ordering of this meta

Return type

Sequence[TypeVar(AType, bound= Union[datetime64, timedelta64, int64, float64])]

to_dict()#

Convert the Meta to a dictionary.

The tree structure is converted to the following form:

{
    attr: value,
    children: {
        name: {**value_meta_attr.__dict__}
    }
}

See also

Meta.from_dict: construct a Meta from a dictionary

Return type

Dict[str, object]

update_meta(df)#

Update the categories and nan_freq if required be

values() an object providing a view on D's values#