Pandas DataFrame.sum()Pandas DataFrame.sum() function is used to return the sum of the values for the requested axis by the user. If the input value is an index axis, then it will add all the values in a column and works same for all the columns. It returns a series that contains the sum of all the values in each column. It is also capable of skipping the missing values in the DataFrame while calculating the sum in the DataFrame. Syntax:Parameters
0 or 'index' is used for row-wise, whereas 1 or 'columns' is used for column-wise.
It is used to exclude all the null values.
It counts along a particular level and collapsing into a series, if the axis is a multiindex.
It includes only int, float, and boolean columns. If it is None, it will attempt to use everything, so numeric data should be used.
It refers to the required number of valid values to perform any operation. If it is fewer than the min_count non-NA values are present, then the result will be NaN.
Returns:It returns the sum of Series or DataFrame if a level is specified. Example1:Output 0.0 nan Example2:Output Name age total 0 Parker 32 99 1 Smith 28 99 2 William 39 99 Next TopicDataFrame.to_excel() |