Compute variance of groups, excluding missing values. For multiple groupings, the result index will be a MultiIndex. Parameters ---------- ddof : int, default 1 Degrees of freedom. engine : str, default None * ``'cython'`` :
(
self,
ddof: int = 1,
engine: Literal["cython", "numba"] | None = None,
engine_kwargs: dict[str, bool] | None = None,
numeric_only: bool = False,
skipna: bool = True,
)
| 2510 | |
| 2511 | @final |
| 2512 | def var( |
| 2513 | self, |
| 2514 | ddof: int = 1, |
| 2515 | engine: Literal["cython", "numba"] | None = None, |
| 2516 | engine_kwargs: dict[str, bool] | None = None, |
| 2517 | numeric_only: bool = False, |
| 2518 | skipna: bool = True, |
| 2519 | ): |
| 2520 | """ |
| 2521 | Compute variance of groups, excluding missing values. |
| 2522 | |
| 2523 | For multiple groupings, the result index will be a MultiIndex. |
| 2524 | |
| 2525 | Parameters |
| 2526 | ---------- |
| 2527 | ddof : int, default 1 |
| 2528 | Degrees of freedom. |
| 2529 | |
| 2530 | engine : str, default None |
| 2531 | * ``'cython'`` : Runs the operation through C-extensions from cython. |
| 2532 | * ``'numba'`` : Runs the operation through JIT compiled code from numba. |
| 2533 | * ``None`` : Defaults to ``'cython'`` or globally setting |
| 2534 | ``compute.use_numba`` |
| 2535 | |
| 2536 | engine_kwargs : dict, default None |
| 2537 | * For ``'cython'`` engine, there are no accepted ``engine_kwargs`` |
| 2538 | * For ``'numba'`` engine, the engine can accept ``nopython``, ``nogil`` |
| 2539 | and ``parallel`` dictionary keys. The values must either be ``True`` or |
| 2540 | ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is |
| 2541 | ``{'nopython': True, 'nogil': False, 'parallel': False}`` |
| 2542 | |
| 2543 | numeric_only : bool, default False |
| 2544 | Include only `float`, `int` or `boolean` data. |
| 2545 | |
| 2546 | .. versionchanged:: 2.0.0 |
| 2547 | |
| 2548 | numeric_only now defaults to ``False``. |
| 2549 | |
| 2550 | skipna : bool, default True |
| 2551 | Exclude NA/null values. If an entire group is NA, the result will be NA. |
| 2552 | |
| 2553 | .. versionadded:: 3.0.0 |
| 2554 | |
| 2555 | Returns |
| 2556 | ------- |
| 2557 | Series or DataFrame |
| 2558 | Variance of values within each group. |
| 2559 | |
| 2560 | See Also |
| 2561 | -------- |
| 2562 | Series.var : Apply function var to a Series. |
| 2563 | DataFrame.var : Apply function var to each row or column of a DataFrame. |
| 2564 | |
| 2565 | Examples |
| 2566 | -------- |
| 2567 | For SeriesGroupBy: |
| 2568 | |
| 2569 | >>> lst = ["a", "a", "a", "b", "b", "b"] |
nothing calls this directly
no test coverage detected