Skip to content

pandas.Series.to_expr

Converts a pandas Series to a Pyoframe Expression, using the index for labels.

See Special Functions for more details.

Note that no equivalent method exists for Polars Series, as Polars does not support indexes.

Source code in pyoframe/_monkey_patch.py
def pandas_series_to_expr(self: pd.Series) -> Expression:
    """Converts a [pandas](https://pandas.pydata.org/) `Series` to a Pyoframe [Expression][pyoframe.Expression], using the index for labels.

    See [Special Functions](../../learn/concepts/special-functions.md#dataframeto_expr) for more details.

    Note that no equivalent method exists for Polars Series, as Polars does not support indexes.
    """
    return pandas_df_to_expr(self.to_frame().reset_index())