Skip to content

"npmat @ pdseries" should be equivalent to "npmat @ pdseries.values" #23411

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

Closed
philip4096 opened this issue Oct 29, 2018 · 3 comments
Closed
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Numeric Operations Arithmetic, Comparison, and Logical operations

Comments

@philip4096
Copy link

Code Sample

import pandas as pd
import numpy as np

npmat = np.array([[1, 0],[1, 1]])
pdseries = pd.Series([1, 2])

np.testing.assert_allclose(npmat @ pdseries, npmat @ pdseries.values ) # fails but should succeed

Problem description

Maybe there is a good explanation but I did not expect this.
It is unexpected that npmat @ pdseries is NOT equivalent to npmat @ pdseries.values.
It is unexpected that npmat @ pdseries, is equvivalent to pdseries.values @ npmat.

Expected Output

nothing

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]
INSTALLED VERSIONS

commit: None
python: 3.6.3.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 158 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.4
pytest: 3.7.1
pip: 18.1
setuptools: 36.5.0.post20170921
Cython: 0.26.1
numpy: 1.14.5
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.1.0
sphinx: 1.6.3
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.2
feather: None
matplotlib: 2.1.0
openpyxl: 2.4.8
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.0
bs4: 4.6.0
html5lib: 0.999999999
sqlalchemy: 1.1.13
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@TomAugspurger
Copy link
Contributor

Your assert passes for me locally.

There was a bug in rmatmul, but that was fixed in #21530. Can you double check your pandas version?

@gfyoung gfyoung added Numeric Operations Arithmetic, Comparison, and Logical operations Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff labels Oct 30, 2018
@philip4096
Copy link
Author

My pandas version is pandas: 0.23.4 according to pd.show_versions() and conda. I reinstalled it. Should it work in this version?

@TomAugspurger
Copy link
Contributor

I just tried with 0.23.4 and it's indeed broken. But it works on master so it must have been fixed in the interim.

If you're interested, you can try pulling down master to see if things work. Let me know if not and we'll reopen.

@TomAugspurger TomAugspurger added this to the No action milestone Oct 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

No branches or pull requests

3 participants