transform: transform and calculate data in tables
Code author: Peter Kraus
The function dgpost.utils.transform.transform()
processes the below specification
in order to do data transformation on an extracted (or supplied) pd.DataFrame
.
- pydantic model dgbowl_schemas.dgpost.recipe.Transform
Calculate and otherwise transform the data in the tables.
Show JSON schema
{ "title": "Transform", "description": "Calculate and otherwise transform the data in the tables.", "type": "object", "properties": { "table": { "title": "Table", "type": "string" }, "with": { "title": "With", "type": "string" }, "using": { "items": { "type": "object" }, "title": "Using", "type": "array" } }, "additionalProperties": false, "required": [ "table", "with", "using" ] }
- Config:
extra: str = forbid
populate_by_name: bool = True
- field table: str [Required]
The name of the table loaded in memory to be transformed.
- field with_: str [Required] (alias 'with')
The name of the transform function from dgpost’s transform library.
- field using: Sequence[Dict[str, Any]] [Required]
Specification of any parameters required by the transform function.
Warning
The arguments passed to the transformation function in the transform.using
Sequence
have to be dict
with str
-type keys. The
values will be coerced to appropriate types using the transform function
decorator: dgpost.transform.helpers.load_data()
.
- dgpost.utils.transform.transform(table: DataFrame, withstr: str, using: list[dict]) None