-
Notifications
You must be signed in to change notification settings - Fork 63
feat: Display custom single index column in anywidget mode #2311
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
28c1645
feat: Display index column in anywidget mode
shuoweil ef97cc2
Merge branch 'main' into shuowei-anywidget-single-index
shuoweil 2e41e54
force index display
shuoweil f88e263
Merge branch 'main' into shuowei-anywidget-single-index
shuoweil bd19bf3
rerun notebook to check for features
shuoweil a5bd541
Merge branch 'main' into shuowei-anywidget-single-index
shuoweil 0591d7a
add a check for index display
shuoweil 5a3bf9a
display the real index values, even if the index has no name
shuoweil 3b42978
Merge branch 'main' into shuowei-anywidget-single-index
shuoweil e654974
bug id fix
shuoweil File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -245,7 +245,7 @@ def _cached_data(self) -> pd.DataFrame: | |||||||||||||
| """Combine all cached batches into a single DataFrame.""" | ||||||||||||||
| if not self._cached_batches: | ||||||||||||||
| return pd.DataFrame(columns=self._dataframe.columns) | ||||||||||||||
| return pd.concat(self._cached_batches, ignore_index=True) | ||||||||||||||
| return pd.concat(self._cached_batches) | ||||||||||||||
|
|
||||||||||||||
| def _reset_batch_cache(self) -> None: | ||||||||||||||
| """Resets batch caching attributes.""" | ||||||||||||||
|
|
@@ -294,7 +294,15 @@ def _set_table_html(self) -> None: | |||||||||||||
| break | ||||||||||||||
|
|
||||||||||||||
| # Get the data for the current page | ||||||||||||||
| page_data = cached_data.iloc[start:end] | ||||||||||||||
| page_data = cached_data.iloc[start:end].copy() | ||||||||||||||
|
|
||||||||||||||
| # Handle index display | ||||||||||||||
| if self._dataframe._block.has_index and page_data.index.name is not None: | ||||||||||||||
| # Custom named index - include it with its actual name | ||||||||||||||
| page_data.insert(0, page_data.index.name, page_data.index) | ||||||||||||||
|
||||||||||||||
| if self._dataframe._block.has_index and page_data.index.name is not None: | |
| # Custom named index - include it with its actual name | |
| page_data.insert(0, page_data.index.name, page_data.index) | |
| if self._dataframe._block.has_index: | |
| index_name = page_data.index.name | |
| page_data.insert(0, index_name if index_name is not None else "", page_data.index) |
Contributor
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testcase is updated accordingly
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.