擅长:python、mysql、java
<p>您可以将类别分配给一个变量(例如<code>cats</code>),然后使用布尔索引检查序列中的值是否等于感兴趣的类别。在</p>
<pre><code>cats = manPriceCategories.cat.categories
>>> manPriceCategories.loc[manPriceCategories.eq(cats[1])]
9 (600, 800]
11 (600, 800]
Name: Price Value, dtype: category
Categories (13, interval[int64]): [(400, 600] < (600, 800] < (800, 1000] < (1000, 1200] ... (2200, 2400] < (2400, 2600] < (2600, 2800] < (2800, 3000]]
cats = manPriceCategories.cat.categories
cats = manPriceCategories.cat.categories
</code></pre>
<p>您可以使用字典理解来枚举您的类别,以便知道它们的索引位置(例如<code>1</code>for(600800])。在</p>
^{pr2}$