If you’ve tried df1.append(df2) on a recent pandas, you’ve probably seen AttributeError: 'DataFrame' object has no attribute 'append'. That method was removed in pandas 2.0.
To concatenate two DataFrames in pandas now, pass them as a list to pd.concat([df1, df2]). It stacks rows by default, or places the tables side by side with axis=1.
In this tutorial, I’ll show you how to concatenate two DataFrames in pandas on one small sales dataset: stacking rows, fixing the index, labeling sources, mismatched columns and many tables at once.
The Sample Store Sales Data for These pandas concat Examples
Every example starts from the same two tables: first-quarter 2026 sales for an Austin, TX store and a Denver, CO store. I ran everything on Python 3.12.5 with pandas 3.0.6.
import pandas as pd
austin = pd.DataFrame({
"month": ["Jan", "Feb", "Mar"],
"orders": [412, 389, 455],
"sales": [48250.75, 45120.40, 52980.10],
})
denver = pd.DataFrame({
"month": ["Jan", "Feb", "Mar"],
"orders": [298, 315, 341],
"sales": [36410.25, 38875.90, 41230.55],
})
Both share the same columns and the same 0-2 index, which is what trips people up. See creating a DataFrame from a dict.
Method 1: Stack Two DataFrames Vertically with pd.concat() (Recommended)
Use this when both tables hold the same kind of rows. Here’s the Austin and Denver data stacked:
# austin and denver: the sample above
both = pd.concat([austin, denver])
print(both)
print(both.loc[0])
Output:
month orders sales
0 Jan 412 48250.75
1 Feb 389 45120.40
2 Mar 455 52980.10
0 Jan 298 36410.25
1 Feb 315 38875.90
2 Mar 341 41230.55
month orders sales
0 Jan 412 48250.75
0 Jan 298 36410.25

loc[0] returns two rows instead of one.How does this code work?
pd.concat() takes a list of DataFrames and lines them up by column name; the default axis=0 adds rows.
It keeps each table’s index labels, so duplicates are normal. For key-based matching, use pandas merge and join instead.
Method 2: Reset the Index with ignore_index=True
Usually you want a clean 0-5 index instead. Same two stores, one extra argument:
# austin and denver: the sample above
both = pd.concat([austin, denver], ignore_index=True)
print(both.tail(3))
same = pd.concat([austin, denver]).reset_index(drop=True)
print("Same as reset_index:", both.equals(same))
try:
pd.concat([austin, denver], verify_integrity=True)
except ValueError as e:
print("ValueError:", e)
Output:
month orders sales
3 Jan 298 36410.25
4 Feb 315 38875.90
5 Mar 341 41230.55
Same as reset_index: True
ValueError: Indexes have overlapping values: Index([0, 1, 2], dtype='int64')

reset_index(drop=True), and verify_integrity=True rejects the duplicates.How does this code work?
ignore_index=True throws away the old labels and numbers the rows fresh. It gives the same result as calling reset_index(drop=True) afterward, just in one step.
verify_integrity=True instead raises a ValueError on overlapping labels. I use it when the index is a real ID.
Method 3: Label Source DataFrames with pd.concat keys
Need to know which store a row came from? keys adds an outer index level:
# austin and denver: the sample above
both = pd.concat([austin, denver], keys=["Austin", "Denver"],
names=["store", "row"])
print(both)
total = both.loc["Denver", "sales"].sum()
print(f"Denver Q1 sales: ${total:,.2f}")
Output:
month orders sales
store row
Austin 0 Jan 412 48250.75
1 Feb 389 45120.40
2 Mar 455 52980.10
Denver 0 Jan 298 36410.25
1 Feb 315 38875.90
2 Mar 341 41230.55
Denver Q1 sales: $116,516.70
The result has a two-level index, and both.loc["Denver"] pulls back just Denver’s three months, totaling $116,516.70.
How does this code work?
Each key pairs with one DataFrame in the list, and names labels the index levels. Call reset_index(level="store") to turn the label into a regular column for groupby aggregations.
Method 4: Combine DataFrames Side by Side with axis=1
With axis=1, you add columns instead of rows. Here Austin’s sales sit next to a target table that also has April:
# austin and denver: the sample above
sales = austin.set_index("month")[["sales"]]
target = pd.DataFrame(
{"target": [47000.00, 47000.00, 50000.00, 52000.00]},
index=["Jan", "Feb", "Mar", "Apr"],
)
print(pd.concat([sales, target], axis=1))
print(pd.concat([sales, target], axis=1, join="inner"))
Output:
sales target
Jan 48250.75 47000.0
Feb 45120.40 47000.0
Mar 52980.10 50000.0
Apr NaN 52000.0
sales target
Jan 48250.75 47000.0
Feb 45120.40 47000.0
Mar 52980.10 50000.0

