LatestDateTimeView
#
Bases: object
A lazy view over node values
end
property
#
Gets the latest time that this LatestDateTimeView is valid.
Returns:
Type | Description |
---|---|
Optional[int]
|
The latest time that this LatestDateTimeView is valid or None if the LatestDateTimeView is valid for all times. |
end_date_time
property
#
Gets the latest datetime that this LatestDateTimeView is valid
Returns:
Type | Description |
---|---|
Optional[datetime]
|
The latest datetime that this LatestDateTimeView is valid or None if the LatestDateTimeView is valid for all times. |
start
property
#
Gets the start time for rolling and expanding windows for this LatestDateTimeView
Returns:
Type | Description |
---|---|
Optional[int]
|
The earliest time that this LatestDateTimeView is valid or None if the LatestDateTimeView is valid for all times. |
start_date_time
property
#
Gets the earliest datetime that this LatestDateTimeView is valid
Returns:
Type | Description |
---|---|
Optional[datetime]
|
The earliest datetime that this LatestDateTimeView is valid or None if the LatestDateTimeView is valid for all times. |
window_size
property
#
Get the window size (difference between start and end) for this LatestDateTimeView
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 LatestDateTimeView including all events after start
(exclusive).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
TimeInput
|
The start time of the window. |
required |
Returns:
Type | Description |
---|---|
LatestDateTimeView
|
|
at(time)
#
Create a view of the LatestDateTimeView including all events at time
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time
|
TimeInput
|
The time of the window. |
required |
Returns:
Type | Description |
---|---|
LatestDateTimeView
|
|
before(end)
#
Create a view of the LatestDateTimeView including all events before end
(exclusive).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
end
|
TimeInput
|
The end time of the window. |
required |
Returns:
Type | Description |
---|---|
LatestDateTimeView
|
|
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 |
---|---|
NodeStateOptionDateTime
|
The k smallest values as a node state |
collect()
#
compute()
#
Compute all values and return the result as a node view
Returns:
Type | Description |
---|---|
NodeStateOptionDateTime
|
the computed |
default_layer()
#
Return a view of LatestDateTimeView containing only the default edge layer Returns: LatestDateTimeView: The layered view
exclude_layer(name)
#
Return a view of LatestDateTimeView 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 |
---|---|
LatestDateTimeView
|
The layered view |
exclude_layers(names)
#
Return a view of LatestDateTimeView 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 |
---|---|
LatestDateTimeView
|
The layered view |
exclude_valid_layer(name)
#
Return a view of LatestDateTimeView containing all layers except the excluded name
Arguments:
name (str): layer name that is excluded for the new view
Returns:
Type | Description |
---|---|
LatestDateTimeView
|
The layered view |
exclude_valid_layers(names)
#
Return a view of LatestDateTimeView 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 |
---|---|
LatestDateTimeView
|
The layered view |
expanding(step)
#
get(node, default=None)
#
groups()
#
has_layer(name)
#
items()
#
latest()
#
Create a view of the LatestDateTimeView including all events at the latest time.
Returns:
Type | Description |
---|---|
LatestDateTimeView
|
|
layer(name)
#
Return a view of LatestDateTimeView 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 |
---|---|
LatestDateTimeView
|
The layered view |
layers(names)
#
Return a view of LatestDateTimeView 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 |
---|---|
LatestDateTimeView
|
The layered view |
max()
#
Return the maximum value
Returns:
Type | Description |
---|---|
Optional[Optional[datetime]]
|
The maximum value or |
max_item()
#
median()
#
Return the median value
Returns:
Type | Description |
---|---|
value
|
Optional[Optional[datetime]]: |
median_item()
#
min()
#
Return the minimum value
Returns:
Type | Description |
---|---|
Optional[Optional[datetime]]
|
The minimum value or |
min_item()
#
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.
|
None
|
Returns:
Type | Description |
---|---|
WindowSet
|
A |
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: LatestDateTimeView:
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 |
---|---|
LatestDateTimeView
|
|
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 |
---|---|
LatestDateTimeView
|
|
snapshot_at(time)
#
Create a view of the LatestDateTimeView 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 |
---|---|
LatestDateTimeView
|
|
snapshot_latest()
#
Create a view of the LatestDateTimeView 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 |
---|---|
LatestDateTimeView
|
|
sorted(reverse=False)
#
Sort by value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reverse
|
bool
|
If |
False
|
Returns:
Type | Description |
---|---|
NodeStateOptionDateTime
|
Sorted node state |
sorted_by_id()
#
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 |
---|---|
NodeStateOptionDateTime
|
The k largest values as a node state |
valid_layers(names)
#
Return a view of LatestDateTimeView 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 |
---|---|
LatestDateTimeView
|
The layered view |
values()
#
window(start, end)
#
Create a view of the LatestDateTimeView 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 |
required |
end
|
TimeInput | None
|
The end time of the window (unbounded if |
required |
Returns:
Type | Description |
---|---|
LatestDateTimeView
|
|