Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPass ignore_index=True to pd.concat when you want a new, consecutive index along the axis being concatenated. For the usual row-wise operation, that gives the combined DataFrame row labels from 0 onward:
result = pd.concat([df1, df2], ignore_index=True)
Reset row labels while concatenating DataFrames
For example, suppose two DataFrames have indexes that identify rows only within their original inputs:
As an Amazon Associate I earn from qualifying purchases.
import pandas as pd
df1 = pd.DataFrame({"name": ["Ada", "Grace"]}, index=[10, 11])
df2 = pd.DataFrame({"name": ["Linus"]}, index=[42])
combined = pd.concat([df1, df2], ignore_index=True)
With the default axis=0, pandas concatenates rows and assigns the result a new index: RangeIndex(start=0, stop=3, step=1) in this example. The values in the name column remain unchanged. The pandas 3.0.5 API documentation defines the option as not using index values along the concatenation axis and labeling the resulting axis from 0 through n - 1.
The same option works for Series:
result = pd.concat([s1, s2], ignore_index=True)
The API reference demonstrates concatenating two two-element Series; the resulting labels are 0, 1, 2, and 3.
#1 Best Overall
What ignore_index changes—and what it does not
ignore_index=True replaces labels only on the axis along which concatenation happens. It does not discard every label or determine how columns are matched.
- Default
axis=0: pandas stacks rows and replaces row-index labels. Columns are still aligned by name. axis=1: pandas concatenates columns, soignore_index=Truereplaces the output column labels. Row indexes still matter when pandas aligns the inputs.
For row-wise concatenation, the join setting controls which columns appear. The default join='outer' takes the union of input columns; join='inner' keeps their intersection. These behaviors are described in the pandas merging, joining, and concatenation guide.
Choose whether to preserve labels or record input identity
Use ignore_index=True when original row labels are not useful in the result. If those labels carry meaning, leave the option out so pandas preserves them. If you want to identify which input contributed each row, use keys to add an outer level to the result index instead of discarding the concatenation-axis labels.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →In pandas 3.0, do not combine ignore_index=True with non-None keys: the combination raises ValueError, as specified in the pandas 3.0.0 release notes.
Concatenate once rather than repeatedly in a loop
When collecting many DataFrames or Series, gather them first and call pd.concat once:
frames = [df1, df2, df3]
result = pd.concat(frames, ignore_index=True)
The API documentation recommends collecting objects before concatenating, and the user guide warns that repeated concatenation can create unnecessary copies. This approach also makes the desired index behavior explicit for the final combined result.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Use concat for stacking, not relational matching
ignore_index changes labels on the concatenation axis; it does not match records by a key or replace relational operations. If the task is to combine rows or columns along an axis, use concat. If it is to match records by shared key columns or indexes, consult the pandas guide’s sections on merging and joining.
For current code, use pd.concat rather than the former DataFrame.append method. The pandas 1.5.3 reference marks append deprecated since pandas 1.4.0 and recommends concat.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




