class pixeltable.ResultSet
A dataset obtained by executing aQuery. Returned by
Query.collect(), Query.head(),
Query.tail(), and the equivalent methods on class Table.
A ResultSet is structured as a table with rows (indexed by integers) and columns (indexed by strings).
The column names correspond to the expressions in the query’s select list. The values in a ResultSet can
be accessed in various ways:
len(result)returns the number of rowsresult[i]returns theith row as adictmapping column names to valuesresult['col']returns alistof all values in the column named'col'result[i, 'col']returns the specific value in theith row and column'col'
ResultSet implements the Sequence protocol, so it can be iterated over and converted to other sequence
types in the usual fashion; for example:
for row in result(iterates over rows)list(result)(converts to a list of rows)
method to_pandas()
Signature
ResultSet to a Pandas DataFrame.
Returns:
pd.DataFrame: ADataFramewith one column per column in theResultSet.
method to_pydantic()
Signature
ResultSet to Pydantic model instances.
Parameters:
model(type[BaseModelT]): A Pydantic model class.
Iterator[BaseModelT]: An iterator over Pydantic model instances, one for each row in the result set.