MCPcopy
hub / github.com/pandas-dev/pandas / sum

Method sum

pandas/core/groupby/groupby.py:2954–3073  ·  view source on GitHub ↗

Compute sum of group values. Parameters ---------- numeric_only : bool, default False Include only float, int, boolean columns. .. versionchanged:: 2.0.0 numeric_only no longer accepts ``None``. min_count : int, def

(
        self,
        numeric_only: bool = False,
        min_count: int = 0,
        skipna: bool = True,
        engine: Literal["cython", "numba"] | None = None,
        engine_kwargs: dict[str, bool] | None = None,
    )

Source from the content-addressed store, hash-verified

2952
2953 @final
2954 def sum(
2955 self,
2956 numeric_only: bool = False,
2957 min_count: int = 0,
2958 skipna: bool = True,
2959 engine: Literal["cython", "numba"] | None = None,
2960 engine_kwargs: dict[str, bool] | None = None,
2961 ):
2962 """
2963 Compute sum of group values.
2964
2965 Parameters
2966 ----------
2967 numeric_only : bool, default False
2968 Include only float, int, boolean columns.
2969
2970 .. versionchanged:: 2.0.0
2971
2972 numeric_only no longer accepts ``None``.
2973
2974 min_count : int, default 0
2975 The required number of valid values to perform the operation. If fewer
2976 than ``min_count`` non-NA values are present the result will be NA.
2977
2978 skipna : bool, default True
2979 Exclude NA/null values. If the entire group is NA and ``skipna`` is
2980 ``True``, the result will be NA.
2981
2982 .. versionchanged:: 3.0.0
2983
2984 engine : str, default None None
2985 * ``'cython'`` : Runs rolling apply through C-extensions from cython.
2986 * ``'numba'`` : Runs rolling apply through JIT compiled code from numba.
2987 Only available when ``raw`` is set to ``True``.
2988 * ``None`` : Defaults to ``'cython'`` or globally setting
2989 ``compute.use_numba``
2990
2991 engine_kwargs : dict, default None None
2992 * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
2993 * For ``'numba'`` engine, the engine can accept ``nopython``, ``nogil``
2994 and ``parallel`` dictionary keys. The values must either be ``True`` or
2995 ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
2996 ``{'nopython': True, 'nogil': False, 'parallel': False}`` and will be
2997 applied to both the ``func`` and the ``apply`` groupby aggregation.
2998
2999 Returns
3000 -------
3001 Series or DataFrame
3002 Computed sum of values within each group.
3003
3004 See Also
3005 --------
3006 SeriesGroupBy.min : Return the min of the group values.
3007 DataFrameGroupBy.min : Return the min of the group values.
3008 SeriesGroupBy.max : Return the max of the group values.
3009 DataFrameGroupBy.max : Return the max of the group values.
3010 SeriesGroupBy.sum : Return the sum of the group values.
3011 DataFrameGroupBy.sum : Return the sum of the group values.

Callers 1

value_countsMethod · 0.45

Calls 3

_numba_agg_generalMethod · 0.95
_agg_generalMethod · 0.95
maybe_use_numbaFunction · 0.90

Tested by

no test coverage detected