pandas.DataFrame.prod()

DataFrame中的prod()函数是返回不同维度上的乘积

prod函数有几个参数

axis(0 or 1)分别代表在纵轴和横轴上进行乘积运算

skipna(Boolean)计算时是否忽略空值

levelint or level name, default None

If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Series

 

numeric_only(Boolean)是否只计算数值

 

EXAMPLE

myDF=    

I 0  1  2  3  4
0  2  1  2  1  1
1  2  1  1  2  2
2  2  1  1  2  2
3  2  1  2  1  2

myDF.prod(axis=0)=

0    16
1     1
2     4
3     4
4     8

myDF.prod(axis=1) =

0    4
1    8
2    8
3    8


 

你可能感兴趣的:(python)