擅长:python、mysql、java
<p>在S/O上发帖时,请保持<em>最小</em>。据我所知,在你的20多行,你唯一的问题是保持一列,忽略其余的。这是一个简单的<a href="https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html" rel="nofollow noreferrer">indexing</a>任务。只能选择一列,如下所示:</p>
<pre><code>fine_by_country = fine_by_country.head(10)['fine']
</code></pre>
<p>如果确实要保留数据帧而不是序列:</p>
<pre class="lang-py prettyprint-override"><code>fine_by_country = fine_by_country.head(10)[['fine']] # double brackets
</code></pre>