-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Pandas wrongly read csr_matrix with explicit 0 #28992
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
The example code fails at: |
@andreasbuhr Yep, it is a typo. It should be: |
thanks, now I was able to reproduce your problem with current master |
This looks to work on master now. Could use a test
|
take |
Test based on issue pandas-dev#28992, very similar to a previous test but with exact methods called to ensure specific issue has been addressed
@bakitybacon Are you still working on this? This issue could be closed as solved then. |
Yes it appears that this issue is covered by unit tests in #31991, closing. |
Code Sample, a copy-pastable example if possible
Observe the difference in the bottom left value in the second matrix.
Problem description
When the sparse matrix (in our case the matrix with the explicit zero) is imported in pandas with
from_spmatrix
function at least one value that should not be zero becomes a zero. See the example below. Both matrices should be the same.Expected Output
When converting sparse matrix to Pandas DataFrame values of the sparse array should stay the same.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
pandas : 0.25.1
numpy : 1.16.5
pytz : 2019.2
dateutil : 2.8.0
pip : 19.2.3
setuptools : 40.8.0
Cython : None
pytest : 5.2.0
hypothesis : None
sphinx : 2.2.0
blosc : None
feather : None
xlsxwriter : 1.2.1
lxml.etree : 4.4.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.8.0
pandas_datareader: None
bs4 : 4.8.0
bottleneck : 1.2.1
fastparquet : None
gcsfs : None
lxml.etree : 4.4.1
matplotlib : 3.1.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.1
sqlalchemy : None
tables : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : 1.2.1
The text was updated successfully, but these errors were encountered: