series.str.cat(series.str) is concatenating only the largest string · Issue #28277 · pandas-dev/pandas (original) (raw)

Code Sample, a copy-pastable example if possible

import pandas as pd

arr = ["AbC", "de", "FGHI", "j", "kLLLm"]

ps = pd.Series(arr) expect = ps.str.cat(others=ps.str) print(expect) Out[16]: 0 NaN 1 NaN 2 NaN 3 NaN 4 kLLLmkLLLm dtype: object

Problem description

series.str.cat(series.str) is concatenating only the largest string in the series but it should concatenate all the strings element wise.

Expected Output

Out[18]: 0 AbCAbC 1 dede 2 FGHIFGHI 3 jj 4 kLLLmkLLLm dtype: object

Output of pd.show_versions()

In [2]: pandas.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.7.3.final.0
python-bits: 64
OS: Linux
OS-release: 3.10.0-862.14.4.el7.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: None
LOCALE: en_US.UTF-8

pandas: 0.24.2
pytest: 5.1.2
pip: 19.2.3
setuptools: 41.2.0
Cython: 0.29.13
numpy: 1.17.1
scipy: None
pyarrow: 0.14.1
xarray: None
IPython: 7.8.0
sphinx: 2.2.0
patsy: None
dateutil: 2.8.0
pytz: 2019.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10.1
s3fs: 0.3.4
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None