Skip to content

Conversation

@mwouts
Copy link
Owner

@mwouts mwouts commented May 31, 2025

Fix #393

@github-actions
Copy link

Thank you for making this pull request.

Did you know? You can try it on Binder: Binder:lab.

Also, the version of ITables developed in this PR can be installed with pip:

pip install git+https://github.com/mwouts/itables.git@fix_index_pandas_style

(this requires nodejs, see more at Developing ITables)

@mwouts mwouts requested a review from Copilot May 31, 2025 16:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR ensures that non-trivial Pandas Styler indexes are rendered in the output, addressing issue #393.

  • Added _is_index_trivial helper and refactored showIndex="auto" logic to use it
  • Introduced tests for including/excluding trivial and non-trivial indexes in Styler output
  • Updated changelog to document the new behavior

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
tests/test_javascript.py Added tests for non-trivial and trivial index rendering logic
src/itables/javascript.py Introduced _is_index_trivial and updated showIndex handling
docs/changelog.md Added changelog entry for rendering non-trivial Styler indexes
Comments suppressed due to low confidence (2)

tests/test_javascript.py:182

  • [nitpick] The test name suggests trivial indexes are included, but the docstring says they should not be. Consider renaming to test_trivial_index_not_included_in_pd_styler for clarity.
def test_trivial_index_is_included_in_pd_styler(showIndex):

src/itables/javascript.py:349

  • [nitpick] The name _is_index_trivial returns true for non-trivial indexes (index name set or non-RangeIndex). Consider renaming it to _is_index_non_trivial or similar to match its behavior.
def _is_index_trivial(df) -> bool:

)


def _is_index_trivial(df) -> bool:
Copy link

Copilot AI May 31, 2025

Choose a reason for hiding this comment

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

Add a docstring explaining what constitutes a 'trivial' vs. 'non-trivial' index so users and maintainers understand the helper's criteria.

Copilot uses AI. Check for mistakes.
@mwouts mwouts force-pushed the fix_index_pandas_style branch from f809b24 to 8ccf92f Compare May 31, 2025 17:26
@codecov-commenter
Copy link

codecov-commenter commented May 31, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.39%. Comparing base (78944b0) to head (2647f15).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #399      +/-   ##
==========================================
+ Coverage   89.27%   89.39%   +0.12%     
==========================================
  Files          44       44              
  Lines        1836     1858      +22     
==========================================
+ Hits         1639     1661      +22     
  Misses        197      197              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mwouts mwouts force-pushed the fix_index_pandas_style branch from 8ccf92f to 2647f15 Compare May 31, 2025 17:32
@mwouts mwouts merged commit 2033377 into main May 31, 2025
15 checks passed
@mwouts mwouts deleted the fix_index_pandas_style branch May 31, 2025 20:59
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.

The index is not visible when rendering Pandas Styler objects with ITables v2.4.0

3 participants