BUG: pd.concat returns empty series if called on mixture of empty and non-empty series #18187
Labels
Regression
Functionality that used to work in a prior pandas version
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Milestone
Code Sample
returns an empty series
Series([], dtype: int64)
.Problem description
Concatenating an non-empty and empty series returns an empty series.
If this is supposed to be the intended behavior, it is very counterintuitive. I would rather expect that the
result of
pd.concat([s1, s2])
is simply equal tos1
. In fact, this used to be the behavior in older versions like 0.20.3.Btw, I stumbled upon this error while I was trying to fix #18178. Out of curiosity I checked what happens in case of concatenating non-empty and empty series instead of frames.
Expected Output
Series equal to
s1
, i.e.repr(pd.concat([s1, s2]))
returns'0 1\ndtype: int64'
.Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.3.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-98-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.21.0
pytest: None
pip: 9.0.1
setuptools: 36.5.0.post20170921
Cython: None
numpy: 1.13.3
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: