python
data_error
ai_generated
true
ValueError: No objects to concatenate
ID: python/pandas-concat-empty
80%Fix Rate
90%Confidence
0Evidence
2024-08-12First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.x | active | — | — | — |
Root Cause
pd.concat called with an empty list of DataFrames.
generic中文
pd.concat 接收到空的 DataFrame 列表。
Workarounds
-
95% success
if dfs: result = pd.concat(dfs, ignore_index=True) else: result = pd.DataFrame()
-
90% success
pd.concat(dfs or [pd.DataFrame()], ignore_index=True)
Dead Ends
Common approaches that don't work:
-
75% fail
Propagates None into downstream code
-
70% fail
Creates unexpected row/column structure