eland.DataFrame.var#

DataFrame.var(numeric_only: Optional[bool] = None) Series#

返回每个数字列的方差

参数#

numeric_only: {True, False, None} 默认值为 None

要返回的数据类型 - True: 将所有值作为 float64 返回,NaN/NaT 值将被删除 - None: 尽可能将所有值作为相同的 dtype 返回,NaN/NaT 将被删除 - False: 尽可能将所有值作为相同的 dtype 返回,NaN/NaT 将被保留

返回值#

pandas.Series

每个数字列的方差值

另请参阅#

pandas.DataFrame.var

示例#

>>> df = ed.DataFrame('http://localhost:9200', 'flights', columns=["AvgTicketPrice", "Cancelled", "dayOfWeek", "timestamp", "DestCountry"])
>>> df.var()  
AvgTicketPrice    70964.570234
Cancelled             0.111987
dayOfWeek             3.761279
dtype: float64
>>> df.var(numeric_only=True)
AvgTicketPrice    70964.570234
Cancelled             0.111987
dayOfWeek             3.761279
dtype: float64
>>> df.var(numeric_only=False)  
AvgTicketPrice     70964.6
Cancelled         0.111987
dayOfWeek          3.76128
timestamp              NaT
DestCountry            NaN
dtype: object