Description
Code Sample, a copy-pastable example if possible
>>> import pandas as pd
>>> pd.__version__
'1.0.0rc0+233.gec0996c67'
>>> df = pd.DataFrame({'A':[1,2]})
>>> df.A.append(df)
0 A
0 1.0 NaN
1 2.0 NaN
0 NaN 1.0
1 NaN 2.0
Problem description
The behavior of append is the same as it is in 0.25.3 when a DataFrame is appended to Series. But it should actually throw a TypeError when passed a DataFrame.
We clearly document that the elements passed to append should be Series or list/tuple of Series.
Also according to this, a TypeError seems appropriate. The change can be implemented for 1.0.1 or 1.1 after this discussion.
Expected Output
>>> df = pd.DataFrame({'A':[1, 2]})
>>> df.A.append([df])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "D:\Work\Git projects\pandas\pandas\core\series.py", line 2572, in append
raise TypeError(msg)
TypeError: to_append should be a Series or list/tuple of Series, got DataFrame
Output of pd.show_versions()
INSTALLED VERSIONS
commit : ec0996c
python : 3.7.6.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 1.0.0rc0+233.gec0996c67.dirty
numpy : 1.17.0
pytz : 2018.9
dateutil : 2.8.0
pip : 19.3.1
setuptools : 44.0.0.post20200106
Cython : 0.29.14
pytest : 4.3.1
hypothesis : 5.1.5
sphinx : 1.8.5
blosc : None
feather : 0.4.0
xlsxwriter : 1.1.5
lxml.etree : 4.3.2
html5lib : 1.0.1
pymysql : 0.9.3
psycopg2 : None
jinja2 : 2.10
IPython : 7.4.0
pandas_datareader: None
bs4 : 4.6.3
bottleneck : 1.2.1
fastparquet : None
gcsfs : None
lxml.etree : 4.3.2
matplotlib : 3.0.3
numexpr : 2.6.9
odfpy : None
openpyxl : 2.6.1
pandas_gbq : None
pyarrow : 0.15.1
pytables : None
pytest : 4.3.1
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.1
tables : 3.5.1
tabulate : 0.8.6
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.1.5
numba : 0.43.1