Skip to content

Conversation

@shuoweil
Copy link
Contributor

This update brings multi-column sorting capabilities to the interactive DataFrame display (anywidget mode), allowing for more powerful data exploration directly within our notebook.

What's New:

  • Multi-Column Sorting: You can now sort your data by multiple columns simultaneously to organize it exactly how you need (e.g., sort by "State" first, then by "Year").
  • Simple Controls: Just hold the Shift key while clicking additional column headers to add them to your sort order.
  • Clear Visuals: Sorting indicators (▲/▼) are now displayed for all active sort columns, not just the most recent one.

How to use:

  1. Click a column header to set the primary sort.
  2. Hold Shift and click another column header to add it as a secondary sort.
  3. Continue clicking to toggle each column between Ascending, Descending, and Unsorted states.

Fixes #<459835971> 🦕

shuoweil and others added 30 commits December 19, 2025 02:21
…t _literal (#2337)

This change can resolve two doctests failures in #2248:
`groupby.GroupBy.rank` and `bigframes.ml.metrics.roc_curve`

Fixes internal issue 417774347🦕

---------

Co-authored-by: Shenyang Cai <[email protected]>
- Replaced RLock with Lock in TableWidget for a stricter threading model.
- Refactored _set_table_html to defer state updates (specifically self.page) until the lock is released.
- This ensures that when a page update triggers an observer, the subsequent re-entry into _set_table_html is not nested within the original lock's scope, avoiding deadlocks.
- Added a targeted unit test to verify that navigating to an invalid page correctly resets to a valid page without deadlocking.
- Added a mock fallback for 'traitlets' in bigframes/display/anywidget.py to avoid NameError during class definition when the package is not installed.
- Moved 'pytest.importorskip' calls in tests/unit/display/test_anywidget.py to the top to ensure tests are skipped before attempting any imports from the module under test.
- Added noqa: E402 to suppress flake8 warnings for imports after importorskip.
…cies missing

- Reverted changes to bigframes/display/anywidget.py to keep source code clean (no mock injection).
- Refactored tests/unit/display/test_anywidget.py to avoid top-level import of bigframes.display.anywidget.
- Imported TableWidget inside the test method, ensuring pytest.importorskip runs first and skips the test file if dependencies are missing, preventing the NameError crash.
- Refactored test_navigation_to_invalid_page_resets_to_valid_page_without_deadlock to follow established project conventions.
- Use internal import from bigframes.display.anywidget.
- Employ bigframes.option_context for setting widget state.
- Improved docstring to follow behavior-driven (Given/When/Then) style.
# Conflicts:
#	bigframes/display/html.py
Updates the TableWidget to support sorting by multiple columns.
- Python: Changes sort_column/sort_ascending traits to lists.
- JS: Adds Shift+Click support for multi-column sorting.
- JS: Displays sort indicators for all sorted columns.
- Tests: Adds unit tests for multi-column sorting logic.
@shuoweil shuoweil self-assigned this Dec 30, 2025
@shuoweil shuoweil requested review from a team as code owners December 30, 2025 00:49
@shuoweil shuoweil requested a review from GarrettWu December 30, 2025 00:49
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@product-auto-label product-auto-label bot added size: l Pull request size is large. api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. labels Dec 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigquery Issues related to the googleapis/python-bigquery-dataframes API. size: l Pull request size is large.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants