Skip to content

Add Dataset.subset() method for type-stable variable selection#10942

Open
shoyer wants to merge 2 commits into
pydata:mainfrom
shoyer:add-dataset-subset-method
Open

Add Dataset.subset() method for type-stable variable selection#10942
shoyer wants to merge 2 commits into
pydata:mainfrom
shoyer:add-dataset-subset-method

Conversation

@shoyer

@shoyer shoyer commented Nov 21, 2025

Copy link
Copy Markdown
Member

Addresses issue #3894 by providing a public API for selecting multiple variables that always returns a Dataset (unlike __getitem__) and accepts sequence types including tuples. This eliminates the need to convert tuples to lists when subsetting variables and provides better type stability for downstream code.

Unlike using __getitem__ with a list, an explicit method is more discoverable through IDE autocomplete and documentation.

shoyer and others added 2 commits November 21, 2025 15:33
Addresses issue pydata#3894 by providing a public API for selecting multiple
variables that always returns a Dataset (unlike __getitem__) and accepts
sequence types including tuples. This eliminates the need to convert tuples
to lists when subsetting variables and provides better type stability for
downstream code.

Unlike using __getitem__ with a list, an explicit method is more
discoverable through IDE autocomplete and documentation.

Co-authored-by: Claude <noreply@anthropic.com>
@keewis

keewis commented Nov 22, 2025

Copy link
Copy Markdown
Collaborator

cc @eni-awowale

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.

Add public API for Dataset._copy_listed

2 participants