Skip to content

Commit 8b37adb

Browse files
committed
Fix csv numpy parsing shape when single row
1 parent 97c9ef8 commit 8b37adb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

cmdstanpy/utils/stancsv.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,12 @@ def csv_bytes_list_to_numpy(
7575
skiprows=int(includes_header),
7676
delimiter=",",
7777
dtype=np.float32,
78+
ndmin=1,
7879
)
7980
if out.shape == (0,):
8081
raise ValueError("No data found to parse") from exc
82+
if len(out.shape) == 1:
83+
out = out.reshape(1, -1)
8184

8285
# Telling the type checker we know the type is correct
8386
return cast(npt.NDArray[np.float32], out)

0 commit comments

Comments
 (0)