Skip to content

Commit 7322abf

Browse files
committed
Override polars schema inference and set to F64
1 parent 8a796ba commit 7322abf

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmdstanpy/utils/stancsv.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,13 @@ def csv_bytes_list_to_numpy(
6464
import polars as pl
6565

6666
try:
67+
num_cols = csv_bytes_list[0].count(b",") + 1
6768
out: npt.NDArray[np.float64] = (
6869
pl.read_csv(
6970
io.BytesIO(b"".join(csv_bytes_list)),
7071
has_header=includes_header,
72+
schema_overrides=[pl.Float64] * num_cols,
73+
infer_schema=False,
7174
)
7275
.to_numpy()
7376
.astype(np.float64)

0 commit comments

Comments
 (0)