This is basic pandas indexing: please [read the tutorial on Indexing and selecting data](https://pandas.pydata.org/docs/user_guide/indexing.html). In your case, `df[df['symbol']=='SBIN-BL', 'token']`. If you do this a lot (look up rows by 'symbol') column, then make it your index.
– smciApr 21 '22 at 07:36
1
Also, please state your question in words, not just by reference to screenshots, and please post the code and data as text, not screenshots, then they can't be indexed, serched, retrieved (or even possibly viewed for some users).
– smciApr 21 '22 at 07:37
1 Answers1
0
Use:
out = next(iter(df.loc[df.symbol.eq('SBIN-BL'), 'token']), 'no match')
jezrael, this question was a duplicate of both the tutorial and SO questions with almost 3000 upvotes (once we find the desired rows, it's trivial to index the column(s)). Please post your answer on [How do I select rows from a DataFrame based on column values?](https://stackoverflow.com/questions/17071871/how-do-i-select-rows-from-a-dataframe-based-on-column-values/47693145#47693145) and I'll happily upvote it.
– smciApr 21 '22 at 09:38
@smci - dupe is for filtering, OP need scalar. I use `next` with `iter` for default value if no match.
– jezraelApr 21 '22 at 09:41
e.g. [this answer](https://stackoverflow.com/questions/17071871/how-do-i-select-rows-from-a-dataframe-based-on-column-values/47693145#47693145). Like I said, once we find the desired rows, it's trivial to index the column(s).
– smciApr 21 '22 at 09:41
@smci - hmmm, I cannot find any solution what need OP. in this lik get DataFrame, not scalar
– jezraelApr 21 '22 at 09:53