Skip to content

Whether should we follow pandas or numpy if they have different API? #1886

Closed
@fujiisoup

Description

@fujiisoup

In working with #1883, I noticed that our (and numpy's) std and var work differently from pandas.
Pandas assumes ddof=1 as default, while we assume ddof=0.
Do we want to match these behaviors to pandas?

In [1]: import numpy as np
   ...: import xarray as xr
   ...: da = xr.DataArray([0, 1, 2], dims='x', name='da')

In [2]: da.std()
Out[2]: 
<xarray.DataArray 'da' ()>
array(0.816496580927726)

In [3]: da.to_dataframe().std()
Out[3]: 
da    1.0
dtype: float64

In [4]: da.std(ddof=1)
Out[4]: 
<xarray.DataArray 'da' ()>
array(1.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions