datatable.Frame.to_dict()¶
to_dict
()
Convert the frame into a dictionary of lists, by columns.
In Python 3.6+ the order of records in the dictionary will be the same as the order of columns in the frame.
Parameters¶
return
Dict[str, List]
Dictionary with ncols
records. Each record
represents a single column: the key is the column’s name, and the
value is the list with the column’s data.
Examples¶
DT = dt.Frame(A=[1, 2, 3], B=["aye", "nay", "tain"])
DT.to_dict()
{"A": [1, 2, 3], "B": ["aye", "nay", "tain"]}
See also¶
to_list()
: convert the frame into a list of liststo_tuples()
: convert the frame into a list of tuples by rows