pydata / pydata/xarray

Changes to assignment warning in sel/isel methods

Open
#9,869 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

What is your issue?

I have a few suggestions on the warning against value assignment in the DataArray.sel documentation. I wanted to get a maintainer's opinion on if these changes are helpful before I submit a PR.

1. Similar functions should have this warning
DataArray.isel, Dataset.sel and Dataset.isel also can't be used for value assignment and should have a similar warning on their documentation page.

2. Warning should be specific to the function
Each warning should only warn against using a specific function. Currently the warning on DataArray.sel warns against using either DataArray.sel or DataArray.isel. The code example in the warning should use a specific function. The example in the DataArray.sel warning currently uses the isel method.

3. Warning should tell user how to properly assign values
The warning currently tells the user not to use isel/sel for value assignment but doesn't direct the user towards an alternative. The code example currently tells the user what not to do. The example can be extended by a line to show the correct way (i.e. direct/loc indexing)

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

Start with the linked DataArray.sel documentation, then inspect the corresponding DataArray.isel, Dataset.sel, and Dataset.isel documentation pages. Compare their assignment warnings and update the examples so each warning names only its own method and shows the appropriate assignment alternative; done when all four pages give consistent, function-specific guidance.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.