not_(frame, name=None, metadata=None)
Return one where elements are falsy and zero where they are truthy.
Parameters
- frame : Panel | Graph
- Input numeric
Panelor single-outputGraph. name : str | None, defaultNone - Optional graph-node name. A generated name is used when omitted.
metadata : Mapping[str, Any] | None, default
None - Optional metadata stored on the graph node.
Returns
- Graph
- Lazy single-output graph. Call
.compute()to materialize aPanel.
Examples
import polars as pl
from bagelquant_core import Domain, Panel
from bagelquant_core.composer import not_
domain = Domain(calendar=["2024-01-02", "2024-01-03", "2024-01-04"], universe=["a", "b"])
left = Panel.from_domain(
pl.DataFrame({
"time": ["2024-01-02", "2024-01-03", "2024-01-04"] * 2,
"asset_id": ["a"] * 3 + ["b"] * 3,
"value": [1.0, 2.0, 4.0, 2.0, 3.0, 8.0],
}),
domain,
)
right = Panel.from_domain(
pl.DataFrame({
"time": ["2024-01-02", "2024-01-03", "2024-01-04"] * 2,
"asset_id": ["a"] * 3 + ["b"] * 3,
"value": [1.0, 1.0, 2.0, 1.0, 2.0, 4.0],
}),
domain,
)
result = not_(left).compute().data
print(result)
Notes
Inputs are aligned by (time, asset_id) before the operation runs.
Logical and comparison results are numeric panels containing 1.0 and 0.0.