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

Cannot convert Matrix to numpy array dtype #14943

asmeurer opened this Issue Jul 19, 2018 · 3 comments


None yet
2 participants

asmeurer commented Jul 19, 2018

>>> M = Matrix([[1, 2], [3, 4]])
>>> import numpy as np
>>> np.array(M)
array([[1, 2],
       [3, 4]], dtype=object)
>>> np.array(M, dtype=float)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __array__() takes 1 positional argument but 2 were given

The problem is that __array__ should take an optional argument, dtype.

matrix2numpy already supports this argument, so this is trivial to fix.


This comment has been minimized.

shubhscoder commented Jul 22, 2018

I would like to work on this. Can anyone get me started? Thanking you in advance!


This comment has been minimized.


asmeurer commented Jul 23, 2018

@shubhscoder if you look right above your comment there is a link to a pull request that already fixes this issue. I would suggest looking for another issue as @ethankward has already fixed this one.


This comment has been minimized.

shubhscoder commented Jul 23, 2018

Okay no problem . Will look for another issue. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment