MCPcopy Create free account
hub / github.com/Open-Quant/openquant / to_pandas

Function to_pandas

python/openquant/adapters.py:155–163  ·  view source on GitHub ↗

Optional pandas conversion for downstream tooling.

(df: pl.DataFrame)

Source from the content-addressed store, hash-verified

153 if len(ind_mat) == 0:
154 return pl.DataFrame({"bar_index": []})
155 width = len(ind_mat[0])
156 if any(len(row) != width for row in ind_mat):
157 raise ValueError("ind_mat must be rectangular")
158 if label_names is None:
159 label_names = [f"label_{i}" for i in range(width)]
160 if len(label_names) != width:
161 raise ValueError(f"label_names length mismatch: expected {width}, got {len(label_names)}")
162 if len(set(label_names)) != width or "bar_index" in label_names:
163 raise ValueError("label_names must be unique and must not contain 'bar_index'")
164 if bar_index is None:
165 bar_index = list(range(len(ind_mat)))
166 _validate_equal_length("bar_index", bar_index, "ind_mat_rows", ind_mat)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected