You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using abs in place of fabs to support more data types #5356
I have an np.array of decimal.Decimals, and I wanted to compute Median Absolute Deviation on the data, but it was not possible to do so because np.fabs is used to get the absolute value, but decimals have no fabs method so it fails:
Things would work without problems if np.abs was used instead (and c converted to decimal, but this is on user's side). I suspect fabs is used to maintain compatibility with python2.
But, since python2 is going to be dropped in a year or so and the use of fabs reduces the number of data types supported, I would like to propose the switch to np.abs and allow to work with unusual data types. I worked just with MAD, but I can see fabs is used in other places of the code.
This can happen, of course, if you plan to drop support of python2 as well. But I might be mistaken, and fabs is not there for python2 :)
fabs can be replaced by np.abs without problems and python compatibility issues.
(I never used python's abs.)
I'm not sure why Skipper used fabs, I guess the main reason for fabs was computational efficiency.
I have changed or have issues or PRs to change some fabs in other places to np.abs.
aside: I'm surprised any function in statsmodels would work with decimal.Decimal
Activity
josef-pkt commentedon Oct 29, 2018
fabs can be replaced by np.abs without problems and python compatibility issues.
(I never used python's abs.)
I'm not sure why Skipper used fabs, I guess the main reason for fabs was computational efficiency.
I have changed or have issues or PRs to change some fabs in other places to np.abs.
aside: I'm surprised any function in statsmodels would work with
decimal.DecimalBUG/ENH: Improve RLM in the case of perfect fit
BUG/ENH: Improve RLM in the case of perfect fit
BUG/ENH: Improve RLM in the case of perfect fit