У меня есть вложенный словарь, который выглядит следующим образом:
{'NSE_FO:NIFTY28DEC21000CE': {'ohlc': None,
'depth': {'buy': [{'quantity': 0, 'price': 0.0, 'orders': 0},
{'quantity': 1, 'price': 3.0, 'orders': 1},
{'quantity': 1, 'price': 3.0, 'orders': 1}],
'sell': [{'quantity': 0, 'price': 0.0, 'orders': 0},
{'quantity': 1, 'price': 3.0, 'orders': 1},
{'quantity': 1, 'price': 3.0, 'orders': 1}]},
},
'NSE_FO:NIFTY28DEC24000CE': {'ohlc': None,
'depth': {'buy': [{'quantity': 1, 'price': 3.0, 'orders': 0},
{'quantity': 1, 'price': 1.0, 'orders': 1},
{'quantity': 2, 'price': 2.0, 'orders': 1}],
'sell': [{'quantity': 0, 'price': 0.0, 'orders': 0},
{'quantity': 3, 'price': 3.0, 'orders': 1},
{'quantity': 4, 'price': 4.0, 'orders': 1}]},
},
'NSE_FO:NIFTY28DEC28000PE': {'ohlc': {'open': 0.0,
'high': 0.0,
'low': 0.0,
'close': 0.0},
'depth': {'buy': [{'quantity': 250, 'price': 1040.05, 'orders': 1},
{'quantity': 4, 'price': 1.0, 'orders': 1},
{'quantity': 2, 'price': 3.0, 'orders': 1}],
'sell': [{'quantity': 0, 'price': 0.0, 'orders': 1},
{'quantity': 3, 'price': 3.0, 'orders': 1},
{'quantity': 4, 'price': 4.0, 'orders': 1}]},
}}
Я хочу извлечь первое значение цены из глубины->buy->цены каждого NSE_FO:NIFTY28DEC24000CE' без использования цикла и вставить его в новый столбец. возможно ли это?
желаемый результат:
0.0
3.0
1040.05
Подробнее здесь: https://stackoverflow.com/questions/786 ... n-to-a-col