Code Sample, a copy-pastable example if possible
import pandas as pd
s_empty = pd.Series()
s_filled = pd.Series([1, 2, 3, 4, 5])
pd.concat([s_empty, s_filled], 1)
Expected Output
Expect to be consistent between versions: previously would not add any columns for the empty Series
, now a column of NaN
is appended. (I can not see this mentioned in the what's new so think this is an unintended change.)
In 0.18.0
:
0
0 1
1 2
2 3
3 4
4 5
In 0.18.1
(and tested on 0.18.1+25.g4aa6323
):
0 1
0 NaN 1
1 NaN 2
2 NaN 3
3 NaN 4
4 NaN 5
output of pd.show_versions()
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.11.final.0
python-bits: 64
OS: Darwin
OS-release: 15.4.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 21.0.0
Cython: None
numpy: 1.11.0
scipy: 0.17.0
statsmodels: None
xarray: None
IPython: 4.2.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.4
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.1
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None
In my 0.18.0
environment the only differences in show_versions
is the pandas
entry and pandas_datareader
is not present.
Comment From: jorisvandenbossche
This was regarded as a bug (https://github.com/pydata/pandas/issues/11082), and was fixed for 0.18.1 (PR #12846).
So it is mentioned in the whatsnew docs ("Bug in concat
doesn't handle empty Series
properly"), but of course difficult to find in such a long list, and it was also not put in the API changes section (it is always a bit subjective whether something is clearly a bug fix or also worth mentioning as an API change, as people can rely on the buggy behaviour. You could argue that in this case a API change mention would be worth it).
Comment From: bastewart
Ah, thanks for clarifying, sorry I missed that!
Comment From: jorisvandenbossche
No problem, and thanks for reporting anyway!