(
asset_names: Sequence[str],
weights: Sequence[float],
as_of: str | None = None,
)
| 74 | |
| 75 | |
| 76 | def to_polars_weights_frame( |
| 77 | asset_names: Sequence[str], |
| 78 | weights: Sequence[float], |
| 79 | as_of: str | None = None, |
| 80 | ) -> pl.DataFrame: |
| 81 | _validate_equal_length("asset_names", asset_names, "weights", weights) |
| 82 | data: dict[str, object] = {"asset": list(asset_names), "weight": list(weights)} |
| 83 | if as_of is not None: |
| 84 | data["as_of"] = [as_of] * len(asset_names) |
| 85 | df = pl.DataFrame(data) |
| 86 | if as_of is not None: |
| 87 | df = df.with_columns(pl.col("as_of").str.strptime(pl.Datetime, strict=False)) |
| 88 | return df |
| 89 | |
| 90 | |
| 91 | def to_polars_frontier_frame( |
nothing calls this directly
no test coverage detected