matplotlib函数理解

cumsum(),通常用于计算一个数组各行的累加值,函数用法是B = cumsum(A,dim),或B = cumsum(A)。

    def cumsum(self, axis=0, *args, **kwargs):
        """
        Cumulative sum of non-NA/null values.

        When performing the cumulative summation, any non-NA/null values will
        be skipped. The resulting SparseSeries will preserve the locations of
        NaN values, but the fill value will be `np.nan` regardless.

        Parameters
        ----------
        axis : {0}

        Returns
        -------
        cumsum : SparseSeries
        """

举例说明:

data数据,对盈利求和是37535

# A1的cumsum()是前1行的数据之和;A2的cumsum()是前2行的数据之和(9173+5729=14902);……
data.cumsum()------ A1 9173 A2 14902 A3 19713 A4 23307 A5 26502 A6 29528 A7 31906 A8 33876 A9 35753 A10 37535
#Python程序段里的这条语句的意思是?
p = 1.0*data.cumsum()/data.sum()
# 1.0让数据浮点格式化
#
扫描二维码关注公众号,回复: 5788355 查看本文章

猜你喜欢

转载自www.cnblogs.com/daemonFlY/p/10659154.html
今日推荐