Pandas 数据透视表 table 具有非常多的列

Pandas pivot table with very large number of columns

我有一个 pandas 数据框 df,大约有 1000 行但有 500 列。这些列被命名为 Run1、Run2、...、Run500

现有索引为datetime

dataframe的示例数据如下:

df.ix[1:4,1:4]
                       Run1    Run2    Date
2019-04-01 01:00:00  23.0263  23.0263  2019-04-01
2019-04-01 01:00:00  19.2212  19.2212  2019-04-01
2019-04-02 01:00:00  19.3694  19.3694  2019-04-02
2019-04-02 01:00:00  19.3694  19.3694  2019-04-02

我可以尝试以下操作:

pd.pivot_table(df, index=['Date'], values=['Run1'], aggfunc=[np.mean])['mean']

但我需要以下内容:

import pandas as pd
import numpy as np
pd.pivot_table(df, index=['Date'], values=['Run1', 'Run2', ...., 'Run500'], aggfunc=[np.mean])['mean']

我认为这是 groupby + mean

df.groupby('Date').mean()