Skip to content

feat: Add filtering option by create_time to the Experiment class #5299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

suk1yak1
Copy link

@suk1yak1 suk1yak1 commented May 7, 2025

Fixes #5298 🦕

Summary

This PR enhances the Experiment.get_data_frame method by adding date filtering capabilities. Users can now filter experiment runs by creation time using either string dates or Python's native datetime objects.

Changes

  • Added create_time_start_date and create_time_end_date parameters to Experiment.get_data_frame and _ExperimentTracker.get_experiment_df method
  • Enhanced _make_filter_string utility to support date filtering
  • Added _convert_to_rfc3339 helper function to convert various date formats to RFC-3339 format required by the API
  • Updated documentation and type hints

Benefits

  • Enables users to easily filter experiment runs by creation date range
  • Supports multiple input formats:
    • String dates ('YYYY-MM-DD')
    • RFC-3339 format strings
    • datetime.datetime objects
    • datetime.date objects
  • Improves user experience by handling date format conversion automatically

Usage Example

import datetime

# Filter by string dates
df = experiment.get_data_frame(
    create_time_start_date="2023-01-01",
    create_time_end_date="2023-12-31"
)

# Filter using Python datetime objects
start_date = datetime.datetime(2023, 1, 1)
end_date = datetime.datetime(2023, 12, 31, 23, 59, 59)
df = experiment.get_data_frame(
    create_time_start_date=start_date,
    create_time_end_date=end_date
)

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels May 7, 2025
@suk1yak1 suk1yak1 changed the title feat: Add filtering option by create_date to the Experiment class feat: Add filtering option by create_time to the Experiment class May 7, 2025
@jaycee-li jaycee-li added do not merge Indicates a pull request not ready for merge, due to either quality or timing. and removed do not merge Indicates a pull request not ready for merge, due to either quality or timing. labels May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API. size: m Pull request size is medium.
Projects
None yet
2 participants