NaN sales value; join="inner" keeps only the three shared months.How does this code work?
Rows line up by index label, so I used set_index("month") first. Double brackets in [["sales"]] keep a DataFrame; see converting a Series to a DataFrame.
What Happens When pandas concat Columns Don’t Match?
Same stacking, but now Denver tracks a returns column that Austin doesn’t have:
# austin and denver: the sample above
denver = denver.assign(returns=[4, 7, 2])
print(pd.concat([austin, denver], ignore_index=True).tail(4))
inner = pd.concat([austin, denver], join="inner")
print(inner.columns.tolist())
Output:
month orders sales returns
2 Mar 455 52980.10 NaN
3 Jan 298 36410.25 4.0
4 Feb 315 38875.90 7.0
5 Mar 341 41230.55 2.0
['month', 'orders', 'sales']

NaN in returns, and join="inner" keeps only the three shared columns.The outer join keeps every column, so returns becomes float with NaN for Austin. Fill it or drop rows with NaN afterward.
Important: columns match by exact name. Sales and sales become two separate columns, so rename first.
How Do You Concatenate Multiple DataFrames at Once?
The same call takes any number of tables. Here Miami joins in, and each table gets a store column:
# austin and denver: the sample above
miami = pd.DataFrame({"month": ["Jan", "Feb", "Mar"],
"orders": [356, 370, 402],
"sales": [42105.60, 43990.15, 47215.80]})
stores = {"Austin": austin, "Denver": denver, "Miami": miami}
frames = [df.assign(store=name) for name, df in stores.items()]
q1 = pd.concat(frames, ignore_index=True)
print(len(q1), "rows")
print(q1.groupby("store")["sales"].sum())
Output:
9 rows
store
Austin 146351.25
Denver 116516.70
Miami 133311.55
Name: sales, dtype: float64
All 9 rows land in one table: $146,351.25 for Austin, $116,516.70 for Denver and $133,311.55 for Miami. For files, build the list with pd.read_csv() instead.
Pro Tip: collect DataFrames in a list and call pd.concat() once. Concatenating inside a loop copies the growing table every time.
Why Did DataFrame.append() Stop Working?
DataFrame.append() was deprecated in pandas 1.4 and removed in 2.0. The fix for adding rows is a one-row DataFrame plus pd.concat():
# austin and denver: the sample above
try:
austin.append(denver)
except AttributeError as e:
print("AttributeError:", e)
april = pd.DataFrame([{"month": "Apr", "orders": 470, "sales": 54115.30}])
austin = pd.concat([austin, april], ignore_index=True)
print(austin.tail(2))
Output:
AttributeError: 'DataFrame' object has no attribute 'append'
month orders sales
2 Mar 455 52980.1
3 Apr 470 54115.3

append() call fails, and pd.concat() adds the April row as index 3.April shows up as row 3 with 470 orders. For other ways to add a single record, see adding a row to a pandas DataFrame.
Things to Keep in Mind
- Duplicate index labels: add
ignore_index=Trueor check withverify_integrity=True. NaNafter stacking: a column exists in only one table; usejoin="inner"or fill it.axis=1pairs rows by index label, so set a shared index first.- Call
pd.concat()once on a list, never inside a loop.
When you’re reshaping pandas tables, these walk-throughs pick up where this one stops:
- Merge two columns in pandas
- Set column names in pandas
- Change a column’s data type in pandas
- Concatenate NumPy arrays
Frequently Asked Questions
How do I concatenate two DataFrames in pandas?
Use pd.concat([df1, df2]) to stack rows, or add axis=1 to place them side by side.
What does ignore_index=True do in pd.concat?
It drops the original index labels and numbers the result 0 to n-1, the same as reset_index(drop=True) afterward.
What replaced DataFrame.append() in pandas 2?
pd.concat(). Wrap the new rows in a DataFrame and pass both tables in a list.
What is the difference between concat and merge in pandas?
concat() stacks tables along an axis. merge() matches rows on key columns, like a SQL join.
Why does pd.concat give NaN values?
A column or index label exists in only one table. Use join="inner" or fill the gaps with fillna().
Where is pd.concat documented?
See pandas.concat() in the official pandas docs.

Bijay Kumar is a 13-time Microsoft MVP with more than 18 years in software development, and the founder of Python Guides and TSinfo Technologies. He started out building .NET and SharePoint solutions at HP, TCS and KPIT before moving into Python, machine learning and AI, and he also builds web apps with TypeScript and React. He writes the tutorials here himself, and every example is run before publishing so you see the real output. More about Bijay · Microsoft MVP profile · LinkedIn