ENH: Implement __round__ special method for ndarrays
See original GitHub issueThis would allow calling round(array)
. While this would certainly be equivalent to np.round(array)
, a similar feature is already there with abs(array)
(which calls __abs__
) and np.abs(array)
.
Issue Analytics
- State:
- Created 8 years ago
- Comments:17 (16 by maintainers)
Top Results From Across the Web
Circular array - GeeksforGeeks
An array is called circular if we consider the first element as next of the last element. Circular arrays are used to implement...
Read more >Lodash Documentation
Creates an array of elements split into groups the length of size . If array can't be split ... Note: Unlike _.pullAll ,...
Read more >Easy Initializing for Records and Arrays - Oracle Blogs
Use the new qualified expressions to create functions when and where you need them.
Read more >Math.floor() - JavaScript - MDN Web Docs
The Math.floor() function always rounds down and returns the largest integer less than or equal to a given number.
Read more >Circular Pattern/Array in Blender - EngMorph
The procedure to make Circular Array is explained below: 4. Change pivot point to “3D Curser then Select the Three Vertices and Extrude...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sounds like we should just start with
decimals=None
raising an informative error, that way users can useround
and get an informative error when that doesn’t work.It could still be allowed in some future.
Partially, this seems to be a question also of whether the current
round(numpy_scalar)
is desired behaviour. I also do not like scalars and arrays treated differently.An alternative would be to generalize and have
round(array, ndigits=None)
cast toint64
(raising or warning on overflow). That would be backwards compatible except in cases like1e300
where the current answer is already not great.