User Tools

Site Tools


python_dictionaries

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
python_dictionaries [2023/08/02 19:39] – [find key corresponding to a value] rajupython_dictionaries [2023/08/02 19:41] (current) – [find key corresponding to a value] raju
Line 18: Line 18:
 >>> print(key_val) >>> print(key_val)
 1 1
 +</code>
 +<code>
 >>> lookup_val = 'B' >>> lookup_val = 'B'
 >>> position = val_list.index(lookup_val) >>> position = val_list.index(lookup_val)
Line 24: Line 26:
 2 2
 </code> </code>
 +
 +Sample use case:
 +  * In https://github.com/KamarajuKusumanchi/notebooks/blob/master/finvizfinance/target_price.ipynb , I used the above technique to find the index corresponding to 'Target Price'.
  
 ==== initialize a dictionary ==== ==== initialize a dictionary ====
python_dictionaries.1691005188.txt.gz · Last modified: 2023/08/02 19:39 by raju