liveBook · Manning

Data frame

As explained in DuckDB in Action

A data frame is a two-dimensional tabular data structure with labeled rows and columns, such as the structure provided by pandas.

A data frame is a two-dimensional table with labeled rows and columns. In Python workflows, pandas provides an in-memory data frame that DuckDB can query as though it were a relational table. section 6.3 section 6.0

Data frames support several practical workflow patterns:

  • Load structured values into pandas, then query them with SQL-like filters through DuckDB. section 6.3
  • Use DuckDB to access pandas or Polars data directly without copying the in-memory representation. section 1.3
  • Return query results as data frames for continued pandas analysis or visualization with Python libraries. section 1.7.4 section 6.3
  • Pass data frames into pipeline assets and persist their contents as DuckDB tables. section 8.4.4

Querying an authors data frame

Create a pandas data frame named people with name and country columns, then run `SELECT * FROM people WHERE country = 'Germany'`. DuckDB returns the two matching authors. A parameterized query can return rows outside Germany, while `fetchdf()` returns the result as another data frame rather than a DB-API cursor. section 6.3

Using a data frame in an application pipeline

A Dagster asset builds a pandas data frame describing tennis tournament levels and creates a DuckDB table from it. A Streamlit application likewise returns query results as a data frame and renders them as an interactive table. section 8.4.4 section 9.1.3

people = pd.DataFrame({
    "name": ["Michael Hunger", "Michael Simons", "Mark Needham"],
    "country": ["Germany", "Germany", "Great Britain"]
})

Shows a compact pandas constructor for creating a labeled data frame with author names and countries. section 6.3

How DuckDB in Action covers it

How deep it goes
Demonstrates construction, filtering, parameterization, conversion, and pipeline ingestion, without detailing data-frame internals.
Examples
Uses authors, tennis tournament levels, player-match results, and interactive tables as concrete data-frame examples.
What it assumes
Assumes Python and pandas installation, then teaches direct SQL-style querying of pandas data frames.
What you can do after
Apply it via pandas and DuckDB to query, transform, return, visualize, and pipeline structured in-memory data.
How it connects
Connects pandas, DuckDB, SQL, Python APIs, Apache Arrow, Streamlit, and data pipelines.

Also explained in

Compare how 19 books explain data frame →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of DuckDB in Action. The section links point to the parts of the book it draws on.