EXPAND ALL
- Home
- About Pixie
- Installing Pixie
- Using Pixie
- Tutorials
- Reference
Adds a column with the specified name and the expression that evaluates to the column value. The evaluation of this expression happens inside of the Pixie engine (Carnot) thus cannot be directly accessed during compilation. The expression can be a scalar value, a column from the same dataframe, or a UDF function call. The syntax can be either df['colname'] = expr
or df.colname = expr
, the second option is simply syntactic sugar. The first form is slightly more expressive as you can set column names with spaces.
Name | Type | Description |
---|---|---|
column_name | str | The name of the column to assign this value. |
expr | ScalarExpression | The expression to evaluate in Carnot. |
df = px.DataFrame('process_stats')# Map scalar value to a column.df['number'] = 12
df = px.DataFrame('http_events')df.svc = df.ctx['svc']# Map column to another column name.df.resp_body = df.resp_body
df = px.DataFrame('http_events')# Map expression to the column.df['latency_ms'] = df['resp_latency_ns'] / 1.0e9