擅长:python、mysql、java
<p>如果需要按位置选择需要<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.iloc.html" rel="nofollow">^{<cd1>}</a>:</p>
<pre><code>print (df['PE2'].iloc[3])
0.11
</code></pre>
<p>样品:</p>
^{pr2}$
<p>但如果需要按索引和列值选择,请使用<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.ix.html" rel="nofollow">^{<cd2>}</a>或<a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.loc.html" rel="nofollow">^{<cd3>}</a>:</p>
<pre><code>df = pd.DataFrame({'PE2':[1,2,3],
'B':[4,5,6]})
print (df)
B PE2
0 4 1
1 5 2
2 6 3
print (df.loc[2, 'PE2'])
3
print (df.ix[2, 'PE2'])
3
</code></pre>
<p>您还可以在<a href="http://pandas.pydata.org/pandas-docs/stable/index.html" rel="nofollow">pandas documentation</a>中选中<a href="http://pandas.pydata.org/pandas-docs/stable/indexing.html#selection-by-label" rel="nofollow">selection by label</a>和{a5}。在</p>