Skip to content

HistoryDateTimeView #

Bases: object

A lazy view over node values

end property #

Gets the latest time that this HistoryDateTimeView is valid.

Returns:

Type Description
Optional[int]

The latest time that this HistoryDateTimeView is valid or None if the HistoryDateTimeView is valid for all times.

end_date_time property #

Gets the latest datetime that this HistoryDateTimeView is valid

Returns:

Type Description
Optional[datetime]

The latest datetime that this HistoryDateTimeView is valid or None if the HistoryDateTimeView is valid for all times.

start property #

Gets the start time for rolling and expanding windows for this HistoryDateTimeView

Returns:

Type Description
Optional[int]

The earliest time that this HistoryDateTimeView is valid or None if the HistoryDateTimeView is valid for all times.

start_date_time property #

Gets the earliest datetime that this HistoryDateTimeView is valid

Returns:

Type Description
Optional[datetime]

The earliest datetime that this HistoryDateTimeView is valid or None if the HistoryDateTimeView is valid for all times.

window_size property #

Get the window size (difference between start and end) for this HistoryDateTimeView

Returns:

Type Description
Optional[int]

__eq__(value) #

Return self==value.

__ge__(value) #

Return self>=value.

__getitem__(key) #

Return self[key].

__gt__(value) #

Return self>value.

__iter__() #

Implement iter(self).

__le__(value) #

Return self<=value.

__len__() #

Return len(self).

__lt__(value) #

Return self<value.

__ne__(value) #

Return self!=value.

__repr__() #

Return repr(self).

after(start) #

Create a view of the HistoryDateTimeView including all events after start (exclusive).

Parameters:

Name Type Description Default
start TimeInput

The start time of the window.

required

Returns:

Type Description
HistoryDateTimeView

at(time) #

Create a view of the HistoryDateTimeView including all events at time.

Parameters:

Name Type Description Default
time TimeInput

The time of the window.

required

Returns:

Type Description
HistoryDateTimeView

before(end) #

Create a view of the HistoryDateTimeView including all events before end (exclusive).

Parameters:

Name Type Description Default
end TimeInput

The end time of the window.

required

Returns:

Type Description
HistoryDateTimeView

bottom_k(k) #

Compute the k smallest values

Parameters:

Name Type Description Default
k int

The number of values to return

required

Returns:

Type Description
NodeStateOptionListDateTime

The k smallest values as a node state

collect() #

Compute all values and return the result as a list

Returns:

Type Description
list[Optional[list[datetime]]]

all values as a list

compute() #

Compute all values and return the result as a node view

Returns:

Type Description
NodeStateOptionListDateTime

the computed NodeState

default_layer() #

Return a view of HistoryDateTimeView containing only the default edge layer Returns: HistoryDateTimeView: The layered view

exclude_layer(name) #

Return a view of HistoryDateTimeView containing all layers except the excluded name Errors if any of the layers do not exist.

Parameters:

Name Type Description Default
name str

layer name that is excluded for the new view

required

Returns:

Type Description
HistoryDateTimeView

The layered view

exclude_layers(names) #

Return a view of HistoryDateTimeView containing all layers except the excluded names Errors if any of the layers do not exist.

Parameters:

Name Type Description Default
names list[str]

list of layer names that are excluded for the new view

required

Returns:

Type Description
HistoryDateTimeView

The layered view

exclude_valid_layer(name) #

Return a view of HistoryDateTimeView containing all layers except the excluded name Arguments: name (str): layer name that is excluded for the new view

Returns:

Type Description
HistoryDateTimeView

The layered view

exclude_valid_layers(names) #

Return a view of HistoryDateTimeView containing all layers except the excluded names Arguments: names (list[str]): list of layer names that are excluded for the new view

Returns:

Type Description
HistoryDateTimeView

The layered view

expanding(step) #

Creates a WindowSet with the given step size using an expanding window.

An expanding window is a window that grows by step size at each iteration.

Parameters:

Name Type Description Default
step int | str

The step size of the window.

required

Returns:

Type Description
WindowSet

A WindowSet object.

get(node, default=None) #

Get value for node

Parameters:

Name Type Description Default
node NodeInput

the node

required
default Optional[Optional[list[datetime]]]

the default value. Defaults to None.

None

Returns:

Type Description
Optional[Optional[list[datetime]]]

the value for the node or the default value

has_layer(name) #

Check if HistoryDateTimeView has the layer "name"

Parameters:

Name Type Description Default
name str

the name of the layer to check

required

Returns:

Type Description
bool

items() #

Iterate over items

Returns:

Type Description
Iterator[Tuple[Node, Optional[list[datetime]]]]

Iterator over items

