EarliestDateTimeView#

class EarliestDateTimeView#

Bases: object

A lazy view over node values

Methods:

after(start)

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

at(time)

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

before(end)

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

bottom_k(k)

Compute the k smallest values

collect()

Compute all values and return the result as a list

compute()

Compute all values and return the result as a node view

default_layer()

Return a view of EarliestDateTimeView containing only the default edge layer :returns: The layered view :rtype: EarliestDateTimeView

exclude_layer(name)

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

exclude_layers(names)

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

exclude_valid_layer(name)

Return a view of EarliestDateTimeView containing all layers except the excluded name :param name: layer name that is excluded for the new view :type name: str

exclude_valid_layers(names)

Return a view of EarliestDateTimeView containing all layers except the excluded names :param names: list of layer names that are excluded for the new view :type names: list[str]

expanding(step)

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

get(node[, default])

Get value for node

groups()

Group by value

has_layer(name)

Check if EarliestDateTimeView has the layer "name"

items()

Iterate over items

latest()

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

layer(name)

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

layers(names)

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

max()

Return the maximum value

max_item()

Return largest value and corresponding node

median()

Return the median value

median_item()

Return median value and corresponding node

min()

Return the minimum value

min_item()

Return smallest value and corresponding node

nodes()

Iterate over nodes

rolling(window[, step])

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

shrink_end(end)

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

shrink_start(start)

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

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)

snapshot_at(time)

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

snapshot_latest()

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

sorted([reverse])

Sort by value

sorted_by_id()

Sort results by node id

to_df()

Convert results to pandas DataFrame

top_k(k)

Compute the k largest values

valid_layers(names)

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

values()

Iterate over values

window(start, end)

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

Attributes:

end

Gets the latest time that this EarliestDateTimeView is valid.

end_date_time

Gets the latest datetime that this EarliestDateTimeView is valid

start

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

start_date_time

Gets the earliest datetime that this EarliestDateTimeView is valid

window_size

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

after(start)#

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

Parameters:

start (TimeInput) – The start time of the window.

Return type:

EarliestDateTimeView

at(time)#

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

Parameters:

time (TimeInput) – The time of the window.

Return type:

EarliestDateTimeView

before(end)#

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

Parameters:

end (TimeInput) – The end time of the window.

Return type:

EarliestDateTimeView

bottom_k(k)#

Compute the k smallest values

Parameters:

k (int) – The number of values to return

Returns:

The k smallest values as a node state

Return type:

NodeStateOptionDateTime

collect()#

Compute all values and return the result as a list

Returns:

all values as a list

Return type:

list[Optional[datetime]]

compute()#

Compute all values and return the result as a node view

Returns:

the computed NodeState

Return type:

NodeStateOptionDateTime

default_layer()#

Return a view of EarliestDateTimeView containing only the default edge layer :returns: The layered view :rtype: EarliestDateTimeView

end#

Gets the latest time that this EarliestDateTimeView is valid.

Returns:

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

Return type:

Optional[int]

end_date_time#

Gets the latest datetime that this EarliestDateTimeView is valid

Returns:

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

Return type:

Optional[datetime]

exclude_layer(name)#

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

Parameters:

name (str) – layer name that is excluded for the new view

Returns:

The layered view

Return type:

EarliestDateTimeView

exclude_layers(names)#

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

Parameters:

names (list[str]) – list of layer names that are excluded for the new view

Returns:

The layered view

Return type:

EarliestDateTimeView

exclude_valid_layer(name)#

Return a view of EarliestDateTimeView containing all layers except the excluded name :param name: layer name that is excluded for the new view :type name: str

Returns:

The layered view

Return type:

EarliestDateTimeView

exclude_valid_layers(names)#

Return a view of EarliestDateTimeView containing all layers except the excluded names :param names: list of layer names that are excluded for the new view :type names: list[str]

Returns:

The layered view

Return type:

EarliestDateTimeView

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:

step (int | str) – The step size of the window.

Returns:

A WindowSet object.

Return type:

WindowSet

