pydata / pydata/xarray

Use `ddof=1` for `std` & `var`

Open
#8,566 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

topic-arrays
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

What is your issue?

I've discussed this a bunch with @dcherian (though I'm not sure he necessarily agrees, I'll let him comment)

Currently xarray uses ddof=0 for std & var. This is:

  • Rarely what someone actually wants — xarray data is almost always a sample of some underlying distribution, for which ddof=1 is correct
  • Inconsistent with pandas

OTOH:

  • It is consistent with numpy
  • It wouldn't be a painless change — folks who don't read deprecation messages would see values change very slightly

Any thoughts?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review xarray's std and var entry points, then compare their current ddof=0 behavior with the linked NumPy and pandas conventions. Done requires a maintainer decision on whether the defaults should change and how the compatibility impact, including deprecation messaging, should be handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, pandas, python
Domain
data
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.