Python 将嵌套列表的字典转换为DataFrame
我有一本嵌套列表的字典Python 将嵌套列表的字典转换为DataFrame,python,dataframe,dictionary,nested-lists,Python,Dataframe,Dictionary,Nested Lists,我有一本嵌套列表的字典 d = {'IBGB100': [RealTimeBar(time=datetime.datetime(2019, 2, 21, 19, 17, tzinfo=datetime.timezone.utc), open_=7169.42, high=7169.67, low=7169.42, close=7169.42, volume=-1, wap=-1.0, count=-1), RealTimeBar(time=datetime.da
d = {'IBGB100': [RealTimeBar(time=datetime.datetime(2019, 2, 21, 19, 17, tzinfo=datetime.timezone.utc), open_=7169.42, high=7169.67, low=7169.42, close=7169.42, volume=-1, wap=-1.0, count=-1),
RealTimeBar(time=datetime.datetime(2019, 2, 21, 19, 17, 5, tzinfo=datetime.timezone.utc), open_=7169.42, high=7169.42, low=7168.92, close=7168.92, volume=-1, wap=-1.0, count=-1)],
'IBEU50': [RealTimeBar(time=datetime.datetime(2019, 2, 21, 19, 17, tzinfo=datetime.timezone.utc), open_=3262.455, high=3262.455, low=3262.455, close=3262.455, volume=-1, wap=-1.0, count=-1),
RealTimeBar(time=datetime.datetime(2019, 2, 21, 19, 17, 5, tzinfo=datetime.timezone.utc), open_=3262.455, high=3262.455, low=3262.455, close=3262.455, volume=-1, wap=-1.0, count=-1)],
'IBDE30': [RealTimeBar(time=datetime.datetime(2019, 2, 21, 19, 17, tzinfo=datetime.timezone.utc), open_=11417.15, high=11417.655, low=11416.9, close=11416.9, volume=-1, wap=-1.0, count=-1),
RealTimeBar(time=datetime.datetime(2019, 2, 21, 19, 17, 5, tzinfo=datetime.timezone.utc), open_=11416.9, high=11416.905, low=11416.15, close=11416.65, volume=-1, wap=-1.0, count=-1)]}
我正试图转换成这种格式的数据帧
instrument datetime open high low close volume wap count
'IBGB100' 2019, 2, 21, 19, 17, 7169.42 7169.67 7169.42 7169.42 -1 -1.0 -1
2019, 2, 21, 19, 17, 5, 7169.42 7169.42 7168.92 7168.92 -1 -1.0 -1
'IBEU50' 2019, 2, 21, 19, 17, 3262.455 3262.455 3262.455 3262.455 -1 -1.0 -1
2019, 2, 21, 19, 17, 5, 3262.455 3262.455 3262.455 3262.455 -1 -1.0 -1
'IBDE30' 2019, 2, 21, 19, 17, 11417.15 11417.655 11416.9 11416.9 -1 -1.0 -1
2019, 2, 21, 19, 17, 5, 11416.9 11416.905 11416.15 11416.65 -1 -1.0 -1
pd.DataFrame(d).transpose()让我很接近,但我无法确定如何以列的形式访问嵌套列表数据
嵌套列表返回为1xN形状(即按列展开),而不是我需要的Nx8形状(即按行展开)
0 1
'IBGB100' RealTimeBar(...) RealTimeBar(...)
'IBEU50' RealTimeBar(...) RealTimeBar(...)
'IBDE30' RealTimeBar(...) RealTimeBar(...)
什么是
RealTimeBar
?除此之外,什么类型的对象是RealTimeBar
?源代码基于什么以及什么是RealTimeBar?除此之外,什么类型的对象是RealTimeBar
?基于和的源代码