1
我有一個json記錄讀入熊貓的列表。將JSON記錄列入Pandas面板?
import pandas as pd
data = [{'eurusd': {'buy': 1, 'sell': 2}, 'eurcny': {'buy': 3, 'sell': 4}},
{'eurusd': {'buy': 5, 'sell': 6}, 'eurcny': {'buy': 7, 'sell': 8}}]
>>> pd.DataFrame(data[0])
eurcny eurusd
buy 3 1
sell 4 2
我不知道是否有可能做這樣的事情:
pd.Panel(數據項= '買入', '賣出'],major_axis = [0,1], minor_axis = [ 'EURUSD', 'eurcny'])