From 001bd7d098d55ad82d628111896d637a8bfe9863 Mon Sep 17 00:00:00 2001 From: David Gardner Date: Mon, 3 Jun 2024 08:50:55 -0700 Subject: [PATCH] Fix a spelling error and some docstrings --- .../preprocess/group_by_column_stage.py | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/morpheus/stages/preprocess/group_by_column_stage.py b/morpheus/stages/preprocess/group_by_column_stage.py index 97c8242ecd..d69504dd27 100644 --- a/morpheus/stages/preprocess/group_by_column_stage.py +++ b/morpheus/stages/preprocess/group_by_column_stage.py @@ -43,21 +43,35 @@ def name(self) -> str: return "group-by-column" def accepted_types(self) -> tuple: + """ + Returns accepted input types for this stage. + """ return (MessageMeta, ) def supports_cpp_node(self) -> bool: + """ + Indicates whether this stage supports C++ node. + """ return False def on_data(self, message: MessageMeta) -> list[MessageMeta]: + """ + Group the incoming message by a column in the DataFrame. + + Parameters + ---------- + message : MessageMeta + Incoming message + """ with message.mutable_dataframe() as df: grouper = df.groupby(self._column_name) - ouptut_messages = [] + output_messages = [] for group_name in sorted(grouper.groups.keys()): group_df = grouper.get_group(group_name) - ouptut_messages.append(MessageMeta(group_df)) + output_messages.append(MessageMeta(group_df)) - return ouptut_messages + return output_messages def _build_single(self, builder: mrc.Builder, input_node: mrc.SegmentObject) -> mrc.SegmentObject: node = builder.make_node(self.unique_name, ops.map(self.on_data), ops.flatten())