classmethod DataFrame.from_dict(data, *, npartitions, orient='columns', dtype=None, columns=None)[source]

Construct a Dask DataFrame from a Python Dictionary


Of the form {field : array-like} or {field : dict}.


The number of partitions of the index to create. Note that depending on the size and index of the dataframe, the output may have fewer partitions than requested.

orient{‘columns’, ‘index’, ‘tight’}, default ‘columns’

The “orientation” of the data. If the keys of the passed dict should be the columns of the resulting DataFrame, pass ‘columns’ (default). Otherwise if the keys should be rows, pass ‘index’. If ‘tight’, assume a dict with keys [‘index’, ‘columns’, ‘data’, ‘index_names’, ‘column_names’].

dtype: bool

Data type to force, otherwise infer.

columns: string, optional

Column labels to use when orient='index'. Raises a ValueError if used with orient='columns' or orient='tight'.


>>> import dask.dataframe as dd
>>> ddf = dd.DataFrame.from_dict({"num1": [1, 2, 3, 4], "num2": [7, 8, 9, 10]}, npartitions=2)