-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
API DesignDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations
Milestone
Description
This is and API change in numpy >= 1.7, but need to work around. Numpy now
looks at the structure for a prod
method (if the function is not operating on a numpy array), if it has one, then it passes the arguments
axis,dtype,out
, currently these types of methods only aceept axis
, need to accept dtype,out
as dummy arguments for compat
affects mean,sum,prod,std
...prob others
In [1]: df = DataFrame(randn(10,2))
In [2]: np.prod(df)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-2-99feb18ea783> in <module>()
----> 1 np.prod(df)
/usr/local/lib/python2.7/site-packages/numpy/core/fromnumeric.pyc in prod(a, axis, dtype, out, keepdims)
2111 return _methods._prod(a, axis=axis, dtype=dtype,
2112 out=out, keepdims=keepdims)
-> 2113 return prod(axis=axis, dtype=dtype, out=out)
2114 else:
2115 return _methods._prod(a, axis=axis, dtype=dtype,
TypeError: prod() got an unexpected keyword argument 'dtype'
In [3]: np.prod(df.values)
Out[3]: -2.2566177751865827e-07
In [4]: np.prod(df.values,axis=1)
Out[4]:
array([-0.00912739, 0.00569453, 0.58508784, 0.87462665, -0.32556754,
0.12015118, 1.01860104, -0.15380337, -0.54518287, -2.5393832 ])
Metadata
Metadata
Assignees
Labels
API DesignDtype ConversionsUnexpected or buggy dtype conversionsUnexpected or buggy dtype conversionsNumeric OperationsArithmetic, Comparison, and Logical operationsArithmetic, Comparison, and Logical operations