擅长:python、mysql、java
<p>您只需使用布尔索引:</p>
<pre><code>In [8]: animals == 'mammoth'
Out[8]:
canada False
germany False
iran True
brazil False
dtype: bool
In [9]: animals[animals == 'mammoth'].index
Out[9]: Index(['iran'], dtype='object')
</code></pre>
<p>注意,对于pandas数据结构,索引并不一定是唯一的。在</p>