What can I help you with?
NVIDIA Morpheus (25.02.01)

morpheus.messages.message_meta.MessageMeta

class MessageMeta(df)[source]

Bases: morpheus.messages.message_base.MessageBase

This is a container class to hold batch deserialized messages metadata.

Parameters
dfpandas.DataFrame

Input rows in dataframe.

Attributes
count

Returns the number of messages in the batch.

df

Methods

copy_ranges(ranges) Perform a copy of the current message instance for the given ranges of rows.
ensure_sliceable_index() Replaces the index in the underlying dataframe if the existing one is not unique and monotonic.
get_data() Return column values from the underlying DataFrame.
get_meta_range(mess_offset, message_count[, ...]) Return column values from morpheus.pipeline.messages.MessageMeta.df from the specified start offset until the message count.
get_slice(start, stop) Returns a new MessageMeta with only the rows specified by start/stop.
has_sliceable_index() 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 ranges of rows.

Parameters
rangestyping.List[typing.Tuple[int, int]]

Rows to include in the copy in the form of [(`start_row, stop_row),…]` The stop_row isn’t included. For example to copy rows 1-2 & 5-7 ranges=[(1, 3), (5, 8)]

Returns
MessageMeta

A new MessageMeta with only the rows specified by ranges.

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}. If has_sliceable_index() == true, this is a no-op.

Returns
str

The name of the column with the old index or None if no changes were made

get_data() → DataFrameType[source]
get_data(columns: str) → SeriesType
get_data(columns: List[str]) → DataFrameType

Return column values from the underlying DataFrame.

Parameters
columnstyping.Union[None, str, typing.List[str]]

Input column names. Returns all columns if None is specified. When a string is passed, a Series is returned. Otherwise, a Dataframe is returned.

Returns
Series or Dataframe

Column values from the dataframe.

get_meta_range(mess_offset, message_count, columns=None)[source]

Return column values from morpheus.pipeline.messages.MessageMeta.df from 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 None is specified. When a string is passed, a Series is returned. Otherwise a Dataframe is 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
MessageMeta

A new MessageMeta with 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 None is 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 Series or Dataframe is passed, rows will be matched by index.

Previous morpheus.messages.message_meta.AppShieldMessageMeta
Next morpheus.messages.message_meta.MutableTableCtxMgr
© Copyright 2024, NVIDIA. Last updated on Mar 3, 2025.