morpheus.messages.message_meta.AppShieldMessageMeta#
- class AppShieldMessageMeta(**kwargs)[source]#
Bases:
MessageMetaThis class extends MessageMeta to also hold source corresponding to batched metadata.
- Parameters:
- dfpd.DataFrame
Input rows in dataframe.
- sourcestr
Determines which source generated the snapshot messages.
- Attributes:
countReturns the number of messages in the batch.
- df
Methods
copy_ranges(ranges)Perform a copy of the current message instance for the given
rangesof rows.Replaces the index in the underlying dataframe if the existing one is not unique and monotonic.
get_data([columns])Return column values from the underlying DataFrame.
get_meta_range(mess_offset, message_count[, ...])Return column values from
morpheus.pipeline.messages.MessageMeta.dffrom the specified start offset until the message count.get_slice(start, stop)Returns a new MessageMeta with only the rows specified by start/stop.
Returns True if the underlying DataFrame's index is unique and monotonic.
set_data(columns, value)Set column values to the underlying DataFrame.
copy_dataframe
get_column_names
mutable_dataframe
- copy_ranges(ranges)[source]#
Perform a copy of the current message instance for the given
rangesof rows.- Parameters:
- rangestyping.List[typing.Tuple[int, int]]
Rows to include in the copy in the form of
[(`start_row,stop_row),…]` Thestop_rowisn’t included. For example to copy rows 1-2 & 5-7ranges=[(1, 3), (5, 8)]
- Returns:
MessageMetaA new
MessageMetawith only the rows specified byranges.
- property count: int#
Returns the number of messages in the batch.
- Returns:
- int
number of messages in the MessageMeta.df.
- ensure_sliceable_index()[source]#
Replaces the index in the underlying dataframe if the existing one is not unique and monotonic. The old index will be preserved in a column named
_index_{old_index.name}. Ifhas_sliceable_index() == true, this is a no-op.- Returns:
- str
The name of the column with the old index or
Noneif no changes were made
- get_data(columns=None)[source]#
Return column values from the underlying DataFrame.
- Parameters:
- columnstyping.Union[None, str, typing.List[str]]
Input column names. Returns all columns if
Noneis specified. When a string is passed, aSeriesis returned. Otherwise, aDataframeis returned.
- Returns:
- Series or Dataframe
Column values from the dataframe.
- get_meta_range(
- mess_offset,
- message_count,
- columns=None,
Return column values from
morpheus.pipeline.messages.MessageMeta.dffrom the specified start offset until the message count.- Parameters:
- mess_offsetint
Offset into the metadata batch.
- message_countint
Messages count.
- columnstyping.Union[None, str, typing.List[str]]
Input column names. Returns all columns if
Noneis specified. When a string is passed, aSeriesis returned. Otherwise aDataframeis returned.
- Returns:
- Series or Dataframe
Column values from the dataframe.
- get_slice(start, stop)[source]#
Returns a new MessageMeta with only the rows specified by start/stop.
- Parameters:
- startint
Start offset address.
- stopint
Stop offset address.
- Returns:
MessageMetaA new
MessageMetawith sliced offset and count.
- has_sliceable_index()[source]#
Returns True if the underlying DataFrame’s index is unique and monotonic. Sliceable indices have better performance since a range of rows can be specified by a start and stop index instead of requiring boolean masks.
- Returns:
- bool
- set_data(columns, value)[source]#
Set column values to the underlying DataFrame.
- Parameters:
- columnstyping.Union[None, str, typing.List[str]]
Input column names. Sets the value for the corresponding column names. If
Noneis specified, all columns will be used. If the column does not exist, a new one will be created.- valueAny
Value to apply to the specified columns. If a single value is passed, it will be broadcast to all rows. If a
SeriesorDataframeis passed, rows will be matched by index.