简体   繁体   English

dataframe 中的组列,Multiindex pandas

[英]Group columns in dataframe, Multiindex pandas

I am calculating some correlations for a set of measures.我正在计算一组度量的一些相关性。 数据框

For each measure, I have a data frame of the look attached, which I will join in one data frame.对于每一项措施,我都有一个附加的外观数据框,我将把它加入一个数据框中。

I want to add multilevel indexing, with the name of the measure, above the columns I have.我想在我拥有的列上方添加带有度量名称的多级索引。 What is the best way of doing so?最好的方法是什么?

You can use corr to find the correlations within your columns您可以使用corr查找列中的相关性

df.corr()

Use this to split CI95% column into two columns使用它将 CI95% 列拆分为两列

df[['CI95%_1','CI95%_2']] = pd.DataFrame(df['CI95%'].tolist(), index= df.index)

Then use corr()然后使用corr()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM