【问题标题】:How to keep the index of my pandas dataframe after normalazation. json如何在标准化后保留我的 pandas 数据框的索引。 json
【发布时间】:2021-02-28 12:24:15
【问题描述】:

我从 json 负载中得到一个 json 对象。 然后我制作一个 pdf df 现在我需要规范化许多隐藏在唯一列 ['open'] 中的嵌套信息 但我想保留原来的索引,索引有我的订单id的

这是json

{'error': [], 'result': {'open': {'OOACET-BMAFM-HNCONR': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605592530.3912, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14650.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14650.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OXJ3XN-56LKL-AJ47T4': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605560760.209, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13625.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13625.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OWS5QG-43O6P-GJ6D3I': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605560759.2277, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13650.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13650.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'O2E3V6-FVR32-MSEK5M': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605560758.7409, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13675.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13675.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OPBWN7-76LCH-PUFKBP': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605560758.2586, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13700.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13700.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OLMJHD-U2A2V-LUDNMQ': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605560757.7803, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13725.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13725.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OK4BTF-RUBIU-SYBI3H': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605560756.9636, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13750.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13750.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OWPO6O-2ITKQ-7PYNRD': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605560755.88, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13775.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13775.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OI4N5X-4XJNM-65ZVKK': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605560755.409, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13800.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13800.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OQJNLK-IJ5EC-KAJFZM': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605559538.5429, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14625.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14625.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OX4PEP-CQJF3-D5S4T4': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605559538.0649, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14600.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14600.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OTPY3E-P6ZNO-AKMFGS': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605559537.5156, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14575.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14575.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'ODPOEU-WSSWG-JOAXFX': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605559536.9612, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14550.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14550.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OERE3J-DZZDJ-IWYECU': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605554852.1838, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14525.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14525.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OVWFP7-6KLAD-FGQO6C': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605554707.2403, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14500.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14500.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OZB6V4-5SVQJ-Y6ADNE': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605554448.1384, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13950.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00102000 XBTEUR @ limit 13950.0', 'close': ''}, 'vol': '0.00102000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'O3FCJ5-VZQHF-MDAFQ2': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605549359.8677, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14475.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14475.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OC6GIB-QVZOY-O4BWHZ': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605549347.6533, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14450.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14450.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OMR6HL-NYYKP-3XJ3AI': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605549336.5905, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14425.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14425.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'O2BL5K-CGDVD-ROA3ID': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605548975.3411, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14400.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14400.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OH4E4L-6NLAW-GKYPZ5': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605548959.0035, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14375.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14375.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'ODH7V6-2ZUVJ-EKX7EB': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605548922.068, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14350.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14350.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OVTUAA-HGYRL-JX2GUH': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605548906.3953, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14325.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14325.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'O32BWW-7UB4U-N74YUK': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605548887.2891, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14300.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14300.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OCKQOP-JAKQO-63O6QI': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605547701.2241, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13925.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00102000 XBTEUR @ limit 13925.0', 'close': ''}, 'vol': '0.00102000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OA4LK5-G7TDS-JMAN4D': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605544664.1199, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13900.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13900.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OS4MJ5-3CZIC-2NBYCQ': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605544646.2401, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13875.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00200000 XBTEUR @ limit 13875.0', 'close': ''}, 'vol': '0.00200000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OG3IGS-H26YR-Q4JIJW': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605544494.1551, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14275.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14275.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OUCDM5-5GO4N-V7L4LN': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605543699.4908, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13850.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00102000 XBTEUR @ limit 13850.0', 'close': ''}, 'vol': '0.00102000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}, 'OPY3OV-OQGE2-76BFHJ': {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605543686.7376, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13825.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00102000 XBTEUR @ limit 13825.0', 'close': ''}, 'vol': '0.00102000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}}}}

这是 df 格式的 json 信息

