From 84e0cafd47db5cfb2f2099bf9929361f4d2320f3 Mon Sep 17 00:00:00 2001 From: BAnSsal <ishantbansal9876@gmail.com> Date: Sat, 18 Jan 2025 12:26:58 +0530 Subject: [PATCH] Issue 60723 resolved --- pandas/core/reshape/concat.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pandas/core/reshape/concat.py b/pandas/core/reshape/concat.py index e7cb7069bbc26..074befae992b6 100644 --- a/pandas/core/reshape/concat.py +++ b/pandas/core/reshape/concat.py @@ -477,18 +477,22 @@ def _sanitize_mixed_ndim( else: name = getattr(obj, "name", None) + namenoneflag =False if ignore_index or name is None: if axis == 1: # doing a row-wise concatenation so need everything # to line up - name = 0 + if name is None: + name = 0 + namenoneflag =True + else: # doing a column-wise concatenation so need series # to have unique names name = current_column current_column += 1 obj = sample._constructor(obj, copy=False) - if isinstance(obj, ABCDataFrame): + if isinstance(obj, ABCDataFrame) and namenoneflag: obj.columns = range(name, name + 1, 1) else: obj = sample._constructor({name: obj}, copy=False)