Skip to content

docs: correct DataArray.pad constant_values default in docstring#11375

Open
mvanhorn wants to merge 1 commit into
pydata:mainfrom
mvanhorn:fix/11373-pad-constant-values-default
Open

docs: correct DataArray.pad constant_values default in docstring#11375
mvanhorn wants to merge 1 commit into
pydata:mainfrom
mvanhorn:fix/11373-pad-constant-values-default

Conversation

@mvanhorn
Copy link
Copy Markdown

@mvanhorn mvanhorn commented Jun 4, 2026

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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation error for DataArray.pad

1 participant