Examples
Dataframe to dictionary:

In [1]:
import numpy as np
import pandas as pd
In [2]:
df = pd.DataFrame({'c1': [1, 2],
                   'c2': [0.6, 0.85]},
                  index=['row1', 'row2'])
df
Out[2]:
c1 c2
row1 1 0.60
row2 2 0.85

Pandas: Dataframe - to_dict.

In [3]:
df.to_dict()
Out[3]:
{'c1': {'row1': 1, 'row2': 2}, 'c2': {'row1': 0.6, 'row2': 0.85}}

Pandas: Dataframe - df.to_dict.

Specify the return orientation:

In [4]:
df.to_dict('series')
Out[4]:
{'c1': row1    1
 row2    2
 Name: c1, dtype: int64, 'c2': row1    0.60
 row2    0.85
 Name: c2, dtype: float64}

Pandas: Dataframe - df.to_dict(series).

In [5]:
df.to_dict('split')
Out[5]:
{'index': ['row1', 'row2'],
 'columns': ['c1', 'c2'],
 'data': [[1, 0.6], [2, 0.85]]}

Pandas: Dataframe - df.to_dict(split).

In [6]:
df.to_dict('records')
Out[6]:
[{'c1': 1, 'c2': 0.6}, {'c1': 2, 'c2': 0.85}]

Pandas: Dataframe - df.to_dict(records).

In [7]:
df.to_dict('index')
Out[7]:
{'row1': {'c1': 1, 'c2': 0.6}, 'row2': {'c1': 2, 'c2': 0.85}}

Pandas: Dataframe - df.to_dict(index).

In [8]:
from collections import OrderedDict, defaultdict
df.to_dict(into=OrderedDict)
Out[8]:
OrderedDict([('c1', OrderedDict([('row1', 1), ('row2', 2)])),
             ('c2', OrderedDict([('row1', 0.6), ('row2', 0.85)]))])

If you want a defaultdict, you need to initialize it:

In [9]:
dd = defaultdict(list)
df.to_dict('records', into=dd)
Out[9]:
[defaultdict(list, {'c1': 1, 'c2': 0.6}),
 defaultdict(list, {'c1': 2, 'c2': 0.85})]