Hi, I have tried Series.append but the name property changes unexpectedly.
a = pd.Series(name='a')
b = pd.Series(name='b')
c = pd.Series()
# a.name turns to be None if a.name is different with b.name
a.append(b) # a.name is None after append
# a.name turns to be None if c dose not have a name
a.append(c) # a.name is None after append
# a.name remains unchanged
a.append(pd.Series(name=a.name)) # a.name dose not change
Problem description
As a new series is appended to an old one, the name of the old series should be unchanged. This should not be satisfied only when the name of the new series is explicitly specified. However, the above problem happens.
Expected Output
Whenever a.append(b) or a.append(c) is done, a.name should remain unchanged, which is 'a'.
Output of pd.show_versions()
Comment From: jorisvandenbossche
We have a lot of issues (and fixes) of names getting lost, see https://github.com/pandas-dev/pandas/issues/9862 for an overview. But I think the behaviour here (only retaining name if the names match) is on purpose and tested behaviour (@sinhrks?) What does not mean of course that this choice cannot be challenged.
Comment From: shuuchen
thanks!
Comment From: jreback
yes this is correct and expected.
Comment From: Michael-E-Rose
If it's expected and desired it should be mentioned in the documentation: https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.append.html
Comment From: jorisvandenbossche
@Michael-E-Rose indeed (and you are welcome to do a small PR to update it!)