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让数据浮点格式化
#

 

 

 

 

 

 

 

 

 

 

 

 

 

 


 

posted @ 2019-04-05 16:57  Daemonnnn  阅读(249)  评论(0编辑  收藏  举报