O2BL5K-CGDVD-ROA3ID  {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605548975.3411, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14400.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14400.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}
O2E3V6-FVR32-MSEK5M    {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605560758.7409, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13675.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13675.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}
O32BWW-7UB4U-N74YUK  {'refid': None, 'userref': 0, 'status': 'open', 'opentm': 1605548887.2891, 'starttm': 0, 'expiretm': 0, 'descr': {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14300.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14300.0', 'close': ''}, 'vol': '0.00100000', 'vol_exec': '0.00000000', 'cost': '0.00000', 'fee': '0.00000', 'price': '0.00000', 'stopprice': '0.00000', 'limitprice': '0.00000', 'misc': '', 'oflags': 'fciq'}

这是我目前使用的代码。

data = json.loads(subprocess.check_output('python -m krakenapi OpenOrders'))
df = pd.DataFrame(data['result'])
df2 = pd.json_normalize(df['open'])

但现在我丢失了订单 ID

例如,我尝试了多种方法来立即正常化,但我最终会得到看起来很奇怪的 dfs

我真的需要“只是”最终得到一个包含 ['result']、['open'] 中所有列的数据框 同时保留最初创建的df的原始索引。包含我的所有订单 ID 的索引。 那时我不再需要成为索引。我可以存储在一个列中,但我确实需要知道正确的 id 已固定为正确的顺序。 我猜这很明显。

编辑:我也尝试过类似的东西 df = pd.DataFrame(data['result'], index = id_set [:, 2:5])

df2 = pd.json_normalize(df['open'], index = ) 但一切都没有成功,因为它是一个意外的参数或字符串对象没有值

【问题讨论】:

    标签: python json pandas indexing normalize


    【解决方案1】:
    import pandas as pd
    
    # get fields of interest 
    open_results = data["result"]["open"]
    
    # store nested dictionary as (key1,(k11,k12,13,..k1n))
    df = pd.DataFrame.from_dict(open_results, orient='index')
    
    # flatten index to have a flatten dataset (key1,k11,k12,13,..k1n)
    df = df.reset_index().rename(columns={"index": "id"})
    
    # Note: the field "descr" is a nested dictionary, you might want to flatten that one too.
    # However this is currently out of the scope of the question.
    
    

    输出:

    +----+---------------------+---------+-----------+----------+-------------+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+------------+--------+-------+---------+-------------+--------------+--------+----------+
    |    | id                  | refid   |   userref | status   |      opentm |   starttm |   expiretm | descr                                                                                                                                                                           |     vol |   vol_exec |   cost |   fee |   price |   stopprice |   limitprice | misc   | oflags   |
    |----+---------------------+---------+-----------+----------+-------------+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+------------+--------+-------+---------+-------------+--------------+--------+----------|
    |  0 | OOACET-BMAFM-HNCONR |         |         0 | open     | 1.60559e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14650.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14650.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    |  1 | OXJ3XN-56LKL-AJ47T4 |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13625.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13625.0', 'close': ''}   | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    |  2 | OWS5QG-43O6P-GJ6D3I |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13650.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13650.0', 'close': ''}   | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    |  3 | O2E3V6-FVR32-MSEK5M |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13675.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13675.0', 'close': ''}   | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    |  4 | OPBWN7-76LCH-PUFKBP |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13700.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13700.0', 'close': ''}   | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    |  5 | OLMJHD-U2A2V-LUDNMQ |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13725.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13725.0', 'close': ''}   | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    |  6 | OK4BTF-RUBIU-SYBI3H |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13750.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13750.0', 'close': ''}   | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    |  7 | OWPO6O-2ITKQ-7PYNRD |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13775.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13775.0', 'close': ''}   | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    |  8 | OI4N5X-4XJNM-65ZVKK |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13800.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13800.0', 'close': ''}   | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    |  9 | OQJNLK-IJ5EC-KAJFZM |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14625.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14625.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 10 | OX4PEP-CQJF3-D5S4T4 |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14600.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14600.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 11 | OTPY3E-P6ZNO-AKMFGS |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14575.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14575.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 12 | ODPOEU-WSSWG-JOAXFX |         |         0 | open     | 1.60556e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14550.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14550.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 13 | OERE3J-DZZDJ-IWYECU |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14525.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14525.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 14 | OVWFP7-6KLAD-FGQO6C |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14500.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14500.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 15 | OZB6V4-5SVQJ-Y6ADNE |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13950.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00102000 XBTEUR @ limit 13950.0', 'close': ''}   | 0.00102 |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 16 | O3FCJ5-VZQHF-MDAFQ2 |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14475.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14475.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 17 | OC6GIB-QVZOY-O4BWHZ |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14450.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14450.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 18 | OMR6HL-NYYKP-3XJ3AI |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14425.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14425.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 19 | O2BL5K-CGDVD-ROA3ID |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14400.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14400.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 20 | OH4E4L-6NLAW-GKYPZ5 |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14375.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14375.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 21 | ODH7V6-2ZUVJ-EKX7EB |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14350.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14350.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 22 | OVTUAA-HGYRL-JX2GUH |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14325.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14325.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 23 | O32BWW-7UB4U-N74YUK |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14300.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14300.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 24 | OCKQOP-JAKQO-63O6QI |         |         0 | open     | 1.60555e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13925.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00102000 XBTEUR @ limit 13925.0', 'close': ''}   | 0.00102 |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 25 | OA4LK5-G7TDS-JMAN4D |         |         0 | open     | 1.60554e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13900.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00100000 XBTEUR @ limit 13900.0', 'close': ''}   | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 26 | OS4MJ5-3CZIC-2NBYCQ |         |         0 | open     | 1.60554e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13875.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00200000 XBTEUR @ limit 13875.0', 'close': ''}   | 0.002   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 27 | OG3IGS-H26YR-Q4JIJW |         |         0 | open     | 1.60554e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'sell', 'ordertype': 'limit', 'price': '14275.0', 'price2': '0', 'leverage': 'none', 'order': 'sell 0.00100000 XBTEUR @ limit 14275.0', 'close': ''} | 0.001   |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 28 | OUCDM5-5GO4N-V7L4LN |         |         0 | open     | 1.60554e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13850.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00102000 XBTEUR @ limit 13850.0', 'close': ''}   | 0.00102 |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    | 29 | OPY3OV-OQGE2-76BFHJ |         |         0 | open     | 1.60554e+09 |         0 |          0 | {'pair': 'XBTEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '13825.0', 'price2': '0', 'leverage': 'none', 'order': 'buy 0.00102000 XBTEUR @ limit 13825.0', 'close': ''}   | 0.00102 |          0 |      0 |     0 |       0 |           0 |            0 |        | fciq     |
    +----+---------------------+---------+-----------+----------+-------------+-----------+------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------+------------+--------+-------+---------+-------------+--------------+--------+----------+
    

    编辑:展平“descr”字段并不是一件大事,这里是代码:

    import pandas as pd
    
    # get fields of interest
    open_results = json_dict["result"]["open"]
    
    # flatten description fields
    for main_key, main_val in open_results.items():
        group = open_results[main_key]
        for key, val in group["descr"].items():
            group.update({key: val})
        group.pop("descr", None)
    
    # store nested dictionary as (key1,(k11,k12,13,..k1n))
    df = pd.DataFrame.from_dict(open_results, orient='index')
    # flatten index to have a flatten dataset (key1,k11,k12,13,..k1n)
    df = df.reset_index().rename(columns={"index": "id"})
    

    输出:

    +----+---------------------+---------+-----------+----------+-------------+-----------+------------+---------+------------+--------+-------+---------+-------------+--------------+--------+----------+--------+--------+-------------+----------+------------+----------------------------------------+---------+
    |    | id                  | refid   |   userref | status   |      opentm |   starttm |   expiretm |     vol |   vol_exec |   cost |   fee |   price |   stopprice |   limitprice | misc   | oflags   | pair   | type   | ordertype   |   price2 | leverage   | order                                  | close   |
    |----+---------------------+---------+-----------+----------+-------------+-----------+------------+---------+------------+--------+-------+---------+-------------+--------------+--------+----------+--------+--------+-------------+----------+------------+----------------------------------------+---------|
    |  0 | OOACET-BMAFM-HNCONR |         |         0 | open     | 1.60559e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14650 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14650.0 |         |
    |  1 | OXJ3XN-56LKL-AJ47T4 |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   13625 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00100000 XBTEUR @ limit 13625.0  |         |
    |  2 | OWS5QG-43O6P-GJ6D3I |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   13650 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00100000 XBTEUR @ limit 13650.0  |         |
    |  3 | O2E3V6-FVR32-MSEK5M |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   13675 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00100000 XBTEUR @ limit 13675.0  |         |
    |  4 | OPBWN7-76LCH-PUFKBP |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   13700 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00100000 XBTEUR @ limit 13700.0  |         |
    |  5 | OLMJHD-U2A2V-LUDNMQ |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   13725 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00100000 XBTEUR @ limit 13725.0  |         |
    |  6 | OK4BTF-RUBIU-SYBI3H |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   13750 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00100000 XBTEUR @ limit 13750.0  |         |
    |  7 | OWPO6O-2ITKQ-7PYNRD |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   13775 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00100000 XBTEUR @ limit 13775.0  |         |
    |  8 | OI4N5X-4XJNM-65ZVKK |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   13800 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00100000 XBTEUR @ limit 13800.0  |         |
    |  9 | OQJNLK-IJ5EC-KAJFZM |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14625 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14625.0 |         |
    | 10 | OX4PEP-CQJF3-D5S4T4 |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14600 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14600.0 |         |
    | 11 | OTPY3E-P6ZNO-AKMFGS |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14575 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14575.0 |         |
    | 12 | ODPOEU-WSSWG-JOAXFX |         |         0 | open     | 1.60556e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14550 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14550.0 |         |
    | 13 | OERE3J-DZZDJ-IWYECU |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14525 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14525.0 |         |
    | 14 | OVWFP7-6KLAD-FGQO6C |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14500 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14500.0 |         |
    | 15 | OZB6V4-5SVQJ-Y6ADNE |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.00102 |          0 |      0 |     0 |   13950 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00102000 XBTEUR @ limit 13950.0  |         |
    | 16 | O3FCJ5-VZQHF-MDAFQ2 |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14475 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14475.0 |         |
    | 17 | OC6GIB-QVZOY-O4BWHZ |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14450 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14450.0 |         |
    | 18 | OMR6HL-NYYKP-3XJ3AI |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14425 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14425.0 |         |
    | 19 | O2BL5K-CGDVD-ROA3ID |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14400 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14400.0 |         |
    | 20 | OH4E4L-6NLAW-GKYPZ5 |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14375 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14375.0 |         |
    | 21 | ODH7V6-2ZUVJ-EKX7EB |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14350 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14350.0 |         |
    | 22 | OVTUAA-HGYRL-JX2GUH |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14325 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14325.0 |         |
    | 23 | O32BWW-7UB4U-N74YUK |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14300 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14300.0 |         |
    | 24 | OCKQOP-JAKQO-63O6QI |         |         0 | open     | 1.60555e+09 |         0 |          0 | 0.00102 |          0 |      0 |     0 |   13925 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00102000 XBTEUR @ limit 13925.0  |         |
    | 25 | OA4LK5-G7TDS-JMAN4D |         |         0 | open     | 1.60554e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   13900 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00100000 XBTEUR @ limit 13900.0  |         |
    | 26 | OS4MJ5-3CZIC-2NBYCQ |         |         0 | open     | 1.60554e+09 |         0 |          0 | 0.002   |          0 |      0 |     0 |   13875 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00200000 XBTEUR @ limit 13875.0  |         |
    | 27 | OG3IGS-H26YR-Q4JIJW |         |         0 | open     | 1.60554e+09 |         0 |          0 | 0.001   |          0 |      0 |     0 |   14275 |           0 |            0 |        | fciq     | XBTEUR | sell   | limit       |        0 | none       | sell 0.00100000 XBTEUR @ limit 14275.0 |         |
    | 28 | OUCDM5-5GO4N-V7L4LN |         |         0 | open     | 1.60554e+09 |         0 |          0 | 0.00102 |          0 |      0 |     0 |   13850 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00102000 XBTEUR @ limit 13850.0  |         |
    | 29 | OPY3OV-OQGE2-76BFHJ |         |         0 | open     | 1.60554e+09 |         0 |          0 | 0.00102 |          0 |      0 |     0 |   13825 |           0 |            0 |        | fciq     | XBTEUR | buy    | limit       |        0 | none       | buy 0.00102000 XBTEUR @ limit 13825.0  |         |
    +----+---------------------+---------+-----------+----------+-------------+-----------+------------+---------+------------+--------+-------+---------+-------------+--------------+--------+----------+--------+--------+-------------+----------+------------+----------------------------------------+---------+
    

    【讨论】:

    • 非常感谢,我还没有关注所有这些,所以我马上去试试。我现在已经从索引中创建了一个列。 df1 = df.rename_axis('txid').reset_index() 但我仍然无法对其进行规范化,因为他的关键 txid 没有值.. 我去尝试了解你在这里做了什么!
    • 我仍然没有完全理解,但它似乎像 pycharm 一样工作。 .大声笑谢谢!!!
    • 啊,太好了,不客气……祝项目顺利!
    猜你喜欢
    • 2020-06-02
    • 2022-01-24
    • 2021-07-20
    • 2020-07-10
    • 2014-09-01
    • 2014-06-12
    • 2013-12-03
    • 2021-09-23
    • 2019-06-14
    相关资源
    最近更新 更多