Using the PeeWee ORM I have the following query:
query = DataModel.select()where(DataModel.field == "value")
Is there any way to convert query
into a pandas DataFrame without iterating over all the values? I'm looking for a more "Pythonic" way of doing this.
Assuming query
is of type peewee.SelectQuery
, you could do:
df = pd.DataFrame(list(query.dicts()))
EDIT: As Nicola points out below, you're now able to do pd.DataFrame(query.dicts())
directly.