Skip to content

Commit

Permalink
add data type to filter plugin output values
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzoic committed Jul 10, 2024
1 parent 843c5e9 commit e6faae9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion countess/plugins/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
BooleanParam,
ChoiceParam,
ColumnChoiceParam,
DataTypeChoiceParam,
MultiParam,
StringParam,
TabularMultiParam,
Expand Down Expand Up @@ -56,6 +57,7 @@ class FilterPlugin(PandasSimplePlugin):
{
"output": StringParam("Output Column"),
"value": StringParam("Output Value"),
"type": DataTypeChoiceParam("Output Type", "string"),
},
),
),
Expand All @@ -71,7 +73,7 @@ def process(self, data: pd.DataFrame, source: str, logger: Logger) -> Iterable[p

for filt in self.parameters["filters"]:
# build a dictionary of columns to assign to matched rows.
assign_dict = {p["output"].value: p["value"].value for p in filt["outputs"]}
assign_dict = {p["output"].value: p["type"].cast_value(p["value"].value) for p in filt["outputs"]}

if not filt.columns.params:
# If there are no filter columns at all, then we match
Expand Down

0 comments on commit e6faae9

Please sign in to comment.