下午所有,
我有三个大的按结果分组。简化的 df 如下所示。第一个 df 是所有客户的总 RFQ 和总 RFQ 数量,没有通过产品和货币进行细分。
df1 = [('Year_Month', ['2017-11', '2017-12', '2018-01', '2018-02', '2018-05', '2018-06', '2018-07', '2018-08',]),
('Client', ['RBMI', 'RBMI', 'RBMI', 'RBMI', 'QCBO', 'QCBO', 'QCBO', 'QCBO',]),
('Total_RFQ_per_Client', [1, 2, 3, 4, 10, 20, 30, 40,]),
('Total_RFQ_Volume_per_Client', ['1000', '2000', '3000', '4000', '10000', '20000', '30000', '40000',]),
]
# create pandas df
df1 = pd.DataFrame.from_items(df1)
df1['Total_RFQ_per_Client']=df1.Total_RFQ_per_Client.astype('int64')
df1['Total_RFQ_Volume_per_Client']=df1.Total_RFQ_Volume_per_Client.astype('int64')
print(df1)
# df1.info()
print("")
Year_Month Client Total_RFQ_per_Client Total_RFQ_Volume_per_Client
0 2017-11 RBMI 1 1000
1 2017-12 RBMI 2 2000
2 2018-01 RBMI 3 3000
3 2018-02 RBMI 4 4000
4 2018-05 QCBO 10 10000
5 2018-06 QCBO 20 20000
6 2018-07 QCBO 30 30000
7 2018-08 QCBO 40 40000
第二个 df 是已完成并添加了产品和货币列的所有客户的询价和询价量。
print("All Clients - Done RFQ's - Done RFQ Volume - Broken down into Product and Currency", end='\n')
df2 = [('Year_Month', ['2017-11', '2018-01', '2018-01', '2018-02', '2018-05', '2018-07', '2018-08',]),
('Client', ['RBMI', 'RBMI', 'RBMI', 'RBMI', 'QCBO', 'QCBO', 'QCBO',]),
('Product', ['GOVT', 'GOVT', 'CORP', 'GOVT', 'GOVT', 'GOVT', 'GOVT',]),
('currency_str', ['USD', 'USD', 'GBP', 'USD', 'USD', 'USD', 'USD',]),
('Done_RFQ', [1, 1, 1, 1, 10, 20, 20,]),
('Done_RFQ_Volume', [1000, 500, 500, 1000, 10000, 20000, 20000,]),
]
MYYA
侃侃尔雅
相关分类