[Numpy-discussion] Re: Feature query: fetch top/bottom k from array

2022-02-23 Thread Brock Mendel
pandas.Series has a nlargest/nsmallest method that might be upstream-able. On Wed, Feb 23, 2022 at 6:28 AM Friedrich Romstedt < friedrichromst...@gmail.com> wrote: > Am Di., 22. Feb. 2022 um 14:25 Uhr schrieb Joseph Bolton > : > > > > I find myself often requiring the indices and/or values of the

[Numpy-discussion] Re: Proposal for new function to determine if a float contains an integer

2022-01-23 Thread Brock Mendel
t; assert not f.is_integer() or int(f) == f >>> >>> never fails because integers have unlimited precision but this does >>> would not map into >>> >>> assert ( ~f_arr.is_integer() | (np.int64(f_arr) == f.arr) ).all() >>> >>> because of po

[Numpy-discussion] Re: Proposal for new function to determine if a float contains an integer

2021-12-30 Thread Brock Mendel
At least some of the commenters on that StackOverflow page need a slightly stronger check: not only is_integer(x), but also "np.iinfo(dtype).min <= x <= np.info(dtype).max" for some particular dtype. i.e. "Can I losslessly set these values into the array I already have?" On Thu, Dec 30, 2021 at

[Numpy-discussion] Re: An article on numpy data types

2021-12-28 Thread Brock Mendel
pandas does not use np.ma internally. On Tue, Dec 28, 2021 at 12:56 PM Lev Maximov wrote: > On Wed, Dec 29, 2021 at 12:45 AM Eric Firing wrote: > >> On 2021/12/27 10:09 PM, Lev Maximov wrote: >> > Btw, does it make sense to include the masked arrays? I know Pandas >> uses >> > something >> > li

[Numpy-discussion] Re: A bite of C++

2021-10-07 Thread Brock Mendel
Will this have any impact on the difficulty of finding "where is np.foo or ndarray.bar implemented"? On Thu, Oct 7, 2021 at 3:02 PM Sebastian Berg wrote: > On Wed, 2021-08-25 at 17:50 -0500, Sebastian Berg wrote: > > On Wed, 2021-08-25 at 17:48 +0200, Serge Guelton wrote: > > > Hi folks, > > > >

Re: [Numpy-discussion] Improving performance of the `numpy.any` function.

2021-04-14 Thread Brock Mendel
FWIW in https://github.com/pandas-dev/pandas/issues/32339 I tried short-circuiting (left == right).all() with a naive cython implementation. In the cases that _dont_ short-circuit, it was 2x slower than np.array_equal. On Wed, Apr 14, 2021 at 6:54 PM dan_patterson wrote: > a = np.zeros(1_000_000

Re: [Numpy-discussion] datetime64: Remove deprecation warning when constructing with timezone

2020-11-06 Thread Brock Mendel
> I find the whole notion of a "timezone naive timestamp" to be nearly meaningless >From the perspective of, say, the dateutil parser, what would you do with "2020-11-06 07:48"? If you assume it's UTC you'll be wrong in this case. If you assume it is in your local timezone, you'll be wrong in Eur

Re: [Numpy-discussion] Improving Complex Comparison/Ordering in Numpy

2020-06-04 Thread Brock Mendel
Corresponding pandas issue: https://github.com/pandas-dev/pandas/issues/28050 On Thu, Jun 4, 2020 at 9:17 PM Rakesh Vasudevan wrote: > Hi all, > > As a follow up to gh-15981 , > I would like to propose a change to bring complex dtype(s) comparison > o

Re: [Numpy-discussion] divmod(1.0, 0.0) bug

2020-05-08 Thread Brock Mendel
FWIW in pandas we post-process floordiv (and divmod) ops to get the "Expected Result" behavior from the OP. On Fri, May 8, 2020 at 11:56 AM Anirudh Subramanian wrote: > Hi all, > > There has been a discussion about divmod (1.0, 0.0) bug here : > https://github.com/numpy/numpy/issues/14900 and >