s = df.loc[df['instrument_token'].eq(12295682), 'tradingsymbol']
#alternative
s = df.loc[df['instrument_token'] == 12295682, 'tradingsymbol']
然后得到Series的第一个值:
a = s.iat[0]
a = s.iloc[0]
a = s.tolist()[0]
a = s.to_array()[0]
#general solution if not match condition and select first value failed
a = next(iter(s), 'no match')
您可以使用:
可以使用^{} 和^{} 作为按条件和列名筛选:
然后得到
Series
的第一个值:另一个想法是按列} fo索引:
instrument_token
使用^{然后按^{} 或
^{} :
试试看
相关问题 更多 >
编程相关推荐