HistoryDateTimeView#
- class HistoryDateTimeView#
Bases:
object
A lazy view over node values
Methods:
after
(start)Create a view of the HistoryDateTimeView including all events after start (exclusive).
at
(time)Create a view of the HistoryDateTimeView including all events at time.
before
(end)Create a view of the HistoryDateTimeView 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
Return a view of HistoryDateTimeView containing only the default edge layer :returns: The layered view :rtype: HistoryDateTimeView
exclude_layer
(name)Return a view of HistoryDateTimeView containing all layers except the excluded name Errors if any of the layers do not exist.
exclude_layers
(names)Return a view of HistoryDateTimeView containing all layers except the excluded names Errors if any of the layers do not exist.
exclude_valid_layer
(name)Return a view of HistoryDateTimeView 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 HistoryDateTimeView 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
has_layer
(name)Check if HistoryDateTimeView has the layer "name"
items
()Iterate over items
latest
()Create a view of the HistoryDateTimeView including all events at the latest time.
layer
(name)Return a view of HistoryDateTimeView containing the layer "name" Errors if the layer does not exist
layers
(names)Return a view of HistoryDateTimeView 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
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 HistoryDateTimeView including all events that have not been explicitly deleted at time.
Create a view of the HistoryDateTimeView including all events that have not been explicitly deleted at the latest time.
sorted
([reverse])Sort by value
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 HistoryDateTimeView containing all layers names Any layers that do not exist are ignored
values
()Iterate over values
window
(start, end)Create a view of the HistoryDateTimeView including all events between start (inclusive) and end (exclusive)
Attributes:
Gets the latest time that this HistoryDateTimeView is valid.
Gets the latest datetime that this HistoryDateTimeView is valid
Gets the start time for rolling and expanding windows for this HistoryDateTimeView
Gets the earliest datetime that this HistoryDateTimeView is valid
Get the window size (difference between start and end) for this HistoryDateTimeView
- after(start)#
Create a view of the HistoryDateTimeView including all events after start (exclusive).
- Parameters:
start (TimeInput) – The start time of the window.
- Return type:
- at(time)#
Create a view of the HistoryDateTimeView including all events at time.
- Parameters:
time (TimeInput) – The time of the window.
- Return type:
- before(end)#
Create a view of the HistoryDateTimeView including all events before end (exclusive).
- Parameters:
end (TimeInput) – The end time of the window.
- Return type:
- 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:
- collect()#
Compute all values and return the result as a list
- compute()#
Compute all values and return the result as a node view
- Returns:
the computed NodeState
- Return type:
- default_layer()#
Return a view of HistoryDateTimeView containing only the default edge layer :returns: The layered view :rtype: HistoryDateTimeView
- end#
Gets the latest time that this HistoryDateTimeView is valid.
- end_date_time#
Gets the latest datetime that this HistoryDateTimeView is valid
- 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 (str) – layer name that is excluded for the new view
- Returns:
The layered view
- Return type:
- exclude_layers(names)#
Return a view of HistoryDateTimeView containing all layers except the excluded names Errors if any of the layers do not exist.
- exclude_valid_layer(name)#
Return a view of HistoryDateTimeView 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:
- exclude_valid_layers(names)#
Return a view of HistoryDateTimeView 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:
- 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.
- get(node, default=...)#
Get value for node
- has_layer(name)#
Check if HistoryDateTimeView has the layer “name”
- items()#
Iterate over items
- latest()#
Create a view of the HistoryDateTimeView including all events at the latest time.
- Return type:
- layer(name)#
Return a view of HistoryDateTimeView 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:
- layers(names)#
Return a view of HistoryDateTimeView containing all layers names Errors if any of the layers do not exist.
- Parameters:
- Returns:
The layered view
- Return type:
- max()#
Return the maximum value
- max_item()#
Return largest value and corresponding node
- median_item()#
Return median value and corresponding node
- min()#
Return the minimum value
- min_item()#
Return smallest value and corresponding node
- 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.
- 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:
- 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:
- 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:
- Return type:
- 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:
time (TimeInput) – The time of the window.
- Return type:
- 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
- Return type:
- 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:
- sorted_by_id()#
Sort results by node id
- Returns:
The sorted node state
- Return type:
- start#
Gets the start time for rolling and expanding windows for this HistoryDateTimeView
- start_date_time#
Gets the earliest datetime that this HistoryDateTimeView is valid
- 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:
- 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:
- valid_layers(names)#
Return a view of HistoryDateTimeView containing all layers names Any layers that do not exist are ignored
- Parameters:
- Returns:
The layered view
- Return type:
- values()#
Iterate over values
- window(start, end)#
Create a view of the HistoryDateTimeView including all events between start (inclusive) and end (exclusive)
- Parameters:
- Return type: