@@ -883,27 +883,66 @@ def dot(self, other):
883883 @classmethod
884884 def from_dict (cls , data , orient = 'columns' , dtype = None , columns = None ):
885885 """
886- Construct DataFrame from dict of array-like or dicts
886+ Construct DataFrame from dict of array-like or dicts.
887+
888+ Creates DataFrame object from dictionary by columns or by index
889+ allowing dtype specification.
887890
888891 Parameters
889892 ----------
890893 data : dict
891- {field : array-like} or {field : dict}
894+ Of the form {field : array-like} or {field : dict}.
892895 orient : {'columns', 'index'}, default 'columns'
893896 The "orientation" of the data. If the keys of the passed dict
894897 should be the columns of the resulting DataFrame, pass 'columns'
895898 (default). Otherwise if the keys should be rows, pass 'index'.
896899 dtype : dtype, default None
897- Data type to force, otherwise infer
898- columns: list, default None
899- Column labels to use when orient='index'. Raises a ValueError
900- if used with orient='columns'
900+ Data type to force, otherwise infer.
901+ columns : list, default None
902+ Column labels to use when `` orient='index'`` . Raises a ValueError
903+ if used with `` orient='columns'``.
901904
902905 .. versionadded:: 0.23.0
903906
904907 Returns
905908 -------
906- DataFrame
909+ pandas.DataFrame
910+
911+ See Also
912+ --------
913+ DataFrame.from_records : DataFrame from ndarray (structured
914+ dtype), list of tuples, dict, or DataFrame
915+ DataFrame : DataFrame object creation using constructor
916+
917+ Examples
918+ --------
919+ By default the keys of the dict become the DataFrame columns:
920+
921+ >>> data = {'col_1': [3, 2, 1, 0], 'col_2': ['a', 'b', 'c', 'd']}
922+ >>> pd.DataFrame.from_dict(data)
923+ col_1 col_2
924+ 0 3 a
925+ 1 2 b
926+ 2 1 c
927+ 3 0 d
928+
929+ Specify ``orient='index'`` to create the DataFrame using dictionary
930+ keys as rows:
931+
932+ >>> data = {'row_1': [3, 2, 1, 0], 'row_2': ['a', 'b', 'c', 'd']}
933+ >>> pd.DataFrame.from_dict(data, orient='index')
934+ 0 1 2 3
935+ row_1 3 2 1 0
936+ row_2 a b c d
937+
938+ When using the 'index' orientation, the column names can be
939+ specified manually:
940+
941+ >>> pd.DataFrame.from_dict(data, orient='index',
942+ ... columns=['A', 'B', 'C', 'D'])
943+ A B C D
944+ row_1 3 2 1 0
945+ row_2 a b c d
907946 """
908947 index = None
909948 orient = orient .lower ()
0 commit comments