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

Dot doesn't accept arrays #2042

Closed
ludaavics opened this issue Oct 8, 2012 · 2 comments
Closed

Dot doesn't accept arrays #2042

ludaavics opened this issue Oct 8, 2012 · 2 comments
Labels
Milestone

Comments

@ludaavics
Copy link

In [93]: a = rand(1,5)

In [94]: b = rand(5,1)

In [95]: A = pd.DataFrame(a)

In [96]: B = pd.DataFrame(b)

In [97]: a.dot(b)
Out[97]: array([[ 1.50425267]])

In [98]: A.dot(B)
Out[98]: 


0
0
1.504253


In [99]: a.dot(B)
Out[99]: array([[ 1.50425267]])

In [100]: A.dot(b)
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
D:\Projects\moc\<ipython-input-100-2a3d67ed3e0f> in <module>()
----> 1 A.dot(b)

C:\Python27\lib\site-packages\pandas\core\frame.pyc in dot(self, other)
    722         """
    723         lvals = self.values
--> 724         rvals = other.values
    725         result = np.dot(lvals, rvals)
    726         return DataFrame(result, index=self.index, columns=other.columns)

AttributeError: 'numpy.ndarray' object has no attribute 'values'

I would guess replace rvals = other.values with

try:
    rvals = other.values
except AttributeError:
    pass

unless you specifically intended for this to fail?

Thanks,
Ludovic

@ludaavics
Copy link
Author

bump

@wesm
Copy link
Member

wesm commented Oct 29, 2012

Updated this to go into 0.9.1 bugfix release

@wesm wesm closed this as completed in 56fac89 Oct 31, 2012
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

2 participants