python - Pivot table problems: error 'No numeric types to aggregate' -
i can't figure out why pivot table isn't working, here pivot table , sample of data i'm working with:
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
output 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
Comments
Post a Comment