Skip to content

Update query_by_values instance_vals handling#2774

Open
EltonChang1 wants to merge 1 commit into
alteryx:mainfrom
EltonChang1:cursor/data-ai-contribution-1cc4
Open

Update query_by_values instance_vals handling#2774
EltonChang1 wants to merge 1 commit into
alteryx:mainfrom
EltonChang1:cursor/data-ai-contribution-1cc4

Conversation

@EltonChang1

Copy link
Copy Markdown

Summary

Restricts EntitySet.query_by_values to accept None, pd.Series, or iterable instance values. Scalar, string, and DataFrame inputs now raise a clear TypeError.

Motivation

Featuretools only calls query_by_values with a pd.Series during normal operation. Removing support for unused input types simplifies the codebase and test suite.

Changes

  • Updated _vals_to_series() to reject str, pd.DataFrame, and scalar inputs
  • Updated docstring for instance_vals parameter
  • Added tests for pd.Series support and rejection of invalid types
  • Removed obsolete scalar/DataFrame success tests

Testing

pytest featuretools/tests/entityset_tests/test_es.py -k "query_by"

All 12 related tests pass.

Fixes #1272

Restrict EntitySet.query_by_values to accept None, pd.Series, or
iterable instance values. Reject scalar, string, and DataFrame inputs
with clear TypeError messages, and update tests accordingly.

Fixes alteryx#1272
Copilot AI review requested due to automatic review settings July 1, 2026 00:19
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request tightens the accepted input types for EntitySet.query_by_values(..., instance_vals=...), narrowing support to None, pd.Series, or general iterables, and adding explicit TypeErrors for scalars, strings, and pd.DataFrame inputs to simplify the API surface and tests.

Changes:

  • Updated query_by_values docstring and _vals_to_series() validation/conversion logic to reject str, pd.DataFrame, and non-iterable scalars.
  • Updated/added unit tests to validate pd.Series support and verify invalid inputs raise TypeError.
  • Removed prior “scalar/DataFrame succeeds” test expectations.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
featuretools/entityset/entityset.py Updates instance_vals documentation and enforces stricter type handling in _vals_to_series used by query_by_values.
featuretools/tests/entityset_tests/test_es.py Adjusts tests to cover the new accepted/rejected instance_vals types.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1473 to +1475
instance_vals (None, pd.Series, or iterable) :
Instance(s) to match. Values must be provided as a
``pd.Series`` or an iterable of instance values.
Comment on lines +1685 to +1686
instance_vals may be None, a pd.Series, or an iterable of values.
This function always returns a Series or None.
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.

Update allowed types for instance_vals in query_by_values

4 participants