main_dict = {
'NSE:ACC': {'average_price': 0,
'buy_quantity': 0,
'depth': {'buy': [{'orders': 0, 'price': 0, 'quantity': 0},
{'orders': 0, 'price': 0, 'quantity': 0},
{'orders': 0, 'price': 0, 'quantity': 0},
{'orders': 0, 'price': 0, 'quantity': 0},
{'orders': 0, 'price': 0, 'quantity': 0}],
'sell': [{'orders': 0, 'price': 0, 'quantity': 0},
{'orders': 0, 'price': 0, 'quantity': 0},
{'orders': 0, 'price': 0, 'quantity': 0},
{'orders': 0, 'price': 0, 'quantity': 0},
{'orders': 0, 'price': 0, 'quantity': 0}]},
'instrument_token': 5633,
'last_price': 2488.9,
'last_quantity': 0,
'last_trade_time': '2022-09-23 15:59:10',
'lower_circuit_limit': 2240.05,
'net_change': 0,
'ohlc': {'close': 2555.7,
'high': 2585.5,
'low': 2472.2,
'open': 2575},
'oi': 0,
'oi_day_high': 0,
'oi_day_low': 0,
'sell_quantity': 0,
'timestamp': '2022-09-23 18:55:17',
'upper_circuit_limit': 2737.75,
'volume': 0},
'NSE:NIFTY BANK': {'instrument_token': 260105,
'last_price': 39546.25,
'net_change': -1084.35,
'ohlc': {'close': 40630.6,
'high': 40528.4,
'low': 39412.7,
'open': 40429.35},
'timestamp': '2022-09-23 18:26:21',
'tradingsymbol': 'NIFTY BANK'}}
convert dict to pandas dataframe
for example:
symbol last_price net_change Open High Low Close Volume average_price NSE:ACC 2488.9 0 2575 2585.5 2472.2 2555.7 0 0
I am trying pd.DataFrame.from_dict(main_dict) but it does not work. please give the best suggestion.