如果您的Dataframe仅包含一行,则使用
iloc,作为Series访问第一行(唯一),然后使用列名访问值:
In [3]: sub_dfOut[3]: A B2 -0.133653 -0.030854In [4]: sub_df.iloc[0]Out[4]:A -0.133653B -0.030854Name: 2, dtype: float64In [5]: sub_df.iloc[0]['A']Out[5]: -0.13365288513107493

如果您的Dataframe仅包含一行,则使用
iloc,作为Series访问第一行(唯一),然后使用列名访问值:
In [3]: sub_dfOut[3]: A B2 -0.133653 -0.030854In [4]: sub_df.iloc[0]Out[4]:A -0.133653B -0.030854Name: 2, dtype: float64In [5]: sub_df.iloc[0]['A']Out[5]: -0.13365288513107493