Or as a one-liner:
out[np.arange(len(x)), x] = 1
If NEP 21 is accepted (
https://numpy.org/neps/nep-0021-advanced-indexing.html) this would be even
simpler:
out.vindex[:, x] = 1
Was there ever a decision about that NEP? I didn't follow the discussion
too closely at the time.
On Thu, May 20, 20
You could move some of the cost to index-creation time by converting the
per-row indices into flattened indices:
In [1]: a = np.random.random((5, 6))
In [2]: i = a.argmax(axis=1)
In [3]: a[np.arange(len(a)), i]
Out[3]: array([0.95774465, 0.90940106, 0.98025448, 0.97836906, 0.80483784])
In [4
Looks like Transplant can handle this use-case.
Blog post: http://bastibe.de/2015-11-03-matlab-engine-performance.html
GitHub link: https://github.com/bastibe/transplant
I haven't given it a try myself, but it looks promising.
On Mon, Aug 28, 2017 at 4:21 PM, Stephan Hoyer wrote:
> If you can
Is it feasible/desirable to provide a doctest runner that ignores
whitespace? That would allow downstream projects to fix their doctests on
1.14+ with a one-line change, without breaking tests on 1.13.
On Fri, Jun 30, 2017 at 11:11 AM, Allan Haldane
wrote:
> On 06/30/2017 03:55 AM, Juan Nunez-Ig
What do we think about the trade-offs of having a shared 2.7/3.x codebase
going forward?
As Python3 adds more nontrivial features, keeping compatibility with 2.7
becomes more burdensome.
Will there be a separate py2-numpy branch/repo at some point before ending
support?
On Apr 15, 2017 4:48 AM,