Skip to content

Commit

Permalink
Add argument inference to integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeSneyders committed Jan 17, 2024
1 parent 19b290b commit 97cc1ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion examples/sample_pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,17 @@
],
)
class CalculateChunkLength(PandasTransformComponent):
def __init__(self, feature_name: str, **kwargs):
self.feature_name = feature_name

def transform(self, dataframe: pd.DataFrame) -> pd.DataFrame:
dataframe["chunk_length"] = dataframe["text"].apply(len)
dataframe[self.feature_name] = dataframe["text"].apply(len)
return dataframe


_ = dataset.apply(
ref=CalculateChunkLength,
consumes={"text": pa.string()},
produces={"chunk_length": pa.int32()},
arguments={"feature_name": "chunk_length"},
)

0 comments on commit 97cc1ea

Please sign in to comment.