The example list
{
'date': array(['06/08/2016', '06/09/2016', '06/10/2016']),
'close': array([ 923.13, 914.25, 909.42])
}
I try to get the Date of close is 914.25 that is list['date'][2] but i don't know how to get index 2 for close.
Thank you.
You can solve it with zip() and next():
>>> d = {
... 'date': ['06/08/2016', '06/09/2016', '06/10/2016'],
... 'close': [ 923.13, 914.25, 909.42]
... }
>>> a = 914.25
>>> next(date for date, amount in zip(d['date'], d['close']) if amount == a)
'06/09/2016'
برچسب:
نویسنده: استخدام کار
تاريخ: دوشنبه
24 خرداد
1395 ساعت: 10:46