溫馨提示×

python統計函數有哪些

養魚的貓咪
1006
2021-03-18 17:12:46
欄目: 編程語言

python中的統計函數:1.cumsum函數,返回給定軸上數組元素的累計和;2.cumprod函數,返回給定軸上數組元素的累積乘積。

python統計函數有哪些

python中常用的統計函數有以下幾種

1.cumsum

cumsum函數作用:

cumsum函數的作用是返回給定軸上數組元素的累計和。

cumsum函數使用方法:


import numpy as np

a = np.asarray([[1, 2, 3],

[4, 5, 6],

[7, 8, 9]

])

b = a.cumsum(axis=0)

print(b)

c = a.cumsum(axis=1)

print(c)


2.cumprod

cumprod函數作用:

cumprod函數的作用是返回給定軸上數組元素的累積乘積。

cumprod函數使用方法:


import numpy as geek


in_num = 10


print ("Input number:", in_num)


out_prod = geek.cumprod(in_num)

print ("cumulative product of input number:", out_prod)



0
亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女