Pandas Design Considerations for MultiIndexed Dataframes
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The purpose of this question is to further explore MultiIndex dataframes and to ask questions of the best approach for various tasks. Create the DataFrame import pandas as pd df = pd.DataFrame({'index_date' : ['12/07/2016','12/07/2016','12/07/2016','12/07/2016','12/07/2016'], 'portfolio' : ['A','B','C','D','E'], 'reporting_ccy' : ['GBP','GBP','GBP','GBP','GBP'], 'portfolio_ccy' : ['JPY','USD','USD','EUR','EUR'], 'amount' : [100,200,300,400,500], 'injection' : [1,2,3,4,5], 'to_usd' : [1.3167,1.3167,1.3167,1.3167,1.3167], 'to_ccy' : [0.009564