Pandas DataFrame: from_dict() function

DataFrame - from_dict() function

The from_dict() function is used to construct DataFrame from dict of array-like or dicts.


classmethod DataFrame.from_dict(data, orient='columns', dtype=None, columns=None)


Name Description Type/Default Value Required / Optional
data  Of the form {field : array-like} or {field : dict}. dict Required
orient   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'.  {'columns', 'index'}
Default Value: 'columns'
dtype  Data type to force, otherwise infer. dtype
Default Value: None
columns  Column labels to use when orient='index'. Raises a ValueError if used with orient='columns'. list
Default Value: None

Returns: DataFrame


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - sparse.to_dense() function
Next: DataFrame - info() function

Follow us on Facebook and Twitter for latest update.

We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook