Registry Mirror
Skip to content

Conversation

@mvanhorn

@mvanhorn mvanhorn commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Corrects the DataArray.pad docstring so the documented constant_values default matches the real signature and agrees with Dataset.pad.

Why

The DataArray.pad docstring documented constant_values as default: 0, but the signature actually defaults to None, which forwards to Dataset.pad and pads with np.nan. Issue #11373 reports this as misleading: a user reading the docstring expects zero-padding and gets NaN, and the two methods' docs disagree.

Description

The DataArray.pad docstring in xarray/core/dataarray.py documented constant_values as default: 0, but the actual signature defaults to None, which forwards to Dataset.pad and pads with np.nan (as Dataset.pad's own docstring already states). Issue #11373 reports this mismatch as misleading. This corrects the documented default to None and aligns the prose with Dataset.pad ("Default is None, pads with np.nan"), so the two methods agree. Docstring only, no behavior change.

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: Claude (Claude Code). Prompt: correct the DataArray.pad constant_values docstring default from 0 to None to match the signature and Dataset.pad.

@headtr1ck
headtr1ck enabled auto-merge (squash) September 26, 2026 19:52
@headtr1ck headtr1ck added topic-documentation plan to merge Final call for comments labels Sep 26, 2026
@headtr1ck
headtr1ck merged commit ea6a0f6 into pydata:main Sep 26, 2026
65 of 70 checks passed
@mvanhorn

mvanhorn commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Appreciate the quick merge, @headtr1ck. The DataArray.pad docstring now matches the real constant_values default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation error for DataArray.pad

2 participants