pandas_paddles.paddles.ensure_DF_expr#

pandas_paddles.paddles.ensure_DF_expr(col)[source]#

Convert column names to DF-expressions when necessary.

Parameters

col (Union[str, pandas_paddles.pandas.PandasDataframeContext]) – The column name (str) or a DF-expression.

Returns

The DF-expression of col (if a str) or just col.

Return type

PandasDataframeContext

Examples

Strings are converted to DF-expressions:

>>> ensure_DF_expr("col-name")
DF["col-name"]

DF-expressions are passed through:

>>> expr2 = DF["another-column"]
>>> expr2 is ensure_DF_expr(expr2)
True