【发布时间】:2020-02-05 21:33:40
【问题描述】:
我在 excel 中有一个实验室报告,其中包含多个级别的标题和多个变量,
enter image description here
我想将它还原到一张带有 pandas 的平面表中,格式如下图所示,有人可以帮忙吗?
【问题讨论】:
-
不要使用图像,而是添加创建输入数据帧示例的代码。 See this post
标签: python-3.x pandas
我在 excel 中有一个实验室报告,其中包含多个级别的标题和多个变量,
enter image description here
我想将它还原到一张带有 pandas 的平面表中,格式如下图所示,有人可以帮忙吗?
【问题讨论】:
标签: python-3.x pandas
您可以将其读入数据框中,在此答案中查看具体内容: reading excel sheet as multiindex dataframe through pd.read_excel()
然后将您的数据框与df.stack() 堆叠在一起。
【讨论】: