superleaf.dataframe.column_ops#
Classes
|
Represent a named column in a DataFrame. |
|
Abstract base class for column operations on pandas DataFrames. |
|
Represent the index of a pandas DataFrame. |
|
Represent the values of a pandas Series. |
- class superleaf.dataframe.column_ops.ColOp[source]#
Bases:
object
Abstract base class for column operations on pandas DataFrames.
Subclasses implement transformations or evaluations that produce pandas Series or scalar results when applied to DataFrames. Supports chaining and combining using logical and arithmetic operators.
Operators defined on this class:
|
(bitwise or),&
(bitwise and),~
(bitwise not),==
(equal to),!=
(not equal to),<
(less than),<=
(less than or equal to),>
(greater than),>=
(greater than or equal to),+
(addition),-
(subtraction),*
(multiplication),/
(division),^
(power)- apply(f: Callable[[Series], Series]) ColOp [source]#
Apply a transformation function to the result of this operation.
- Parameters:
f (callable) – A function that takes a pandas Series and returns a transformed Series.
- Returns:
A new ColOp representing the application of
f
to this operation’s output.- Return type:
- map(f: Callable[[Any], Any]) ColOp [source]#
Map a function over each element of the Series produced by this operation.
- Parameters:
f (callable) – A function applied element-wise to each value in the Series.
- Returns:
A new ColOp representing the mapped operation.
- Return type:
- isin(values: Iterable[Any]) ColOp [source]#
Test whether each element of the Series is in the given values.
- Parameters:
values (iterable) – A collection of values to test membership against.
- Returns:
A new ColOp that yields a boolean Series.
- Return type:
- contains(value: Any) ColOp [source]#
Test whether each element of the Series contains the specified value.
- Parameters:
value (Any) – Value to search for within each element.
- Returns:
A new ColOp that yields a boolean Series.
- Return type:
- notna() ColOp [source]#
Test for non-missing values in the Series.
- Returns:
A new ColOp yielding a boolean Series where True indicates non-null values.
- Return type:
- isna() ColOp [source]#
Test for missing values in the Series.
- Returns:
A new ColOp yielding a boolean Series where True indicates null values.
- Return type:
- class superleaf.dataframe.column_ops.Index[source]#
Bases:
ColOp
Represent the index of a pandas DataFrame.
- Parameters:
None
Examples
>>> idx = Index() >>> idx(df) DatetimeIndex([...])
- class superleaf.dataframe.column_ops.Col(name: str | None)[source]#
Bases:
ColOp
Represent a named column in a DataFrame.
- Parameters:
name (str, optional) – Column name to select. If None, selects the entire DataFrame.
Examples
>>> col = Col('column_name') >>> col(df) 0 ... Name: column_name, dtype: dtype