json_pivot_operator¶
Operator that returns an iterator of json data.
-
class
tasrif.processing_pipeline.custom.json_pivot_operator.
JsonPivotOperator
(feature_names)¶ Operator that converts column with structured json data into dataframe multiple feature_names
Example
>>> import pandas as pd >>> from tasrif.processing_pipeline.custom import JsonPivotOperator
>>> df = pd.DataFrame({'id': [1, 2, 3], 'data':["{"calories":1000, "distance":5, "steps":2}", ... "{"calories":2000, "distance":15, "steps":12}", "{"calories":1000, "distance":5, "steps":2}"]})
>>> op = JsonPivotOperator(['data']) >>> op.process(df)
>>> op
id calories distance steps
0 1 1000 5 2 1 2 2000 15 12 2 3 1000 5 2
-
__init__
(feature_names)¶ Creates a new instance of JsonPivotOperator
- Parameters
feature_names (list of str) – The feature_names which contains Json data
-