<bdo id='21iaD'></bdo><ul id='21iaD'></ul>

      <i id='21iaD'><tr id='21iaD'><dt id='21iaD'><q id='21iaD'><span id='21iaD'><b id='21iaD'><form id='21iaD'><ins id='21iaD'></ins><ul id='21iaD'></ul><sub id='21iaD'></sub></form><legend id='21iaD'></legend><bdo id='21iaD'><pre id='21iaD'><center id='21iaD'></center></pre></bdo></b><th id='21iaD'></th></span></q></dt></tr></i><div id='21iaD'><tfoot id='21iaD'></tfoot><dl id='21iaD'><fieldset id='21iaD'></fieldset></dl></div>
      <legend id='21iaD'><style id='21iaD'><dir id='21iaD'><q id='21iaD'></q></dir></style></legend>
    1. <small id='21iaD'></small><noframes id='21iaD'>

    2. <tfoot id='21iaD'></tfoot>
    3. Numpy:快速找到第一个价值索引

      时间:2023-08-30
        <bdo id='x0DGk'></bdo><ul id='x0DGk'></ul>
        1. <tfoot id='x0DGk'></tfoot>
        2. <i id='x0DGk'><tr id='x0DGk'><dt id='x0DGk'><q id='x0DGk'><span id='x0DGk'><b id='x0DGk'><form id='x0DGk'><ins id='x0DGk'></ins><ul id='x0DGk'></ul><sub id='x0DGk'></sub></form><legend id='x0DGk'></legend><bdo id='x0DGk'><pre id='x0DGk'><center id='x0DGk'></center></pre></bdo></b><th id='x0DGk'></th></span></q></dt></tr></i><div id='x0DGk'><tfoot id='x0DGk'></tfoot><dl id='x0DGk'><fieldset id='x0DGk'></fieldset></dl></div>

            <small id='x0DGk'></small><noframes id='x0DGk'>

            <legend id='x0DGk'><style id='x0DGk'><dir id='x0DGk'><q id='x0DGk'></q></dir></style></legend>

              <tbody id='x0DGk'></tbody>

                本文介绍了Numpy:快速找到第一个价值索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                如何在 Numpy 数组中找到第一次出现的数字的索引?速度对我来说很重要.我对以下答案不感兴趣,因为它们会扫描整个数组并且在发现第一次出现时不会停止:

                How can I find the index of the first occurrence of a number in a Numpy array? Speed is important to me. I am not interested in the following answers because they scan the whole array and don't stop when they find the first occurrence:

                itemindex = numpy.where(array==item)[0][0]
                nonzero(array == item)[0][0]
                

                注意 1:该问题的答案似乎都不相关 是否有一个 Numpy 函数可以返回数组中某物的第一个索引?

                Note 1: none of the answers from that question seem relevant Is there a Numpy function to return the first index of something in an array?

                注意 2:使用 C 编译的方法优于 Python 循环.

                Note 2: using a C-compiled method is preferred to a Python loop.

                推荐答案

                有一个针对 Numpy 2.0.0 计划的功能请求:https://github.com/numpy/numpy/issues/2269

                There is a feature request for this scheduled for Numpy 2.0.0: https://github.com/numpy/numpy/issues/2269

                这篇关于Numpy:快速找到第一个价值索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:FileNotFoundError: [Errno 2] 没有这样的文件或目录 下一篇:如何检查字符串中的字符是否为字母?(Python)

                相关文章

              1. <tfoot id='zFAEY'></tfoot>
                  <bdo id='zFAEY'></bdo><ul id='zFAEY'></ul>

              2. <small id='zFAEY'></small><noframes id='zFAEY'>

              3. <i id='zFAEY'><tr id='zFAEY'><dt id='zFAEY'><q id='zFAEY'><span id='zFAEY'><b id='zFAEY'><form id='zFAEY'><ins id='zFAEY'></ins><ul id='zFAEY'></ul><sub id='zFAEY'></sub></form><legend id='zFAEY'></legend><bdo id='zFAEY'><pre id='zFAEY'><center id='zFAEY'></center></pre></bdo></b><th id='zFAEY'></th></span></q></dt></tr></i><div id='zFAEY'><tfoot id='zFAEY'></tfoot><dl id='zFAEY'><fieldset id='zFAEY'></fieldset></dl></div>
                <legend id='zFAEY'><style id='zFAEY'><dir id='zFAEY'><q id='zFAEY'></q></dir></style></legend>