擅长:python、mysql、java
<blockquote>
<p>It's not smart enough to realize it's still a "vector" in math terms.</p>
</blockquote>
<p>更确切地说,它足够聪明,可以识别维度上的差异。:-)</p>
<p>我认为您可以做的最简单的事情是使用<code>iloc</code>按位置选择该行,这将为您提供一个列作为新索引、值作为值的系列:</p>
<pre><code>>>> df = pd.DataFrame([list(range(5))], columns=["a{}".format(i) for i in range(5)])
>>> df
a0 a1 a2 a3 a4
0 0 1 2 3 4
>>> df.iloc[0]
a0 0
a1 1
a2 2
a3 3
a4 4
Name: 0, dtype: int64
>>> type(_)
<class 'pandas.core.series.Series'>
</code></pre>