Skip to content

Commit 42aa2f1

Browse files
fix allowed dims
Signed-off-by: Laurynas Jagutis <[email protected]>
1 parent 6e634ef commit 42aa2f1

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/power_grid_model/_core/utils.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,12 @@ def _extract_columnar_data(
651651
"""
652652
not_columnar_data_message = "Expected columnar data"
653653

654-
if_is_batch = [2, 3] if is_batch else [1, 2]
655-
allowed_dims = (if_is_batch) if is_batch is not None else [1, 2, 3]
654+
if is_batch is None:
655+
allowed_dims = [1, 2, 3]
656+
elif is_batch:
657+
allowed_dims = [2, 3]
658+
else:
659+
allowed_dims = [1, 2]
656660

657661
sub_data = data["data"] if is_sparse(data) else data
658662

@@ -684,6 +688,13 @@ def _extract_row_based_data(
684688
if_is_batch = [2] if is_batch else [1]
685689
allowed_dims = if_is_batch if is_batch is not None else [1, 2]
686690

691+
if is_batch is None:
692+
allowed_dims = [1, 2]
693+
elif is_batch:
694+
allowed_dims = [2]
695+
else:
696+
allowed_dims = [1]
697+
687698
sub_data = data["data"] if is_sparse(data) else data
688699

689700
if not isinstance(sub_data, np.ndarray):

0 commit comments

Comments
 (0)