get(node, default=...)#

Get value for node

Parameters:
Returns:

the value for the node or the default value

Return type:

Optional[Optional[datetime]]

groups()#

Group by value

Returns:

The grouped nodes

Return type:

NodeGroups

has_layer(name)#

Check if EarliestDateTimeView has the layer “name”

Parameters:

name (str) – the name of the layer to check

Return type:

bool

items()#

Iterate over items

Returns:

Iterator over items

Return type:

Iterator[Tuple[Node, Optional[datetime]]]

latest()#

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

Return type:

EarliestDateTimeView

layer(name)#

Return a view of EarliestDateTimeView containing the layer “name” Errors if the layer does not exist

Parameters:

name (str) – then name of the layer.

Returns:

The layered view

Return type:

EarliestDateTimeView

layers(names)#

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

Parameters:

names (list[str]) – list of layer names for the new view

Returns:

The layered view

Return type:

EarliestDateTimeView

max()#

Return the maximum value

Returns:

The maximum value or None if empty

Return type:

Optional[Optional[datetime]]

max_item()#

Return largest value and corresponding node

Returns:

The Node and maximum value or None if empty

Return type:

Optional[Tuple[Node, Optional[datetime]]]

median()#

Return the median value

Return type:

Optional[Optional[datetime]]

median_item()#

Return median value and corresponding node

Returns:

The median value or None if empty

Return type:

Optional[Tuple[Node, Optional[datetime]]]

min()#

Return the minimum value

Returns:

The minimum value or None if empty

Return type:

Optional[Optional[datetime]]

min_item()#

Return smallest value and corresponding node

Returns:

The Node and minimum value or None if empty

Return type:

Optional[Tuple[Node, Optional[datetime]]]

nodes()#

Iterate over nodes

Returns:

The nodes

Return type:

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:
  • window (int | str) – The size of the window.

  • step (int | str | None) – The step size of the window. step defaults to window.

Returns:

A WindowSet object.

Return type:

WindowSet

shrink_end(end)#

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

Parameters:

end (TimeInput) – the new end time of the window

Return type:

EarliestDateTimeView

shrink_start(start)#

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

Parameters:

start (TimeInput) – the new start time of the window

Return type:

EarliestDateTimeView

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:
  • start (TimeInput) – the new start time for the window

  • end (TimeInput) – the new end time for the window

Return type:

EarliestDateTimeView

snapshot_at(time)#

Create a view of the EarliestDateTimeView 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:

time (TimeInput) – The time of the window.

Return type:

EarliestDateTimeView

snapshot_latest()#

Create a view of the EarliestDateTimeView 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

Return type:

EarliestDateTimeView

sorted(reverse=False)#

Sort by value

Parameters:

reverse (bool) – If True, sort in descending order, otherwise ascending. Defaults to False.

Returns:

Sorted node state

Return type:

NodeStateOptionDateTime

sorted_by_id()#

Sort results by node id

Returns:

The sorted node state

Return type:

NodeStateOptionDateTime

start#

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

Returns:

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

Return type:

Optional[int]

start_date_time#

Gets the earliest datetime that this EarliestDateTimeView is valid

Returns:

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

Return type:

Optional[datetime]

to_df()#

Convert results to pandas DataFrame

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

Returns:

the pandas DataFrame

Return type:

DataFrame

top_k(k)#

Compute the k largest values

Parameters:

k (int) – The number of values to return

Returns:

The k largest values as a node state

Return type:

NodeStateOptionDateTime

valid_layers(names)#

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

Parameters:

names (list[str]) – list of layer names for the new view

Returns:

The layered view

Return type:

EarliestDateTimeView

values()#

Iterate over values

Returns:

Iterator over values

Return type:

Iterator[Optional[datetime]]

window(start, end)#

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

Parameters:
  • start (TimeInput | None) – The start time of the window (unbounded if None).

  • end (TimeInput | None) – The end time of the window (unbounded if None).

Return type:

EarliestDateTimeView

window_size#

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

Return type:

Optional[int]