What’s New ?

The Top 10 favtutor Features You Might Have Overlooked

Read More
Data Science

Create an Empty DataFrame in Pandas (with Examples)

Jul 19, 2026 5 Minutes Read Why Trust Us Why you can trust this guide. Written by working engineers and reviewed by our editorial team under a strict editorial policy for accuracy, clarity and zero bias. Adrita Das By Adrita Das Adrita Das Adrita Das
I am Adrita Das, a Biomedical Engineering student and technical content writer with a background in Computer Science. I am pursuing this goal through a career in life science research, augmented with computational techniques. I am passionate about technology and it gives immense happiness to share my knowledge through the content I make.
Create an Empty DataFrame in Pandas (with Examples)

In pandas, you create an empty DataFrame by calling the constructor with no arguments: pd.DataFrame(). The result has no rows and no columns, ready to be filled or used as a placeholder.

You can also create an empty DataFrame with column names, with column names and data types, or with an index but no data. This lesson covers each form, how to check whether a DataFrame is empty with the empty property, and how to add rows to an empty DataFrame.

How Do You Create an Empty DataFrame in Pandas?

Call pd.DataFrame() with no arguments, and it returns a DataFrame with zero rows and zero columns.

import pandas as pd

df = pd.DataFrame()
print(df.shape)  # Outputs: (0, 0)
print(df.empty)  # Outputs: True

3 Ways to Create an Empty DataFrame

1) An Empty DataFrame with No Columns

The bare constructor gives a fully empty frame. Printing it shows the empty state along with its (missing) columns and index.

import pandas as pd

orders = pd.DataFrame()
print(orders)
# Outputs:
# Empty DataFrame
# Columns: []
# Index: []

2) An Empty DataFrame with Column Names

Pass a list to the columns argument to create an empty DataFrame with column names but no rows. This defines the table structure before any data arrives.

import pandas as pd

orders = pd.DataFrame(columns=["order_id", "customer", "total"])
print(orders)
# Outputs:
# Empty DataFrame
# Columns: [order_id, customer, total]
# Index: []
print(orders.shape)  # Outputs: (0, 3)

3) An Empty DataFrame with Column Names and Data Types

Columns created this way default to the object dtype. To fix each column's type up front, build the frame from empty Series with explicit dtypes.

import pandas as pd

orders = pd.DataFrame({
    "order_id": pd.Series(dtype="int64"),
    "customer": pd.Series(dtype="string"),
    "total": pd.Series(dtype="float64"),
})
print(orders.dtypes)
# Outputs:
# order_id             int64
# customer    string[python]
# total              float64
# dtype: object
Three empty pandas DataFrames: no rows and no columns, columns without rows, and an index without columns

How to Check If a DataFrame Is Empty

The DataFrame.empty property returns True when the frame has no items, meaning either no rows or no columns.

import pandas as pd

signups = pd.DataFrame(columns=["email", "plan"])
filled = pd.DataFrame({"email": ["[email protected]"], "plan": ["pro"]})

print(signups.empty)  # Outputs: True
print(filled.empty)   # Outputs: False

A DataFrame that contains only NaN values is not empty, because the cells still exist. Drop the missing values first if that is the test you need: df.dropna(how="all").empty.

How to Add Rows to an Empty DataFrame

Assign each new row with loc using the next index label. The older append() method was removed in pandas 2.0, so code that used df.append(row) now fails with an AttributeError.

import pandas as pd

waitlist = pd.DataFrame(columns=["name", "party_size"])

waitlist.loc[0] = ["Rivera", 4]
waitlist.loc[1] = ["Chen", 2]
print(waitlist)
# Outputs:
#      name  party_size
# 0  Rivera           4
# 1    Chen           2

Adding rows one at a time copies data on each assignment. When rows arrive in a loop, collect them in a list of dictionaries and build the DataFrame once at the end. This is O(n) overall, while growing a frame row by row is O(n²).

import pandas as pd

rows = []
for city, aqi in [("delhi", 182), ("oslo", 24), ("lima", 77)]:
    rows.append({"city": city, "aqi": aqi})

readings = pd.DataFrame(rows)
print(readings)
# Outputs:
#     city  aqi
# 0  delhi  182
# 1   oslo   24
# 2   lima   77
Growing a pandas DataFrame row by row copies the frame each insert, while collecting rows in a list and building once is O(n)

When to Use an Empty DataFrame

1) A Fixed Schema Before Data Arrives

Creating the columns first guarantees that later code sees the same table structure even when a data source returns nothing.

2) A Safe Return Value

A function that filters or loads data can return an empty DataFrame instead of None. Callers then run the same code path, and df.empty tells them whether anything came back.

3) An Accumulator for pd.concat()

When combining query results, start from an empty frame only if a base is required; otherwise collect the pieces in a list and call pd.concat() once.

Examples of Using an Empty DataFrame

1) Guarding Against an Empty Filter Result

import pandas as pd

sales = pd.DataFrame({"region": ["east", "west"], "revenue": [42000, 51500]})
north = sales[sales["region"] == "north"]

if north.empty:
    print("no rows for north")  # Outputs: no rows for north

2) Concatenating Batches onto a Typed Schema

import pandas as pd

schema = pd.DataFrame(columns=["ticker", "price"])
batch = pd.DataFrame({"ticker": ["AAPL", "MSFT"], "price": [232.5, 517.9]})

combined = pd.concat([schema, batch], ignore_index=True)
print(combined)
# Outputs:
#   ticker  price
# 0   AAPL  232.5
# 1   MSFT  517.9

3) An Empty DataFrame with an Index

Passing only an index creates rows without columns, which is useful when the row labels are known before the measurements.

import pandas as pd

days = pd.DataFrame(index=["mon", "tue", "wed"])
print(days.shape)  # Outputs: (3, 0)
print(days.empty)  # Outputs: True

Learn More About Empty DataFrames

The pandas DataFrame.empty Property

In the pandas documentation, DataFrame.empty is an attribute that returns True if the frame has no elements along either axis. It never looks at the values themselves, only at the shape, so the check is O(1).

Empty DataFrame vs NaN DataFrame

A frame built with rows of NaN has a shape like (3, 2) and reports empty as False. Emptiness is about having zero rows or zero columns, not about missing data.

Checking for Empty Columns

To test a single column, check its Series the same way: df["total"].empty, or df["total"].isna().all() for a column that exists but holds only missing values.

Key Takeaways for Pandas Empty DataFrames

  • pd.DataFrame() - creates an empty DataFrame with zero rows and zero columns.
  • columns= - defines the schema up front; add explicit dtypes with empty Series to avoid the object default.
  • df.empty - returns True when either axis has length 0, in O(1) time.
  • NaN is not empty - a frame full of missing values still has cells, so empty is False.
  • Growing a frame - collect rows in a list and build the DataFrame once; row-by-row growth is O(n²).

Once data lands in the frame, the next step is usually summarizing it. Read our lesson on pandas groupby count to aggregate rows by group.

Adrita Das
About the author

Adrita Das

I am Adrita Das, a Biomedical Engineering student and technical content writer with a background in Computer Science. I am pursuing this goal through a career in life science research, augmented with computational techniques. I am passionate about technology and it gives immense happiness to share my knowledge through the content I make.