latest() #

Create a view of the HistoryDateTimeView including all events at the latest time.

Returns:

Type Description
HistoryDateTimeView

layer(name) #

Return a view of HistoryDateTimeView containing the layer "name" Errors if the layer does not exist

Parameters:

Name Type Description Default
name str

then name of the layer.

required

Returns:

Type Description
HistoryDateTimeView

The layered view

layers(names) #

Return a view of HistoryDateTimeView containing all layers names Errors if any of the layers do not exist.

Parameters:

Name Type Description Default
names list[str]

list of layer names for the new view

required

Returns:

Type Description
HistoryDateTimeView

The layered view

max() #

Return the maximum value

Returns:

Type Description
Optional[Optional[list[datetime]]]

The maximum value or None if empty

max_item() #

Return largest value and corresponding node

Returns:

Type Description
Optional[Tuple[Node, Optional[list[datetime]]]]

The Node and maximum value or None if empty

median() #

Return the median value

Returns:

Type Description
value

Optional[Optional[list[datetime]]]:

median_item() #

Return median value and corresponding node

Returns:

Type Description
Optional[Tuple[Node, Optional[list[datetime]]]]

The median value or None if empty

min() #

Return the minimum value

Returns:

Type Description
Optional[Optional[list[datetime]]]

The minimum value or None if empty

min_item() #

Return smallest value and corresponding node

Returns:

Type Description
Optional[Tuple[Node, Optional[list[datetime]]]]

The Node and minimum value or None if empty

nodes() #

Iterate over nodes

Returns:

Type Description
Nodes

The nodes

rolling(window, step=None) #

Creates a WindowSet with the given window size and optional step using a rolling window.

A rolling window is a window that moves forward by step size at each iteration.

Parameters:

Name Type Description Default
window int | str

The size of the window.

required
step int | str | None

The step size of the window. step defaults to window.

None

Returns:

Type Description
WindowSet

A WindowSet object.

shrink_end(end) #

Set the end of the window to the smaller of end and self.end()

Parameters:

Name Type Description Default
end TimeInput

the new end time of the window

required

Returns: HistoryDateTimeView:

shrink_start(start) #

Set the start of the window to the larger of start and self.start()

Parameters:

Name Type Description Default
start TimeInput

the new start time of the window

required

Returns:

Type Description
HistoryDateTimeView

shrink_window(start, end) #

Shrink both the start and end of the window (same as calling shrink_start followed by shrink_end but more efficient)

Parameters:

Name Type Description Default
start TimeInput

the new start time for the window

required
end TimeInput

the new end time for the window

required

Returns:

Type Description
HistoryDateTimeView

snapshot_at(time) #

Create a view of the HistoryDateTimeView including all events that have not been explicitly deleted at time.

This is equivalent to before(time + 1) for Graph and at(time) for PersistentGraph

Parameters:

Name Type Description Default
time TimeInput

The time of the window.

required

Returns:

Type Description
HistoryDateTimeView

snapshot_latest() #

Create a view of the HistoryDateTimeView including all events that have not been explicitly deleted at the latest time.

This is equivalent to a no-op for Graph and latest() for PersistentGraph

Returns:

Type Description
HistoryDateTimeView

sorted(reverse=False) #

Sort by value

Parameters:

Name Type Description Default
reverse bool

If True, sort in descending order, otherwise ascending. Defaults to False.

False

Returns:

Type Description
NodeStateOptionListDateTime

Sorted node state

sorted_by_id() #

Sort results by node id

Returns:

Type Description
NodeStateOptionListDateTime

The sorted node state

to_df() #

Convert results to pandas DataFrame

The DataFrame has two columns, "node" with the node ids and "value" with the corresponding values.

Returns:

Type Description
DataFrame

the pandas DataFrame

top_k(k) #

Compute the k largest values

Parameters:

Name Type Description Default
k int

The number of values to return

required

Returns:

Type Description
NodeStateOptionListDateTime

The k largest values as a node state

valid_layers(names) #

Return a view of HistoryDateTimeView containing all layers names Any layers that do not exist are ignored

Parameters:

Name Type Description Default
names list[str]

list of layer names for the new view

required

Returns:

Type Description
HistoryDateTimeView

The layered view

values() #

Iterate over values

Returns:

Type Description
Iterator[Optional[list[datetime]]]

Iterator over values

window(start, end) #

Create a view of the HistoryDateTimeView including all events between start (inclusive) and end (exclusive)

Parameters:

Name Type Description Default
start TimeInput | None

The start time of the window (unbounded if None).

required
end TimeInput | None

The end time of the window (unbounded if None).

required

Returns:

Type Description
HistoryDateTimeView