weaverbird
weaverbird copied to clipboard
'percentage' step to Python postprocess
Exemple 1: with groups and result in new column
This 'percentage' step config in our VQB "language"...
{
name: 'percentage'
new_column: 'new_col'
column: 'bar'
group: ['foo']
}
... should yield the following postprocess pipeline:
{
percentage:
new_column: 'new_col'
column: 'bar'
group_cols: ['foo']
}
{
formula:
new_column: 'new_col' # writes result inplace
formula: "new_col / 100" # We need to divide by 100 to get a result between 0 and 1 while the percentage step returns values between 0 and 100
}
Exemple 2: without groups and result in existing column
This 'percentage' step config in our VQB "language"...
{
name: 'percentage'
column: 'bar'
}
... should yield the following postprocess pipeline:
{
percentage:
column: 'bar'
}
{
formula:
new_column: 'bar' # writes result inplace
formula: "bar / 100" # We need to divide by 100 to get a result between 0 and 1 while the percentage step returns values between 0 and 100
}