Skip to content

Behaviour of concat with empty Series has changed between 0.18.0 and 0.18.1 #13154

Closed
@bastewart

Description

@bastewart

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions