pydata / pydata/xarray

Support .reindex with DataArrays and Dataset as indexers

Open
#7,193 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

I want to select data using Dataset as indexers but fill missing with NaN, but I found that the .sel method should match all the indices. After searching the doc, I get that the method .reindex can allow some indices that not match and fill them with NaN. But unfortunately the .reindex does not support DataArrays and Dataset as indexers.
I think the best way to deal this situation is adding this support to .reindex method, so we can keep maximum compatibility and make less implication changed, shall we?

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 by comparing the existing .reindex and .sel behavior for DataArray and Dataset indexers, using the issue's missing-index and NaN-filling scenario as the acceptance case. Done means .reindex accepts these indexers, permits unmatched indices, and fills missing values with NaN while preserving compatibility with existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.