我无法弄清楚为什么我的数据透视表不起作用,这里是数据透视表和我正在使用的数据样本:
def pivot():
pivot = pd.pivot_table(clean(),index=['Channel','Advertiser Domain'],values=['eCPM'],columns=['Date'],aggfunc=np.mean)
return pivot
t = clean()
t.ix[0]
Channel COL1
Advertiser Domain whitecastle.com
Bids 35483
Imp. 20336
Avg. Bid CPM (USD) 8.13
Revenue (USD) 148.96
eCPM (USD) 7.33
Wins 83.97
Date 2015-04-14 00:00:00
Name: 0, dtype: object
t.info()
的输出:
Channel 13601 non-null object
Advertiser Domain 13601 non-null object
Bids 13601 non-null float64
Imp. 13601 non-null float64
Avg. Bid CPM (USD) 13601 non-null float64
Revenue (USD) 13601 non-null float64
eCPM (USD) 13601 non-null float64
Wins 13601 non-null float64
Date 13601 non-null datetime64[ns]
dtypes: datetime64[ns](1), float64(6), object(2)
memory usage: 1.0+ MB