```    1:- module(data_frame,
2          [ columns_to_rows/2                   % ?ListOfColumns,?ListOfRows
3          ]).    4:- autoload(library(apply), [maplist/4, maplist/3]).    5:- use_module(library(linear/algebra)).```
columns_to_rows(?ListOfColumns, ?ListOfRows) is semidet
Transforms ListOfColumns to ListOfRows, where a row is a list of key-value pairs, one for each cell. By example,
`[a=[1, 2], b=[3, 4]]`

becomes

`[[a-1, b-3], [a-2, b-4]]`

Else fails if rows or columns do not match. The output list of lists suitably conforms to dict_create/3 Data payloads from which you can build dictionaries.

```?- columns_to_rows([a=[1, 2], b=[3, 4]], A),
maplist([B, C]>>dict_create(C, row, B), A, D).
A = [[a-1, b-3], [a-2, b-4]],
D = [row{a:1, b:3}, row{a:2, b:4}].```
```   27columns_to_rows(ListOfColumns, ListOfRows) :-
28    var(ListOfColumns),
29    !,
30    rows(Keys, Rows, ListOfRows),
31    matrix_transpose(Columns, Rows),
32    columns(ListOfColumns, Keys, Columns).
33columns_to_rows(ListOfColumns, ListOfRows) :-
34    columns(ListOfColumns, Keys, Columns),
35    matrix_transpose(Columns, Rows),
36    rows(Keys, Rows, ListOfRows).
37
38columns(ListOfColumns, Keys, Columns) :-
39    maplist([Key=Column, Key, Column]>>true, ListOfColumns, Keys, Columns).
40
41rows(Keys, Rows, ListOfRows) :- maplist(zip(Keys), Rows, ListOfRows).
42
43zip([], [], []).
44zip([H1|T1], [H2|T2], [H1-H2|T]) :- zip(T1, T2, T)```