-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Concatenating Single-element dense series with SparseArray Series Raises Error #30668
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
Comments
Thanks @henighan for the report. This looks to be fixed on master.
just need a test to prevent regression and close this issue. PRs or further investigation welcome. |
take |
Added test with exactly the case you proposed, @simonjayhawkins I wonder if we should cover any other combination of sparse/dense cases |
It may be worth bisecting to find which commit fixed this and what tests were added at the time. |
this error still exists and not solved yet, I just upgraded my pandas but no effect! |
the code sample in the OP gives the expected output in the OP in latest release pandas
@hadisaadat You may want to open a new issue (using the bug template) including a MRE of the failing case and the versions you are using. |
Code Sample, a copy-pastable example if possible
With interpreter output
Problem description
When concatenating a series of a sparse type (eg
Sparse[float64, nan]
above) with a serires of a dense type (egfloat64
above) that has only a single element, the above exception is raised.I believe this may be the result of the
squeeze
happening here:https://github.com/henighan/pandas/blob/45d8d77f27cf0dbc8cefe932f8fb64f6982b9527/pandas/core/dtypes/concat.py#L477
If I remove this
squeeze
, it resolves the issue for me (yielding the output below), and all tests still pass on my mac when running./test_fast.sh
. If this seems right to others, I'd be happy to open a pull request.Expected Output
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit : 45d8d77
python : 3.7.6.final.0
python-bits : 64
OS : Darwin
OS-release : 18.7.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.26.0.dev0+1586.g45d8d77f2
numpy : 1.17.3
pytz : 2019.3
dateutil : 2.8.1
pip : 19.3.1
setuptools : 44.0.0.post20200102
Cython : 0.29.14
pytest : 5.3.2
hypothesis : 5.1.0
sphinx : 2.3.1
blosc : None
feather : None
xlsxwriter : 1.2.7
lxml.etree : 4.4.2
html5lib : 1.0.1
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.10.1
pandas_datareader: None
bs4 : 4.8.2
bottleneck : 1.3.1
fastparquet : 0.3.2
gcsfs : None
lxml.etree : 4.4.2
matplotlib : 3.1.2
numexpr : 2.7.0
odfpy : None
openpyxl : 3.0.1
pandas_gbq : None
pyarrow : 0.15.1
pytables : None
pytest : 5.3.2
s3fs : 0.4.0
scipy : 1.4.1
sqlalchemy : 1.3.12
tables : 3.6.1
tabulate : 0.8.6
xarray : 0.14.1
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.2.7
numba : 0.46.0
The text was updated successfully, but these errors were encountered: