pd.pivot_table中的列与值

时间:2019-10-30 10:07:32

标签: python pandas dataframe pivot-table

我正在尝试创建具有不同数据类型的数据透视表:对象和float64。

当我介绍以下代码时,我收到以下输出:

 pd.pivot_table(filed_wordpress, index='Source', values=['Purchase Type',
 'Customer Location',
 'Total Transactions',
 'Total billed £',
 'Average Purchase Value',
 'Status',
 'Payment Date',
 'New subscription'])```

Output:

```New subscription Total Transactions Source       
EN - FB -  1??????? 99   1.000000    1.266667
Philippines - FB -  1??????? 9.99    1.014493    1.202899
WW - FB -  1??????? 29.100   1.000000    1.000000
WW - FB -  1??????? 29.99    1.026667    1.226667
WW - FB - $1 Academy £99    1.000000    2.000000```

Why object columns are not added to the pivot table?

If I try to replace the code for:
``` pd.pivot_table(filed_wordpress, index='Source', columns=['Purchase Type',
 'Customer Location',
 'Total Transactions',
 'Total billed £',
 'Average Purchase Value',
 'Status',
 'Payment Date',
 'New subscription']) ```

I get the following input:
``` Source ```


Any idea?

0 个答案:

没有答案