Closed
Description
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the master branch of pandas.
Reproducible Example
pd.__version__
'1.4.0.dev0+938.g1bcb84175c'
df = pd.DataFrame([[1,2],[3,4]],index = pd.Index(['a','b'],name='keepthisname'))
0 1
keepthisname
a 1 2
b 3 4
serc = pd.Series([5,6],name='c')
0 5
1 6
Name: c, dtype: int64
dfc = df.append(serc) # one at a time works
0 1
keepthisname
a 1 2
b 3 4
c 5 6
serd = pd.Series([7,8],name='d') # as further evidenced with this...
dfc.append(serd)
0 1
keepthisname
a 1 2
b 3 4
c 5 6
d 7 8
df.append([serc,serd]) # but this resets the name of the index
0 1
a 1 2
b 3 4
c 5 6
d 7 8
Issue Description
DataFrame append of a list of Series conforming to the index resets the name of the index.
Expected Behavior
The same as adding each element of the Series in a loop.
Installed Versions
Built from source:
pd.version
'1.4.0.dev0+938.g1bcb84175c'