Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: String series cat produces NaNs when left operand has a custom index #34415

Closed
3 tasks done
brandon-b-miller opened this issue May 27, 2020 · 2 comments
Closed
3 tasks done
Labels

Comments

@brandon-b-miller
Copy link

brandon-b-miller commented May 27, 2020

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Code Sample, a copy-pastable example

import pandas as pd
print(pd.__version__)

x = pd.Series(['a','b','c','d','e'])
x.index = ['1', '2', '3', '4', '5']
pd_others = pd.Series(['f','g','h','i','j'])

print(x.str.cat(others=pd_others))

1.1.0.dev0+1690.g70d7c04ff
1    NaN
2    NaN
3    NaN
4    NaN
5    NaN
dtype: object

Problem description

Possibly related to #33425. The trigger for this bug seems to be the custom index. I get the correct answer if the line where x.index is set is removed.

Expected Output

1.1.0.dev0+1690.g70d7c04ff
0    af
1    bg
2    ch
3    di
4    ej
dtype: object

Output of pd.show_versions()

INSTALLED VERSIONS

commit : 70d7c04
python : 3.8.3.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-76-generic
Version : #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8

pandas : 1.1.0.dev0+1690.g70d7c04ff
numpy : 1.18.1
pytz : 2020.1
dateutil : 2.8.1
pip : 20.0.2
setuptools : 46.4.0.post20200518
Cython : 0.29.17
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None

@brandon-b-miller brandon-b-miller added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels May 27, 2020
@TomAugspurger
Copy link
Contributor

I think that's deliberate. .str.cat aligns before catting.

@brandon-b-miller
Copy link
Author

Thanks for the clarification @TomAugspurger it indeed works if both operands have the same index. This looks to be an issue on our side!

@bashtage bashtage removed the Needs Triage Issue that has not been reviewed by a pandas team member label Aug 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants