From e0116710d76d8f201222b7eecaa2da08afa41724 Mon Sep 17 00:00:00 2001 From: Vikram Kumar Date: Thu, 18 Dec 2025 13:23:19 +0530 Subject: [PATCH] Fix incorrect index length when ignore_index=True in series concat Fix incorrect index length when ignore_index=True in series concat The concat axis was previously created with length len(objs), which counts input containers rather than concatenated rows. This caused index/data length mismatches for any non-trivial concat. The concat axis length is now computed as the sum of object lengths, restoring correctness for ignore_index=True. --- pandas/core/reshape/concat.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/core/reshape/concat.py b/pandas/core/reshape/concat.py index d5d7520366a2f..579d43453033b 100644 --- a/pandas/core/reshape/concat.py +++ b/pandas/core/reshape/concat.py @@ -710,7 +710,9 @@ def _get_concat_axis_series( ) -> Index: """Return result concat axis when concatenating Series objects.""" if ignore_index: - return default_index(len(objs)) + total_length = sum(len(obj) for obj in objs) + return default_index(total_length) + elif bm_axis == 0: indexes = [x.index for x in objs] if keys is None: