Maybe something you want to look into: http://stackoverflow.com/questions/35604186/convert-psycopg2-dictrow-query-to-pandas-dataframe

curs = conn.cursor(cursor_factory=psycopg2.extras.DictCursor)
curs.execute("SELECT * FROM mytable")
data = curs.fetchall()

print pd.DataFrame(list(data))

Will produce a TypeError.

Comment From: jreback

not enough information to reproduce, but just looking at the docs, I don't think this is enough of a list-like to work (the DictCursor). It by-definition does support tuple access, but I suspect is not strictly iterable.

The general way to read these things is DataFrame.from_records. give that a try.

Comment From: jansila

In pandas 0.22.0 even reading from_records wont not work. The psycopg2 with DictCursor produces list of dictionaries [{'key':value},... {}] but is a psycopg2.DictRow type...

This works fine with native types: `inp=[{'a': 1}, {'b': 2}, {'a': 1}, {'b': 2}, {'a': 1}, {'b': 2}]

pd.DataFrame(inp) a b 0 1.0 NaN 1 NaN 2.0 2 1.0 NaN 3 NaN 2.0 4 1.0 NaN 5 NaN 2.0 ` But printing the results is probably the source of confusion

[[157, 158, 83, 1], [157, 159, 47, 1], [158, 157, 53, 1], [158, 159, 38, 1], [159, 157, 76, 1], [159, 158, 24, 1]] <class 'list'> but in fact the first element [157, 158, 83, 1] <class 'psycopg2.extras.DictRow'>