stream_graph.ITemporalNodeSetDF¶
-
class
stream_graph.ITemporalNodeSetDF(df=None, no_duplicates=True, sort_by=None, discrete=None)[source][source]¶ DataFrame implementation of ABC.ITemporalNodeSet
- Parameters
- df: pandas.DataFrame or Iterable, default=None
If a DataFrame it should contain two columns for u and ts. If an Iterable it should produce
(u, ts)tuples of one NodeId (int or str) and a timestamp (Real).- no_duplicates: Bool, default=True
Defines if for each node all intervals are disjoint.
- sort_by: Any non-empty subset of [‘u’, ‘ts’], default=[‘u’, ‘ts’].
The order of the DataFrame elements by which they will be produced when iterated.
- Attributes
- df
discreteDesignate if the TemporalNodeSet is on discrete Time.
instantaneousDefines if the Time Set is instantaneous.
- is_merged_
- is_sorted_
nReturns number of nodes of the TemporalNodeSet.
nodesetReturn the nodeset that can be derived from this TemporalNodeSet.
- number_of_instants
sizeReturns the size of the TemporalNodeSet.
- sort_
- sort_by
- sorted_df
timesetReturn the timeset that can be derived from this TemporalNodeSet.
total_common_timeReturns the total time that each node shares with all the other nodes of the TemporalNodeSet.
total_timeReturns the size of the derived TimeSet.
Methods
common_time(self[, u])common_time_pair(self[, l])copy(self[, deep])Returns a deep or shallow copy of the current TemporalNodeSet.
discretize(self[, bins, bin_size])Returns a discrete version of the current TemporalNodeSet.
duration_of(self[, u])issuperset(self, ns)n_at(self[, t])nodes_at(self[, t])sort_df(self, sort_by)Return a sorted version of the data-frame given an order or retrieves it if already sorted.
times_of(self[, u])substream
-
__class__[source]¶ alias of
abc.ABCMeta
-
__delattr__(self, name, /)¶ Implement delattr(self, name).
-
__dir__()¶ default dir() implementation
-
__eq__(self, value, /)¶ Return self==value.
-
__format__()¶ default object formatter
-
__ge__(self, value, /)¶ Return self>=value.
-
__getattribute__(self, name, /)¶ Return getattr(self, name).
-
__gt__(self, value, /)¶ Return self>value.
-
__hash__(self, /)¶ Return hash(self).
-
__init_subclass__()¶ This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
-
__le__(self, value, /)¶ Return self<=value.
-
__lt__(self, value, /)¶ Return self<value.
-
__ne__(self, value, /)¶ Return self!=value.
-
__new__(*args, **kwargs)¶ Create and return a new object. See help(type) for accurate signature.
-
__reduce__()¶ helper for pickle
-
__reduce_ex__()¶ helper for pickle
-
__repr__(self, /)¶ Return repr(self).
-
__setattr__(self, name, value, /)¶ Implement setattr(self, name, value).
-
__sizeof__()¶ size of object in memory, in bytes
-
__subclasshook__()¶ Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
-
__weakref__¶ list of weak references to the object (if defined)
-
copy(self, deep=True)[source]¶ Returns a deep or shallow copy of the current TemporalNodeSet.
- Parameters
- deepBool
- Returns
- temporal_nodeset_copyTemporalNodeSet
Returns a deep or shallow copy of the current TemporalNodeSet.
-
discretize(self, bins=None, bin_size=None)[source]¶ Returns a discrete version of the current TemporalNodeSet.
- Parameters
- binsIterable or None.
If None, step should be provided. If Iterable it should contain n+1 elements that declare the start and the end of all (continuous) bins.
- bin_sizeInt or datetime
If bins is provided this argument is ommited. Else declare the size of each bin.
- Returns
- timeset_discreteTimeSet
Returns a discrete version of the TimeSet.
- binslist
A list of the created bins.
-
property
instantaneous¶ Defines if the Time Set is instantaneous.
-
property
n¶ Returns number of nodes of the TemporalNodeSet.
- Parameters
- None. Property.
- Returns
- nInt
Returns the number of distinct nodes in the TemporalNodeSet.
-
sort_df(self, sort_by)[source][source]¶ Return a sorted version of the data-frame given an order or retrieves it if already sorted.
-
property
total_time¶ Returns the size of the derived TimeSet.
- Parameters
- None. Property.
- Returns
- total_timeReal
The total amount of time from the union of intervals that nodes exist.