eland.groupby.DataFrameGroupBy.var

DataFrameGroupBy.var(numeric_only: bool = True) → pd.DataFrame

Compute the variance value for each group.

Parameters
numeric_only: {True, False, None} Default is True

Which datatype to be returned - True: Returns all values as float64, NaN/NaT values are removed - None: Returns all values as the same dtype where possible, NaN/NaT are removed - False: Returns all values as the same dtype where possible, NaN/NaT are preserved

Returns
pandas.DataFrame

variance value for each numeric column of each group

Examples

>>> df = ed.DataFrame(
...   "localhost", "flights",
...   columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "timestamp", "DestCountry"]
... )
>>> df.groupby("DestCountry").var() # doctest: +NORMALIZE_WHITESPACE
             AvgTicketPrice  Cancelled  dayOfWeek
DestCountry
AE             75789.979090   0.130443   3.950549
AR             59683.055316   0.125979   3.783429
AT             65726.669676   0.144610   4.090013
AU             65088.483446   0.113094   3.833562
CA             68149.950516   0.116496   3.688139
...                     ...        ...        ...
RU             67305.277617   0.114107   3.852666
SE             53740.570338   0.127062   3.942132
TR             61245.521047   0.094868   4.100420
US             74349.939410   0.109638   3.758700
ZA             62920.072901   0.126608   3.775609
<BLANKLINE>
[32 rows x 3 columns]