From 28c1645dda603ab1d2f1fc24f90020b5cc6c1804 Mon Sep 17 00:00:00 2001 From: Shuowei Li Date: Thu, 4 Dec 2025 07:34:05 +0000 Subject: [PATCH 1/6] feat: Display index column in anywidget mode --- bigframes/display/anywidget.py | 15 ++- notebooks/dataframes/anywidget_mode.ipynb | 136 ++++++++++++---------- tests/system/small/test_anywidget.py | 133 ++++++++++++++++++++- 3 files changed, 221 insertions(+), 63 deletions(-) diff --git a/bigframes/display/anywidget.py b/bigframes/display/anywidget.py index 2c93e437fa..aed0a6e2f9 100644 --- a/bigframes/display/anywidget.py +++ b/bigframes/display/anywidget.py @@ -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,18 @@ 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 hasattr(self._dataframe, "_has_index") and not self._dataframe._has_index: + # No index to display + pass + elif 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) + else: + # Default index - include as "Row" column + page_data.insert(0, "Row", range(start + 1, start + len(page_data) + 1)) # Handle case where user navigated beyond available data with unknown row count is_unknown_count = self.row_count is None diff --git a/notebooks/dataframes/anywidget_mode.ipynb b/notebooks/dataframes/anywidget_mode.ipynb index 427a1e5371..6143ea10a3 100644 --- a/notebooks/dataframes/anywidget_mode.ipynb +++ b/notebooks/dataframes/anywidget_mode.ipynb @@ -106,17 +106,17 @@ "name": "stdout", "output_type": "stream", "text": [ - "state gender year name number\n", - " AL F 1910 Vera 71\n", - " AR F 1910 Viola 37\n", - " AR F 1910 Alice 57\n", - " AR F 1910 Edna 95\n", - " AR F 1910 Ollie 40\n", - " CA F 1910 Beatrice 37\n", - " CT F 1910 Marion 36\n", - " CT F 1910 Marie 36\n", - " FL F 1910 Alice 53\n", - " GA F 1910 Thelma 133\n", + "state gender year name number\n", + " AL F 1910 Cora 61\n", + " AL F 1910 Anna 74\n", + " AR F 1910 Willie 132\n", + " CO F 1910 Anna 42\n", + " FL F 1910 Louise 70\n", + " GA F 1910 Catherine 57\n", + " IL F 1910 Jessie 43\n", + " IN F 1910 Anna 100\n", + " IN F 1910 Pauline 77\n", + " IN F 1910 Beulah 39\n", "...\n", "\n", "[5552452 rows x 5 columns]\n" @@ -196,12 +196,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "2aad385a8a2f411c822dafe7b07fbad8", + "model_id": "41c9e91763d14c30a2a73bf1b1500add", "version_major": 2, "version_minor": 1 }, "text/html": [ - "\n", + "
\n", " \n", " \n", " \n", @@ -223,10 +223,10 @@ " 1910\n", " \n", " \n", " \n", " \n", " \n", @@ -240,15 +240,15 @@ " 1910\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
state
\n", - " Cora\n", + " Lillian\n", " \n", - " 61\n", + " 99\n", "
\n", - " Anna\n", + " Ruby\n", " \n", - " 74\n", + " 204\n", "
\n", - " AR\n", + " AL\n", " \n", " F\n", @@ -257,15 +257,15 @@ " 1910\n", " \n", - " Willie\n", + " Helen\n", " \n", - " 132\n", + " 76\n", "
\n", - " CO\n", + " AL\n", " \n", " F\n", @@ -274,15 +274,15 @@ " 1910\n", " \n", - " Anna\n", + " Eunice\n", " \n", - " 42\n", + " 41\n", "
\n", - " FL\n", + " AR\n", " \n", " F\n", @@ -291,15 +291,15 @@ " 1910\n", " \n", - " Louise\n", + " Dora\n", " \n", - " 70\n", + " 42\n", "
\n", - " GA\n", + " CA\n", " \n", " F\n", @@ -308,15 +308,15 @@ " 1910\n", " \n", - " Catherine\n", + " Edna\n", " \n", - " 57\n", + " 62\n", "
\n", - " IL\n", + " CA\n", " \n", " F\n", @@ -325,15 +325,15 @@ " 1910\n", " \n", - " Jessie\n", + " Helen\n", " \n", - " 43\n", + " 239\n", "
\n", - " IN\n", + " CO\n", " \n", " F\n", @@ -342,15 +342,15 @@ " 1910\n", " \n", - " Anna\n", + " Alice\n", " \n", - " 100\n", + " 46\n", "
\n", - " IN\n", + " FL\n", " \n", " F\n", @@ -359,15 +359,15 @@ " 1910\n", " \n", - " Pauline\n", + " Willie\n", " \n", - " 77\n", + " 71\n", "
\n", - " IN\n", + " FL\n", " \n", " F\n", @@ -376,27 +376,27 @@ " 1910\n", " \n", - " Beulah\n", + " Thelma\n", " \n", - " 39\n", + " 65\n", "
" ], "text/plain": [ - "state gender year name number\n", - " AL F 1910 Cora 61\n", - " AL F 1910 Anna 74\n", - " AR F 1910 Willie 132\n", - " CO F 1910 Anna 42\n", - " FL F 1910 Louise 70\n", - " GA F 1910 Catherine 57\n", - " IL F 1910 Jessie 43\n", - " IN F 1910 Anna 100\n", - " IN F 1910 Pauline 77\n", - " IN F 1910 Beulah 39\n", + "state gender year name number\n", + " AL F 1910 Lillian 99\n", + " AL F 1910 Ruby 204\n", + " AL F 1910 Helen 76\n", + " AL F 1910 Eunice 41\n", + " AR F 1910 Dora 42\n", + " CA F 1910 Edna 62\n", + " CA F 1910 Helen 239\n", + " CO F 1910 Alice 46\n", + " FL F 1910 Willie 71\n", + " FL F 1910 Thelma 65\n", "...\n", "\n", "[5552452 rows x 5 columns]" @@ -482,12 +482,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "0c0b83e7e3c048ff8abb525e1bfd6c5f", + "model_id": "039d18f918004fa1b064832723aecfb8", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "TableWidget(orderable_columns=['state', 'gender', 'year', 'name', 'number'], page_size=10, row_count=5552452, …" + "" ] }, "execution_count": 7, @@ -596,12 +596,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "6a60e5dd37c64e76a8e3804dd3531f70", + "model_id": "938f008b96e946678469b92ce85db809", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "TableWidget(orderable_columns=['state', 'gender', 'year', 'name', 'number'], page_size=10, row_count=5, table_…" + "" ] }, "execution_count": 9, @@ -636,7 +636,7 @@ "data": { "text/html": [ "✅ Completed. \n", - " Query processed 85.9 kB in 14 seconds of slot time.\n", + " Query processed 85.9 kB in 20 seconds of slot time.\n", " " ], "text/plain": [ @@ -693,14 +693,15 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "893065f8a0164648b241f2cc3d1a9271", + "model_id": "c258523f7d07452d82367b7fcc0f4e79", "version_major": 2, "version_minor": 1 }, "text/html": [ - "\n", + "
\n", " \n", " \n", + " \n", " \n", " \n", " \n", @@ -720,6 +721,9 @@ " \n", " \n", " \n", + " \n", " \n", @@ -767,6 +771,9 @@ " \n", " \n", " \n", + " \n", " \n", @@ -814,6 +821,9 @@ " \n", " \n", " \n", + " \n", " \n", @@ -861,6 +871,9 @@ " \n", " \n", " \n", + " \n", " \n", @@ -908,6 +921,9 @@ " \n", " \n", " \n", + " \n", " \n", @@ -1038,7 +1054,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.15" + "version": "3.11.10" } }, "nbformat": 4, diff --git a/tests/system/small/test_anywidget.py b/tests/system/small/test_anywidget.py index c8740ed220..b7524e1c80 100644 --- a/tests/system/small/test_anywidget.py +++ b/tests/system/small/test_anywidget.py @@ -930,6 +930,137 @@ def test_repr_in_anywidget_mode_should_not_be_deferred( assert "page_1_row_1" in representation -# TODO(b/332316283): Add tests for custom index and multiindex +@pytest.fixture(scope="module") +def custom_index_pandas_df() -> pd.DataFrame: + """Create a DataFrame with a custom named index for testing.""" + test_data = pd.DataFrame( + { + "value_a": [10, 20, 30, 40, 50, 60], + "value_b": ["a", "b", "c", "d", "e", "f"], + } + ) + test_data.index = pd.Index( + ["row_1", "row_2", "row_3", "row_4", "row_5", "row_6"], name="custom_idx" + ) + return test_data + + +@pytest.fixture(scope="module") +def custom_index_bf_df( + session: bf.Session, custom_index_pandas_df: pd.DataFrame +) -> bf.dataframe.DataFrame: + return session.read_pandas(custom_index_pandas_df) + + +@pytest.fixture(scope="module") +def multiindex_pandas_df() -> pd.DataFrame: + """Create a DataFrame with MultiIndex for testing.""" + test_data = pd.DataFrame( + { + "value": [100, 200, 300, 400, 500, 600], + "category": ["X", "Y", "Z", "X", "Y", "Z"], + } + ) + test_data.index = pd.MultiIndex.from_arrays( + [ + ["group_A", "group_A", "group_A", "group_B", "group_B", "group_B"], + [1, 2, 3, 1, 2, 3], + ], + names=["group", "item"], + ) + return test_data + + +@pytest.fixture(scope="module") +def multiindex_bf_df( + session: bf.Session, multiindex_pandas_df: pd.DataFrame +) -> bf.dataframe.DataFrame: + return session.read_pandas(multiindex_pandas_df) + + +def test_widget_with_default_index_should_display_row_column( + paginated_bf_df: bf.dataframe.DataFrame, +): + """ + Given a DataFrame with a default index, when rendered, + then a "Row" index column should be visible. + """ + from bigframes.display.anywidget import TableWidget + + with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 2): + widget = TableWidget(paginated_bf_df) + html = widget.table_html + + # The header for the index should now be "Row". + thead = html.split("")[1].split("")[0] + assert "Row" in thead + + # The body rows should contain one header cell (`")[1].split("")[0] + first_row = tbody.split("")[1].split("")[0] + assert " Date: Thu, 4 Dec 2025 21:14:29 +0000 Subject: [PATCH 2/6] force index display --- bigframes/display/anywidget.py | 5 +- notebooks/dataframes/anywidget_mode.ipynb | 271 ++++++++++++---------- 2 files changed, 152 insertions(+), 124 deletions(-) diff --git a/bigframes/display/anywidget.py b/bigframes/display/anywidget.py index aed0a6e2f9..7571adb372 100644 --- a/bigframes/display/anywidget.py +++ b/bigframes/display/anywidget.py @@ -297,10 +297,7 @@ def _set_table_html(self) -> None: page_data = cached_data.iloc[start:end].copy() # Handle index display - if hasattr(self._dataframe, "_has_index") and not self._dataframe._has_index: - # No index to display - pass - elif page_data.index.name is not None: + if 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) else: diff --git a/notebooks/dataframes/anywidget_mode.ipynb b/notebooks/dataframes/anywidget_mode.ipynb index 6143ea10a3..98602d6b6e 100644 --- a/notebooks/dataframes/anywidget_mode.ipynb +++ b/notebooks/dataframes/anywidget_mode.ipynb @@ -196,14 +196,15 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "41c9e91763d14c30a2a73bf1b1500add", + "model_id": "d093a589c41e47fda50af7a96f2cc779", "version_major": 2, "version_minor": 1 }, "text/html": [ - "
Row
result
gcs_path
issuer
\n", + " 1\n", + " \n", " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", "
\n", + " 2\n", + " \n", " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", "
\n", + " 3\n", + " \n", " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", "
\n", + " 4\n", + " \n", " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", "
\n", + " 5\n", + " \n", " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", "
`) for the "Row" index. + tbody = html.split("
\n", + "
\n", " \n", " \n", + " \n", " \n", " \n", " \n", @@ -213,6 +214,9 @@ " \n", " \n", " \n", + " \n", " \n", @@ -223,13 +227,16 @@ " 1910\n", " \n", " \n", " \n", " \n", " \n", + " \n", " \n", @@ -240,15 +247,18 @@ " 1910\n", " \n", " \n", " \n", " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Row
state
gender
year
\n", + " 1\n", + " \n", " AL\n", " \n", - " Lillian\n", + " Cora\n", " \n", - " 99\n", + " 61\n", "
\n", + " 2\n", + " \n", " AL\n", " \n", - " Ruby\n", + " Anna\n", " \n", - " 204\n", + " 74\n", "
\n", + " 3\n", + " \n", - " AL\n", + " AR\n", " \n", " F\n", @@ -257,15 +267,18 @@ " 1910\n", " \n", - " Helen\n", + " Willie\n", " \n", - " 76\n", + " 132\n", "
\n", + " 4\n", + " \n", - " AL\n", + " CO\n", " \n", " F\n", @@ -274,15 +287,18 @@ " 1910\n", " \n", - " Eunice\n", + " Anna\n", " \n", - " 41\n", + " 42\n", "
\n", + " 5\n", + " \n", - " AR\n", + " FL\n", " \n", " F\n", @@ -291,15 +307,18 @@ " 1910\n", " \n", - " Dora\n", + " Louise\n", " \n", - " 42\n", + " 70\n", "
\n", + " 6\n", + " \n", - " CA\n", + " GA\n", " \n", " F\n", @@ -308,15 +327,18 @@ " 1910\n", " \n", - " Edna\n", + " Catherine\n", " \n", - " 62\n", + " 57\n", "
\n", + " 7\n", + " \n", - " CA\n", + " IL\n", " \n", " F\n", @@ -325,15 +347,18 @@ " 1910\n", " \n", - " Helen\n", + " Jessie\n", " \n", - " 239\n", + " 43\n", "
\n", + " 8\n", + " \n", - " CO\n", + " IN\n", " \n", " F\n", @@ -342,15 +367,18 @@ " 1910\n", " \n", - " Alice\n", + " Anna\n", " \n", - " 46\n", + " 100\n", "
\n", + " 9\n", + " \n", - " FL\n", + " IN\n", " \n", " F\n", @@ -359,15 +387,18 @@ " 1910\n", " \n", - " Willie\n", + " Pauline\n", " \n", - " 71\n", + " 77\n", "
\n", + " 10\n", + " \n", - " FL\n", + " IN\n", " \n", " F\n", @@ -376,27 +407,27 @@ " 1910\n", " \n", - " Thelma\n", + " Beulah\n", " \n", - " 65\n", + " 39\n", "
" ], "text/plain": [ - "state gender year name number\n", - " AL F 1910 Lillian 99\n", - " AL F 1910 Ruby 204\n", - " AL F 1910 Helen 76\n", - " AL F 1910 Eunice 41\n", - " AR F 1910 Dora 42\n", - " CA F 1910 Edna 62\n", - " CA F 1910 Helen 239\n", - " CO F 1910 Alice 46\n", - " FL F 1910 Willie 71\n", - " FL F 1910 Thelma 65\n", + "state gender year name number\n", + " AL F 1910 Cora 61\n", + " AL F 1910 Anna 74\n", + " AR F 1910 Willie 132\n", + " CO F 1910 Anna 42\n", + " FL F 1910 Louise 70\n", + " GA F 1910 Catherine 57\n", + " IL F 1910 Jessie 43\n", + " IN F 1910 Anna 100\n", + " IN F 1910 Pauline 77\n", + " IN F 1910 Beulah 39\n", "...\n", "\n", "[5552452 rows x 5 columns]" @@ -482,12 +513,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "039d18f918004fa1b064832723aecfb8", + "model_id": "abc3dd26cbb54d9990a988254a94866b", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "" + "" ] }, "execution_count": 7, @@ -596,12 +627,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "938f008b96e946678469b92ce85db809", + "model_id": "cf66a96a753e47a1b8cd323f0f089656", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "" + "" ] }, "execution_count": 9, @@ -636,7 +667,7 @@ "data": { "text/html": [ "✅ Completed. \n", - " Query processed 85.9 kB in 20 seconds of slot time.\n", + " Query processed 85.9 kB in 2 seconds of slot time.\n", " " ], "text/plain": [ @@ -693,12 +724,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "c258523f7d07452d82367b7fcc0f4e79", + "model_id": "f034ed4299c842f59904e6055cde7378", "version_major": 2, "version_minor": 1 }, "text/html": [ - "\n", + "
\n", " \n", " \n", " \n", @@ -728,7 +759,7 @@ " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", @@ -778,7 +809,7 @@ " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", @@ -828,7 +859,7 @@ " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", @@ -878,7 +909,7 @@ " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", @@ -928,7 +959,7 @@ " {'application_number': None, 'class_international': None, 'filing_date': None, 'publication_date': None, 'full_response': '{}', 'status': 'INVALID_ARGUMENT: Invalid field in objectref details, only a JSON object named gcs_metadata is allowed [type.googleapis.com/util.MessageSetPayload=\\'[dremel.DremelErrorWithDetails] { argument_error { query_error { } } debug_info { error_message_template: "Invalid field in objectref details, only a JSON object named $0 is allowed" error_id: 3270173750 } }\\']'}\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", @@ -989,32 +1020,32 @@ "4 gs://gcs-public-data--labeled-patents/espacene... EU DE \n", "\n", " publication_date class_international class_us application_number \\\n", - "0 03.10.2018 H05B 6/12 18165514.3 \n", - "1 29.08.018 E04H 6/12 18157874.1 \n", - "2 03.10.2018 H01L 21/20 18166536.5 \n", - "3 03.10.2018 G06F 11/30 18157347.8 \n", - "4 03.10.2018 A01K 31/00 18171005.4 \n", + "0 29.08.018 E04H 6/12 18157874.1 \n", + "1 03.10.2018 H05B 6/12 18165514.3 \n", + "2 03.10.2018 A01K 31/00 18171005.4 \n", + "3 03.10.2018 H01L 21/20 18166536.5 \n", + "4 03.10.2018 G06F 11/30 18157347.8 \n", "\n", " filing_date priority_date_eu representative_line_1_eu \\\n", - "0 03.04.2018 30.03.2017 \n", - "1 21.02.2018 22.02.2017 Liedtke & Partner Patentanwälte \n", - "2 16.02.2016 Scheider, Sascha et al \n", - "3 19.02.2018 31.03.2017 Hoffmann Eitle \n", - "4 05.02.2015 05.02.2014 Stork Bamberger Patentanwälte \n", + "0 21.02.2018 22.02.2017 Liedtke & Partner Patentanwälte \n", + "1 03.04.2018 30.03.2017 \n", + "2 05.02.2015 05.02.2014 Stork Bamberger Patentanwälte \n", + "3 16.02.2016 Scheider, Sascha et al \n", + "4 19.02.2018 31.03.2017 Hoffmann Eitle \n", "\n", " applicant_line_1 inventor_line_1 \\\n", - "0 BSH Hausgeräte GmbH Acero Acero, Jesus \n", - "1 SHB Hebezeugbau GmbH VOLGER, Alexander \n", - "2 EV Group E. Thallner GmbH Kurz, Florian \n", - "3 FUJITSU LIMITED Kukihara, Kensuke \n", - "4 Linco Food Systems A/S Thrane, Uffe \n", + "0 SHB Hebezeugbau GmbH VOLGER, Alexander \n", + "1 BSH Hausgeräte GmbH Acero Acero, Jesus \n", + "2 Linco Food Systems A/S Thrane, Uffe \n", + "3 EV Group E. Thallner GmbH Kurz, Florian \n", + "4 FUJITSU LIMITED Kukihara, Kensuke \n", "\n", " title_line_1 number \n", - "0 VORRICHTUNG ZUR INDUKTIVEN ENERGIEÜBERTRAGUNG EP 3 383 141 A2 \n", - "1 STEUERUNGSSYSTEM FÜR AUTOMATISCHE PARKHÄUSER EP 3 366 869 A1 \n", - "2 VORRICHTUNG ZUM BONDEN VON SUBSTRATEN EP 3 382 744 A1 \n", - "3 METHOD EXECUTED BY A COMPUTER, INFORMATION PRO... EP 3 382 553 A1 \n", - "4 MASTHÄHNCHENCONTAINER ALS BESTANDTEIL EINER E... EP 3 381 276 A1 \n", + "0 STEUERUNGSSYSTEM FÜR AUTOMATISCHE PARKHÄUSER EP 3 366 869 A1 \n", + "1 VORRICHTUNG ZUR INDUKTIVEN ENERGIEÜBERTRAGUNG EP 3 383 141 A2 \n", + "2 MASTHÄHNCHENCONTAINER ALS BESTANDTEIL EINER E... EP 3 381 276 A1 \n", + "3 VORRICHTUNG ZUM BONDEN VON SUBSTRATEN EP 3 382 744 A1 \n", + "4 METHOD EXECUTED BY A COMPUTER, INFORMATION PRO... EP 3 382 553 A1 \n", "\n", "[5 rows x 15 columns]" ] From bd19bf3e01c006689828a0aa1e6337c8b717bf45 Mon Sep 17 00:00:00 2001 From: Shuowei Li Date: Fri, 12 Dec 2025 18:40:34 +0000 Subject: [PATCH 3/6] rerun notebook to check for features --- notebooks/dataframes/anywidget_mode.ipynb | 222 +++++++++++----------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/notebooks/dataframes/anywidget_mode.ipynb b/notebooks/dataframes/anywidget_mode.ipynb index b0d908fc17..314a9cd5e8 100644 --- a/notebooks/dataframes/anywidget_mode.ipynb +++ b/notebooks/dataframes/anywidget_mode.ipynb @@ -107,16 +107,16 @@ "output_type": "stream", "text": [ "state gender year name number\n", - " AL F 1910 Annie 482\n", - " AL F 1910 Myrtle 104\n", - " AR F 1910 Lillian 56\n", - " CT F 1910 Anne 38\n", - " CT F 1910 Frances 45\n", - " FL F 1910 Margaret 53\n", - " GA F 1910 Mae 73\n", - " GA F 1910 Beatrice 96\n", - " GA F 1910 Lola 47\n", - " IA F 1910 Viola 49\n", + " AL F 1910 Sadie 40\n", + " AL F 1910 Mary 875\n", + " AR F 1910 Vera 39\n", + " AR F 1910 Marie 78\n", + " AR F 1910 Lucille 66\n", + " CA F 1910 Virginia 101\n", + " DC F 1910 Margaret 72\n", + " GA F 1910 Mildred 133\n", + " GA F 1910 Vera 51\n", + " GA F 1910 Sallie 92\n", "...\n", "\n", "[5552452 rows x 5 columns]\n" @@ -196,7 +196,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "e2231d99614a4489b2930c24b30f1d34", + "model_id": "0b33d569070e4e04b26366b554f9f7ca", "version_major": 2, "version_minor": 1 }, @@ -232,23 +232,23 @@ " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", " \n", @@ -256,56 +256,56 @@ " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", " \n", - " \n", + " \n", " \n", " \n", - " \n", - " \n", + " \n", + " \n", " \n", " \n", "
Row
\n", - " gs://gcs-public-data--labeled-patents/espacenet_de73.pdf\n", + " gs://gcs-public-data--labeled-patents/espacenet_de2.pdf\n", " \n", " EU\n", @@ -737,37 +768,37 @@ " DE\n", " \n", - " 03.10.2018\n", + " 29.08.018\n", " \n", - " H05B 6/12\n", + " E04H 6/12\n", " \n", " <NA>\n", " \n", - " 18165514.3\n", + " 18157874.1\n", " \n", - " 03.04.2018\n", + " 21.02.2018\n", " \n", - " 30.03.2017\n", + " 22.02.2017\n", " \n", - " <NA>\n", + " Liedtke & Partner Patentanwälte\n", " \n", - " BSH Hausgeräte GmbH\n", + " SHB Hebezeugbau GmbH\n", " \n", - " Acero Acero, Jesus\n", + " VOLGER, Alexander\n", " \n", - " VORRICHTUNG ZUR INDUKTIVEN ENERGIEÜBERTRAGUNG\n", + " STEUERUNGSSYSTEM FÜR AUTOMATISCHE PARKHÄUSER\n", " \n", - " EP 3 383 141 A2\n", + " EP 3 366 869 A1\n", "
\n", - " gs://gcs-public-data--labeled-patents/espacenet_de2.pdf\n", + " gs://gcs-public-data--labeled-patents/espacenet_de73.pdf\n", " \n", " EU\n", @@ -787,37 +818,37 @@ " DE\n", " \n", - " 29.08.018\n", + " 03.10.2018\n", " \n", - " E04H 6/12\n", + " H05B 6/12\n", " \n", " <NA>\n", " \n", - " 18157874.1\n", + " 18165514.3\n", " \n", - " 21.02.2018\n", + " 03.04.2018\n", " \n", - " 22.02.2017\n", + " 30.03.2017\n", " \n", - " Liedtke & Partner Patentanwälte\n", + " <NA>\n", " \n", - " SHB Hebezeugbau GmbH\n", + " BSH Hausgeräte GmbH\n", " \n", - " VOLGER, Alexander\n", + " Acero Acero, Jesus\n", " \n", - " STEUERUNGSSYSTEM FÜR AUTOMATISCHE PARKHÄUSER\n", + " VORRICHTUNG ZUR INDUKTIVEN ENERGIEÜBERTRAGUNG\n", " \n", - " EP 3 366 869 A1\n", + " EP 3 383 141 A2\n", "
\n", - " gs://gcs-public-data--labeled-patents/espacenet_de70.pdf\n", + " gs://gcs-public-data--labeled-patents/espacenet_de56.pdf\n", " \n", " EU\n", @@ -840,34 +871,34 @@ " 03.10.2018\n", " \n", - " H01L 21/20\n", + " A01K 31/00\n", " \n", " <NA>\n", " \n", - " 18166536.5\n", + " 18171005.4\n", " \n", - " 16.02.2016\n", + " 05.02.2015\n", " \n", - " <NA>\n", + " 05.02.2014\n", " \n", - " Scheider, Sascha et al\n", + " Stork Bamberger Patentanwälte\n", " \n", - " EV Group E. Thallner GmbH\n", + " Linco Food Systems A/S\n", " \n", - " Kurz, Florian\n", + " Thrane, Uffe\n", " \n", - " VORRICHTUNG ZUM BONDEN VON SUBSTRATEN\n", + " MASTHÄHNCHENCONTAINER ALS BESTANDTEIL EINER EINHEIT UND EINER ANORDNUNG\n", " \n", - " EP 3 382 744 A1\n", + " EP 3 381 276 A1\n", "
\n", - " gs://gcs-public-data--labeled-patents/espacenet_de5.pdf\n", + " gs://gcs-public-data--labeled-patents/espacenet_de70.pdf\n", " \n", " EU\n", @@ -890,34 +921,34 @@ " 03.10.2018\n", " \n", - " G06F 11/30\n", + " H01L 21/20\n", " \n", " <NA>\n", " \n", - " 18157347.8\n", + " 18166536.5\n", " \n", - " 19.02.2018\n", + " 16.02.2016\n", " \n", - " 31.03.2017\n", + " <NA>\n", " \n", - " Hoffmann Eitle\n", + " Scheider, Sascha et al\n", " \n", - " FUJITSU LIMITED\n", + " EV Group E. Thallner GmbH\n", " \n", - " Kukihara, Kensuke\n", + " Kurz, Florian\n", " \n", - " METHOD EXECUTED BY A COMPUTER, INFORMATION PROCESSING APPARATUS AND\n", + " VORRICHTUNG ZUM BONDEN VON SUBSTRATEN\n", " \n", - " EP 3 382 553 A1\n", + " EP 3 382 744 A1\n", "
\n", - " gs://gcs-public-data--labeled-patents/espacenet_de56.pdf\n", + " gs://gcs-public-data--labeled-patents/espacenet_de5.pdf\n", " \n", " EU\n", @@ -940,34 +971,34 @@ " 03.10.2018\n", " \n", - " A01K 31/00\n", + " G06F 11/30\n", " \n", " <NA>\n", " \n", - " 18171005.4\n", + " 18157347.8\n", " \n", - " 05.02.2015\n", + " 19.02.2018\n", " \n", - " 05.02.2014\n", + " 31.03.2017\n", " \n", - " Stork Bamberger Patentanwälte\n", + " Hoffmann Eitle\n", " \n", - " Linco Food Systems A/S\n", + " FUJITSU LIMITED\n", " \n", - " Thrane, Uffe\n", + " Kukihara, Kensuke\n", " \n", - " MASTHÄHNCHENCONTAINER ALS BESTANDTEIL EINER EINHEIT UND EINER ANORDNUNG\n", + " METHOD EXECUTED BY A COMPUTER, INFORMATION PROCESSING APPARATUS AND\n", " \n", - " EP 3 381 276 A1\n", + " EP 3 382 553 A1\n", "
ALF1910Hazel51Sadie40
1ALF1910Lucy76Mary875
2ARF1910NellieVera39
ARF1910Lena40Marie78
4COARF1910Thelma36Lucille66
5COCAF1910Ruth68Virginia101
6CTDCF1910Elizabeth86Margaret72
7DCGAF1910Mary80Mildred133
8FLGAF1910Annie101Vera51
9FLGAF1910Alma39Sallie92
\n", @@ -313,17 +313,17 @@ "[5552452 rows x 5 columns in total]" ], "text/plain": [ - "state gender year name number\n", - " AL F 1910 Hazel 51\n", - " AL F 1910 Lucy 76\n", - " AR F 1910 Nellie 39\n", - " AR F 1910 Lena 40\n", - " CO F 1910 Thelma 36\n", - " CO F 1910 Ruth 68\n", - " CT F 1910 Elizabeth 86\n", - " DC F 1910 Mary 80\n", - " FL F 1910 Annie 101\n", - " FL F 1910 Alma 39\n", + "state gender year name number\n", + " AL F 1910 Sadie 40\n", + " AL F 1910 Mary 875\n", + " AR F 1910 Vera 39\n", + " AR F 1910 Marie 78\n", + " AR F 1910 Lucille 66\n", + " CA F 1910 Virginia 101\n", + " DC F 1910 Margaret 72\n", + " GA F 1910 Mildred 133\n", + " GA F 1910 Vera 51\n", + " GA F 1910 Sallie 92\n", "...\n", "\n", "[5552452 rows x 5 columns]" @@ -409,12 +409,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "f26e26da0c84469fb7a9c211ab4423b7", + "model_id": "5d53673f0d8d47a5b2990d7f638c227a", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "" + "" ] }, "execution_count": 7, @@ -523,12 +523,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "f1a893516ee04a5f9eb2655d5aaca778", + "model_id": "3e766645154d4208b974f0a6dc2d72bf", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "" + "" ] }, "execution_count": 9, @@ -563,7 +563,7 @@ "data": { "text/html": [ "✅ Completed. \n", - " Query processed 85.9 kB in 11 seconds of slot time.\n", + " Query processed 85.9 kB in 13 seconds of slot time.\n", " " ], "text/plain": [ @@ -624,7 +624,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "d48598e7d34a4fd0a817e4995868395e", + "model_id": "076edd86ebb9473eab4dfa2b7deb70f3", "version_major": 2, "version_minor": 1 }, @@ -671,6 +671,42 @@ " gs://gcs-public-data--labeled-patents/espacene...\n", " EU\n", " DE\n", + " 29.08.018\n", + " E04H 6/12\n", + " <NA>\n", + " 18157874.1\n", + " 21.02.2018\n", + " 22.02.2017\n", + " Liedtke & Partner Patentanw√§lte\n", + " SHB Hebezeugbau GmbH\n", + " VOLGER, Alexander\n", + " STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER\n", + " EP 3 366 869 A1\n", + " \n", + " \n", + " 1\n", + " {'application_number': None, 'class_internatio...\n", + " gs://gcs-public-data--labeled-patents/espacene...\n", + " EU\n", + " DE\n", + " 03.10.2018\n", + " H05B 6/12\n", + " <NA>\n", + " 18165514.3\n", + " 03.04.2018\n", + " 30.03.2017\n", + " <NA>\n", + " BSH Hausger√§te GmbH\n", + " Acero Acero, Jesus\n", + " VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG\n", + " EP 3 383 141 A2\n", + " \n", + " \n", + " 2\n", + " {'application_number': None, 'class_internatio...\n", + " gs://gcs-public-data--labeled-patents/espacene...\n", + " EU\n", + " DE\n", " 03.10.2018\n", " H01L 21/20\n", " <NA>\n", @@ -684,7 +720,7 @@ " EP 3 382 744 A1\n", " \n", " \n", - " 1\n", + " 3\n", " {'application_number': None, 'class_internatio...\n", " gs://gcs-public-data--labeled-patents/espacene...\n", " EU\n", @@ -702,7 +738,7 @@ " EP 3 382 553 A1\n", " \n", " \n", - " 2\n", + " 4\n", " {'application_number': None, 'class_internatio...\n", " gs://gcs-public-data--labeled-patents/espacene...\n", " EU\n", @@ -719,42 +755,6 @@ " MASTH√ÑHNCHENCONTAINER ALS BESTANDTEIL EINER E...\n", " EP 3 381 276 A1\n", " \n", - " \n", - " 3\n", - " {'application_number': None, 'class_internatio...\n", - " gs://gcs-public-data--labeled-patents/espacene...\n", - " EU\n", - " DE\n", - " 03.10.2018\n", - " H05B 6/12\n", - " <NA>\n", - " 18165514.3\n", - " 03.04.2018\n", - " 30.03.2017\n", - " <NA>\n", - " BSH Hausger√§te GmbH\n", - " Acero Acero, Jesus\n", - " VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG\n", - " EP 3 383 141 A2\n", - " \n", - " \n", - " 4\n", - " {'application_number': None, 'class_internatio...\n", - " gs://gcs-public-data--labeled-patents/espacene...\n", - " EU\n", - " DE\n", - " 29.08.018\n", - " E04H 6/12\n", - " <NA>\n", - " 18157874.1\n", - " 21.02.2018\n", - " 22.02.2017\n", - " Liedtke & Partner Patentanw√§lte\n", - " SHB Hebezeugbau GmbH\n", - " VOLGER, Alexander\n", - " STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER\n", - " EP 3 366 869 A1\n", - " \n", " \n", "\n", "

5 rows × 15 columns

\n", @@ -776,32 +776,32 @@ "4 gs://gcs-public-data--labeled-patents/espacene... EU DE \n", "\n", " publication_date class_international class_us application_number \\\n", - "0 03.10.2018 H01L 21/20 18166536.5 \n", - "1 03.10.2018 G06F 11/30 18157347.8 \n", - "2 03.10.2018 A01K 31/00 18171005.4 \n", - "3 03.10.2018 H05B 6/12 18165514.3 \n", - "4 29.08.018 E04H 6/12 18157874.1 \n", + "0 29.08.018 E04H 6/12 18157874.1 \n", + "1 03.10.2018 H05B 6/12 18165514.3 \n", + "2 03.10.2018 H01L 21/20 18166536.5 \n", + "3 03.10.2018 G06F 11/30 18157347.8 \n", + "4 03.10.2018 A01K 31/00 18171005.4 \n", "\n", " filing_date priority_date_eu representative_line_1_eu \\\n", - "0 16.02.2016 Scheider, Sascha et al \n", - "1 19.02.2018 31.03.2017 Hoffmann Eitle \n", - "2 05.02.2015 05.02.2014 Stork Bamberger Patentanw√§lte \n", - "3 03.04.2018 30.03.2017 \n", - "4 21.02.2018 22.02.2017 Liedtke & Partner Patentanw√§lte \n", + "0 21.02.2018 22.02.2017 Liedtke & Partner Patentanw√§lte \n", + "1 03.04.2018 30.03.2017 \n", + "2 16.02.2016 Scheider, Sascha et al \n", + "3 19.02.2018 31.03.2017 Hoffmann Eitle \n", + "4 05.02.2015 05.02.2014 Stork Bamberger Patentanw√§lte \n", "\n", " applicant_line_1 inventor_line_1 \\\n", - "0 EV Group E. Thallner GmbH Kurz, Florian \n", - "1 FUJITSU LIMITED Kukihara, Kensuke \n", - "2 Linco Food Systems A/S Thrane, Uffe \n", - "3 BSH Hausger√§te GmbH Acero Acero, Jesus \n", - "4 SHB Hebezeugbau GmbH VOLGER, Alexander \n", + "0 SHB Hebezeugbau GmbH VOLGER, Alexander \n", + "1 BSH Hausger√§te GmbH Acero Acero, Jesus \n", + "2 EV Group E. Thallner GmbH Kurz, Florian \n", + "3 FUJITSU LIMITED Kukihara, Kensuke \n", + "4 Linco Food Systems A/S Thrane, Uffe \n", "\n", " title_line_1 number \n", - "0 VORRICHTUNG ZUM BONDEN VON SUBSTRATEN EP 3 382 744 A1 \n", - "1 METHOD EXECUTED BY A COMPUTER, INFORMATION PRO... EP 3 382 553 A1 \n", - "2 MASTH√ÑHNCHENCONTAINER ALS BESTANDTEIL EINER E... EP 3 381 276 A1 \n", - "3 VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG EP 3 383 141 A2 \n", - "4 STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER EP 3 366 869 A1 \n", + "0 STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER EP 3 366 869 A1 \n", + "1 VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG EP 3 383 141 A2 \n", + "2 VORRICHTUNG ZUM BONDEN VON SUBSTRATEN EP 3 382 744 A1 \n", + "3 METHOD EXECUTED BY A COMPUTER, INFORMATION PRO... EP 3 382 553 A1 \n", + "4 MASTH√ÑHNCHENCONTAINER ALS BESTANDTEIL EINER E... EP 3 381 276 A1 \n", "\n", "[5 rows x 15 columns]" ] From 0591d7a6464c4b8c5220caa41c10b39034f997df Mon Sep 17 00:00:00 2001 From: Shuowei Li Date: Fri, 12 Dec 2025 20:26:35 +0000 Subject: [PATCH 4/6] add a check for index display --- bigframes/display/anywidget.py | 2 +- notebooks/dataframes/anywidget_mode.ipynb | 150 +++++++++++----------- noxfile.py | 19 ++- 3 files changed, 89 insertions(+), 82 deletions(-) diff --git a/bigframes/display/anywidget.py b/bigframes/display/anywidget.py index 7571adb372..c829942a32 100644 --- a/bigframes/display/anywidget.py +++ b/bigframes/display/anywidget.py @@ -297,7 +297,7 @@ def _set_table_html(self) -> None: page_data = cached_data.iloc[start:end].copy() # Handle index display - if page_data.index.name is not None: + 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) else: diff --git a/notebooks/dataframes/anywidget_mode.ipynb b/notebooks/dataframes/anywidget_mode.ipynb index 314a9cd5e8..4641c32169 100644 --- a/notebooks/dataframes/anywidget_mode.ipynb +++ b/notebooks/dataframes/anywidget_mode.ipynb @@ -107,16 +107,16 @@ "output_type": "stream", "text": [ "state gender year name number\n", - " AL F 1910 Sadie 40\n", - " AL F 1910 Mary 875\n", - " AR F 1910 Vera 39\n", - " AR F 1910 Marie 78\n", - " AR F 1910 Lucille 66\n", - " CA F 1910 Virginia 101\n", - " DC F 1910 Margaret 72\n", - " GA F 1910 Mildred 133\n", - " GA F 1910 Vera 51\n", - " GA F 1910 Sallie 92\n", + " AL F 1910 Vera 71\n", + " AR F 1910 Viola 37\n", + " AR F 1910 Alice 57\n", + " AR F 1910 Edna 95\n", + " AR F 1910 Ollie 40\n", + " CA F 1910 Beatrice 37\n", + " CT F 1910 Marion 36\n", + " CT F 1910 Marie 36\n", + " FL F 1910 Alice 53\n", + " GA F 1910 Thelma 133\n", "...\n", "\n", "[5552452 rows x 5 columns]\n" @@ -196,7 +196,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "0b33d569070e4e04b26366b554f9f7ca", + "model_id": "0eed2201e13d496ab741662d96eddc14", "version_major": 2, "version_minor": 1 }, @@ -409,12 +409,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "5d53673f0d8d47a5b2990d7f638c227a", + "model_id": "45766d5dd61744c2a1c2448b8eddc86d", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "" + "" ] }, "execution_count": 7, @@ -523,12 +523,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "3e766645154d4208b974f0a6dc2d72bf", + "model_id": "cf835e468a03459f9bd2df0f1a3979ed", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "" + "" ] }, "execution_count": 9, @@ -563,7 +563,7 @@ "data": { "text/html": [ "✅ Completed. \n", - " Query processed 85.9 kB in 13 seconds of slot time.\n", + " Query processed 85.9 kB in 18 seconds of slot time.\n", " " ], "text/plain": [ @@ -624,7 +624,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "076edd86ebb9473eab4dfa2b7deb70f3", + "model_id": "39a3ce333e8b4e13aa69fca9c0a08a4e", "version_major": 2, "version_minor": 1 }, @@ -671,42 +671,6 @@ " gs://gcs-public-data--labeled-patents/espacene...\n", " EU\n", " DE\n", - " 29.08.018\n", - " E04H 6/12\n", - " <NA>\n", - " 18157874.1\n", - " 21.02.2018\n", - " 22.02.2017\n", - " Liedtke & Partner Patentanw√§lte\n", - " SHB Hebezeugbau GmbH\n", - " VOLGER, Alexander\n", - " STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER\n", - " EP 3 366 869 A1\n", - " \n", - " \n", - " 1\n", - " {'application_number': None, 'class_internatio...\n", - " gs://gcs-public-data--labeled-patents/espacene...\n", - " EU\n", - " DE\n", - " 03.10.2018\n", - " H05B 6/12\n", - " <NA>\n", - " 18165514.3\n", - " 03.04.2018\n", - " 30.03.2017\n", - " <NA>\n", - " BSH Hausger√§te GmbH\n", - " Acero Acero, Jesus\n", - " VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG\n", - " EP 3 383 141 A2\n", - " \n", - " \n", - " 2\n", - " {'application_number': None, 'class_internatio...\n", - " gs://gcs-public-data--labeled-patents/espacene...\n", - " EU\n", - " DE\n", " 03.10.2018\n", " H01L 21/20\n", " <NA>\n", @@ -720,7 +684,7 @@ " EP 3 382 744 A1\n", " \n", " \n", - " 3\n", + " 1\n", " {'application_number': None, 'class_internatio...\n", " gs://gcs-public-data--labeled-patents/espacene...\n", " EU\n", @@ -738,7 +702,25 @@ " EP 3 382 553 A1\n", " \n", " \n", - " 4\n", + " 2\n", + " {'application_number': None, 'class_internatio...\n", + " gs://gcs-public-data--labeled-patents/espacene...\n", + " EU\n", + " DE\n", + " 29.08.018\n", + " E04H 6/12\n", + " <NA>\n", + " 18157874.1\n", + " 21.02.2018\n", + " 22.02.2017\n", + " Liedtke & Partner Patentanw√§lte\n", + " SHB Hebezeugbau GmbH\n", + " VOLGER, Alexander\n", + " STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER\n", + " EP 3 366 869 A1\n", + " \n", + " \n", + " 3\n", " {'application_number': None, 'class_internatio...\n", " gs://gcs-public-data--labeled-patents/espacene...\n", " EU\n", @@ -755,6 +737,24 @@ " MASTH√ÑHNCHENCONTAINER ALS BESTANDTEIL EINER E...\n", " EP 3 381 276 A1\n", " \n", + " \n", + " 4\n", + " {'application_number': None, 'class_internatio...\n", + " gs://gcs-public-data--labeled-patents/espacene...\n", + " EU\n", + " DE\n", + " 03.10.2018\n", + " H05B 6/12\n", + " <NA>\n", + " 18165514.3\n", + " 03.04.2018\n", + " 30.03.2017\n", + " <NA>\n", + " BSH Hausger√§te GmbH\n", + " Acero Acero, Jesus\n", + " VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG\n", + " EP 3 383 141 A2\n", + " \n", " \n", "\n", "

5 rows × 15 columns

\n", @@ -776,32 +776,32 @@ "4 gs://gcs-public-data--labeled-patents/espacene... EU DE \n", "\n", " publication_date class_international class_us application_number \\\n", - "0 29.08.018 E04H 6/12 18157874.1 \n", - "1 03.10.2018 H05B 6/12 18165514.3 \n", - "2 03.10.2018 H01L 21/20 18166536.5 \n", - "3 03.10.2018 G06F 11/30 18157347.8 \n", - "4 03.10.2018 A01K 31/00 18171005.4 \n", + "0 03.10.2018 H01L 21/20 18166536.5 \n", + "1 03.10.2018 G06F 11/30 18157347.8 \n", + "2 29.08.018 E04H 6/12 18157874.1 \n", + "3 03.10.2018 A01K 31/00 18171005.4 \n", + "4 03.10.2018 H05B 6/12 18165514.3 \n", "\n", " filing_date priority_date_eu representative_line_1_eu \\\n", - "0 21.02.2018 22.02.2017 Liedtke & Partner Patentanw√§lte \n", - "1 03.04.2018 30.03.2017 \n", - "2 16.02.2016 Scheider, Sascha et al \n", - "3 19.02.2018 31.03.2017 Hoffmann Eitle \n", - "4 05.02.2015 05.02.2014 Stork Bamberger Patentanw√§lte \n", + "0 16.02.2016 Scheider, Sascha et al \n", + "1 19.02.2018 31.03.2017 Hoffmann Eitle \n", + "2 21.02.2018 22.02.2017 Liedtke & Partner Patentanw√§lte \n", + "3 05.02.2015 05.02.2014 Stork Bamberger Patentanw√§lte \n", + "4 03.04.2018 30.03.2017 \n", "\n", " applicant_line_1 inventor_line_1 \\\n", - "0 SHB Hebezeugbau GmbH VOLGER, Alexander \n", - "1 BSH Hausger√§te GmbH Acero Acero, Jesus \n", - "2 EV Group E. Thallner GmbH Kurz, Florian \n", - "3 FUJITSU LIMITED Kukihara, Kensuke \n", - "4 Linco Food Systems A/S Thrane, Uffe \n", + "0 EV Group E. Thallner GmbH Kurz, Florian \n", + "1 FUJITSU LIMITED Kukihara, Kensuke \n", + "2 SHB Hebezeugbau GmbH VOLGER, Alexander \n", + "3 Linco Food Systems A/S Thrane, Uffe \n", + "4 BSH Hausger√§te GmbH Acero Acero, Jesus \n", "\n", " title_line_1 number \n", - "0 STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER EP 3 366 869 A1 \n", - "1 VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG EP 3 383 141 A2 \n", - "2 VORRICHTUNG ZUM BONDEN VON SUBSTRATEN EP 3 382 744 A1 \n", - "3 METHOD EXECUTED BY A COMPUTER, INFORMATION PRO... EP 3 382 553 A1 \n", - "4 MASTH√ÑHNCHENCONTAINER ALS BESTANDTEIL EINER E... EP 3 381 276 A1 \n", + "0 VORRICHTUNG ZUM BONDEN VON SUBSTRATEN EP 3 382 744 A1 \n", + "1 METHOD EXECUTED BY A COMPUTER, INFORMATION PRO... EP 3 382 553 A1 \n", + "2 STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER EP 3 366 869 A1 \n", + "3 MASTH√ÑHNCHENCONTAINER ALS BESTANDTEIL EINER E... EP 3 381 276 A1 \n", + "4 VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG EP 3 383 141 A2 \n", "\n", "[5 rows x 15 columns]" ] diff --git a/noxfile.py b/noxfile.py index 44fc5adede..36e6d09817 100644 --- a/noxfile.py +++ b/noxfile.py @@ -66,8 +66,6 @@ UNIT_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] UNIT_TEST_STANDARD_DEPENDENCIES = [ - "mock", - "asyncmock", PYTEST_VERSION, "pytest-asyncio", "pytest-cov", @@ -92,7 +90,6 @@ SYSTEM_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] SYSTEM_TEST_STANDARD_DEPENDENCIES = [ "jinja2", - "mock", "openpyxl", PYTEST_VERSION, "pytest-cov", @@ -207,7 +204,10 @@ def lint_setup_py(session): def install_unittest_dependencies(session, install_test_extra, *constraints): standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES - session.install(*standard_deps, *constraints) + session.install("setuptools", "wheel") + session.install( + "--extra-index-url", "https://pypi.org/simple/", *standard_deps, *constraints + ) if UNIT_TEST_LOCAL_DEPENDENCIES: session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) @@ -224,6 +224,7 @@ def install_unittest_dependencies(session, install_test_extra, *constraints): def run_unit(session, install_test_extra): """Run the unit test suite.""" + session.env["PIP_EXTRA_INDEX_URL"] = "https://pypi.org/simple/" constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) @@ -313,7 +314,13 @@ def install_systemtest_dependencies(session, install_test_extra, *constraints): # See https://github.com/grpc/grpc/pull/30642 session.install("--pre", "grpcio!=1.49.0rc1") - session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) + session.install("setuptools", "wheel") + session.install( + "--extra-index-url", + "https://pypi.org/simple/", + *SYSTEM_TEST_STANDARD_DEPENDENCIES, + *constraints, + ) if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -349,7 +356,7 @@ def run_system( timeout_seconds=900, num_workers=20, ): - """Run the system test suite.""" + session.env["PIP_EXTRA_INDEX_URL"] = "https://pypi.org/simple/" constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) From 5a3bf9a67700c309a2b58b29eff1d781c730cb85 Mon Sep 17 00:00:00 2001 From: Shuowei Li Date: Fri, 12 Dec 2025 21:54:47 +0000 Subject: [PATCH 5/6] display the real index values, even if the index has no name --- bigframes/display/anywidget.py | 10 +- notebooks/dataframes/anywidget_mode.ipynb | 228 +++++++++++----------- tests/system/small/test_anywidget.py | 23 ++- 3 files changed, 133 insertions(+), 128 deletions(-) diff --git a/bigframes/display/anywidget.py b/bigframes/display/anywidget.py index c829942a32..5bf8f62bc5 100644 --- a/bigframes/display/anywidget.py +++ b/bigframes/display/anywidget.py @@ -297,13 +297,15 @@ def _set_table_html(self) -> None: 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) + # TODO(b/332316283): Add tests for custom multiindex + 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 + ) else: # Default index - include as "Row" column page_data.insert(0, "Row", range(start + 1, start + len(page_data) + 1)) - # Handle case where user navigated beyond available data with unknown row count is_unknown_count = self.row_count is None is_beyond_data = self._all_data_loaded and len(page_data) == 0 and self.page > 0 diff --git a/notebooks/dataframes/anywidget_mode.ipynb b/notebooks/dataframes/anywidget_mode.ipynb index 4641c32169..0ce286ce64 100644 --- a/notebooks/dataframes/anywidget_mode.ipynb +++ b/notebooks/dataframes/anywidget_mode.ipynb @@ -106,17 +106,17 @@ "name": "stdout", "output_type": "stream", "text": [ - "state gender year name number\n", - " AL F 1910 Vera 71\n", - " AR F 1910 Viola 37\n", - " AR F 1910 Alice 57\n", - " AR F 1910 Edna 95\n", - " AR F 1910 Ollie 40\n", - " CA F 1910 Beatrice 37\n", - " CT F 1910 Marion 36\n", - " CT F 1910 Marie 36\n", - " FL F 1910 Alice 53\n", - " GA F 1910 Thelma 133\n", + "state gender year name number\n", + " AL F 1910 Lillian 99\n", + " AL F 1910 Ruby 204\n", + " AL F 1910 Helen 76\n", + " AL F 1910 Eunice 41\n", + " AR F 1910 Dora 42\n", + " CA F 1910 Edna 62\n", + " CA F 1910 Helen 239\n", + " CO F 1910 Alice 46\n", + " FL F 1910 Willie 71\n", + " FL F 1910 Thelma 65\n", "...\n", "\n", "[5552452 rows x 5 columns]\n" @@ -196,7 +196,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "0eed2201e13d496ab741662d96eddc14", + "model_id": "775e84ca212c4867bb889266b830ae68", "version_major": 2, "version_minor": 1 }, @@ -232,80 +232,80 @@ " AL\n", " F\n", " 1910\n", - " Sadie\n", - " 40\n", + " Cora\n", + " 61\n", " \n", " \n", " 1\n", " AL\n", " F\n", " 1910\n", - " Mary\n", - " 875\n", + " Anna\n", + " 74\n", " \n", " \n", " 2\n", " AR\n", " F\n", " 1910\n", - " Vera\n", - " 39\n", + " Willie\n", + " 132\n", " \n", " \n", " 3\n", - " AR\n", + " CO\n", " F\n", " 1910\n", - " Marie\n", - " 78\n", + " Anna\n", + " 42\n", " \n", " \n", " 4\n", - " AR\n", + " FL\n", " F\n", " 1910\n", - " Lucille\n", - " 66\n", + " Louise\n", + " 70\n", " \n", " \n", " 5\n", - " CA\n", + " GA\n", " F\n", " 1910\n", - " Virginia\n", - " 101\n", + " Catherine\n", + " 57\n", " \n", " \n", " 6\n", - " DC\n", + " IL\n", " F\n", " 1910\n", - " Margaret\n", - " 72\n", + " Jessie\n", + " 43\n", " \n", " \n", " 7\n", - " GA\n", + " IN\n", " F\n", " 1910\n", - " Mildred\n", - " 133\n", + " Anna\n", + " 100\n", " \n", " \n", " 8\n", - " GA\n", + " IN\n", " F\n", " 1910\n", - " Vera\n", - " 51\n", + " Pauline\n", + " 77\n", " \n", " \n", " 9\n", - " GA\n", + " IN\n", " F\n", " 1910\n", - " Sallie\n", - " 92\n", + " Beulah\n", + " 39\n", " \n", " \n", "\n", @@ -313,17 +313,17 @@ "[5552452 rows x 5 columns in total]" ], "text/plain": [ - "state gender year name number\n", - " AL F 1910 Sadie 40\n", - " AL F 1910 Mary 875\n", - " AR F 1910 Vera 39\n", - " AR F 1910 Marie 78\n", - " AR F 1910 Lucille 66\n", - " CA F 1910 Virginia 101\n", - " DC F 1910 Margaret 72\n", - " GA F 1910 Mildred 133\n", - " GA F 1910 Vera 51\n", - " GA F 1910 Sallie 92\n", + "state gender year name number\n", + " AL F 1910 Cora 61\n", + " AL F 1910 Anna 74\n", + " AR F 1910 Willie 132\n", + " CO F 1910 Anna 42\n", + " FL F 1910 Louise 70\n", + " GA F 1910 Catherine 57\n", + " IL F 1910 Jessie 43\n", + " IN F 1910 Anna 100\n", + " IN F 1910 Pauline 77\n", + " IN F 1910 Beulah 39\n", "...\n", "\n", "[5552452 rows x 5 columns]" @@ -409,12 +409,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "45766d5dd61744c2a1c2448b8eddc86d", + "model_id": "bf4224f8022042aea6d72507ddb5570b", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "" + "" ] }, "execution_count": 7, @@ -523,12 +523,12 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "cf835e468a03459f9bd2df0f1a3979ed", + "model_id": "8d9bfeeba3ca4d11a56dccb28aacde23", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "" + "" ] }, "execution_count": 9, @@ -563,7 +563,7 @@ "data": { "text/html": [ "✅ Completed. \n", - " Query processed 85.9 kB in 18 seconds of slot time.\n", + " Query processed 85.9 kB in 13 seconds of slot time.\n", " " ], "text/plain": [ @@ -624,7 +624,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "39a3ce333e8b4e13aa69fca9c0a08a4e", + "model_id": "9fce25a077604e4882144d46d0d4ba45", "version_major": 2, "version_minor": 1 }, @@ -671,6 +671,42 @@ " gs://gcs-public-data--labeled-patents/espacene...\n", " EU\n", " DE\n", + " 29.08.018\n", + " E04H 6/12\n", + " <NA>\n", + " 18157874.1\n", + " 21.02.2018\n", + " 22.02.2017\n", + " Liedtke & Partner Patentanw√§lte\n", + " SHB Hebezeugbau GmbH\n", + " VOLGER, Alexander\n", + " STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER\n", + " EP 3 366 869 A1\n", + " \n", + " \n", + " 1\n", + " {'application_number': None, 'class_internatio...\n", + " gs://gcs-public-data--labeled-patents/espacene...\n", + " EU\n", + " DE\n", + " 03.10.2018\n", + " H05B 6/12\n", + " <NA>\n", + " 18165514.3\n", + " 03.04.2018\n", + " 30.03.2017\n", + " <NA>\n", + " BSH Hausger√§te GmbH\n", + " Acero Acero, Jesus\n", + " VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG\n", + " EP 3 383 141 A2\n", + " \n", + " \n", + " 2\n", + " {'application_number': None, 'class_internatio...\n", + " gs://gcs-public-data--labeled-patents/espacene...\n", + " EU\n", + " DE\n", " 03.10.2018\n", " H01L 21/20\n", " <NA>\n", @@ -684,7 +720,7 @@ " EP 3 382 744 A1\n", " \n", " \n", - " 1\n", + " 3\n", " {'application_number': None, 'class_internatio...\n", " gs://gcs-public-data--labeled-patents/espacene...\n", " EU\n", @@ -702,25 +738,7 @@ " EP 3 382 553 A1\n", " \n", " \n", - " 2\n", - " {'application_number': None, 'class_internatio...\n", - " gs://gcs-public-data--labeled-patents/espacene...\n", - " EU\n", - " DE\n", - " 29.08.018\n", - " E04H 6/12\n", - " <NA>\n", - " 18157874.1\n", - " 21.02.2018\n", - " 22.02.2017\n", - " Liedtke & Partner Patentanw√§lte\n", - " SHB Hebezeugbau GmbH\n", - " VOLGER, Alexander\n", - " STEUERUNGSSYSTEM F√úR AUTOMATISCHE PARKH√ÑUSER\n", - " EP 3 366 869 A1\n", - " \n", - " \n", - " 3\n", + " 4\n", " {'application_number': None, 'class_internatio...\n", " gs://gcs-public-data--labeled-patents/espacene...\n", " EU\n", @@ -737,24 +755,6 @@ " MASTH√ÑHNCHENCONTAINER ALS BESTANDTEIL EINER E...\n", " EP 3 381 276 A1\n", " \n", - " \n", - " 4\n", - " {'application_number': None, 'class_internatio...\n", - " gs://gcs-public-data--labeled-patents/espacene...\n", - " EU\n", - " DE\n", - " 03.10.2018\n", - " H05B 6/12\n", - " <NA>\n", - " 18165514.3\n", - " 03.04.2018\n", - " 30.03.2017\n", - " <NA>\n", - " BSH Hausger√§te GmbH\n", - " Acero Acero, Jesus\n", - " VORRICHTUNG ZUR INDUKTIVEN ENERGIE√úBERTRAGUNG\n", - " EP 3 383 141 A2\n", - " \n", " \n", "\n", "

5 rows × 15 columns

\n", @@ -776,32 +776,32 @@ "4 gs://gcs-public-data--labeled-patents/espacene... EU DE \n", "\n", " publication_date class_international class_us application_number \\\n", - "0 03.10.2018 H01L 21/20 18166536.5 \n", - "1 03.10.2018 G06F 11/30 18157347.8 \n", - "2 29.08.018 E04H 6/12 18157874.1 \n", - "3 03.10.2018 A01K 31/00 18171005.4 \n", - "4 03.10.2018 H05B 6/12 18165514.3 \n", + "0 29.08.018 E04H 6/12 18157874.1 \n", + "1 03.10.2018 H05B 6/12 18165514.3 \n", + "2 03.10.2018 H01L 21/20 18166536.5 \n", + "3 03.10.2018 G06F 11/30 18157347.8 \n", + "4 03.10.2018 A01K 31/00 18171005.4 \n", "\n", " filing_date priority_date_eu representative_line_1_eu \\\n", - "0 16.02.2016 Scheider, Sascha et al \n", - "1 19.02.2018 31.03.2017 Hoffmann Eitle \n", - "2 21.02.2018 22.02.2017 Liedtke & Partner Patentanwälte \n", - "3 05.02.2015 05.02.2014 Stork Bamberger Patentanwälte \n", - "4 03.04.2018 30.03.2017 \n", + "0 21.02.2018 22.02.2017 Liedtke & Partner Patentanwälte \n", + "1 03.04.2018 30.03.2017 \n", + "2 16.02.2016 Scheider, Sascha et al \n", + "3 19.02.2018 31.03.2017 Hoffmann Eitle \n", + "4 05.02.2015 05.02.2014 Stork Bamberger Patentanwälte \n", "\n", " applicant_line_1 inventor_line_1 \\\n", - "0 EV Group E. Thallner GmbH Kurz, Florian \n", - "1 FUJITSU LIMITED Kukihara, Kensuke \n", - "2 SHB Hebezeugbau GmbH VOLGER, Alexander \n", - "3 Linco Food Systems A/S Thrane, Uffe \n", - "4 BSH Hausgeräte GmbH Acero Acero, Jesus \n", + "0 SHB Hebezeugbau GmbH VOLGER, Alexander \n", + "1 BSH Hausgeräte GmbH Acero Acero, Jesus \n", + "2 EV Group E. Thallner GmbH Kurz, Florian \n", + "3 FUJITSU LIMITED Kukihara, Kensuke \n", + "4 Linco Food Systems A/S Thrane, Uffe \n", "\n", " title_line_1 number \n", - "0 VORRICHTUNG ZUM BONDEN VON SUBSTRATEN EP 3 382 744 A1 \n", - "1 METHOD EXECUTED BY A COMPUTER, INFORMATION PRO... EP 3 382 553 A1 \n", - "2 STEUERUNGSSYSTEM FÜR AUTOMATISCHE PARKHÄUSER EP 3 366 869 A1 \n", - "3 MASTHÄHNCHENCONTAINER ALS BESTANDTEIL EINER E... EP 3 381 276 A1 \n", - "4 VORRICHTUNG ZUR INDUKTIVEN ENERGIEÜBERTRAGUNG EP 3 383 141 A2 \n", + "0 STEUERUNGSSYSTEM FÜR AUTOMATISCHE PARKHÄUSER EP 3 366 869 A1 \n", + "1 VORRICHTUNG ZUR INDUKTIVEN ENERGIEÜBERTRAGUNG EP 3 383 141 A2 \n", + "2 VORRICHTUNG ZUM BONDEN VON SUBSTRATEN EP 3 382 744 A1 \n", + "3 METHOD EXECUTED BY A COMPUTER, INFORMATION PRO... EP 3 382 553 A1 \n", + "4 MASTHÄHNCHENCONTAINER ALS BESTANDTEIL EINER E... EP 3 381 276 A1 \n", "\n", "[5 rows x 15 columns]" ] diff --git a/tests/system/small/test_anywidget.py b/tests/system/small/test_anywidget.py index 591cd570d7..af5939b2ac 100644 --- a/tests/system/small/test_anywidget.py +++ b/tests/system/small/test_anywidget.py @@ -1046,27 +1046,30 @@ def multiindex_bf_df( return session.read_pandas(multiindex_pandas_df) -def test_widget_with_default_index_should_display_row_column( +def test_widget_with_default_index_should_display_index_column_with_empty_header( paginated_bf_df: bf.dataframe.DataFrame, ): """ - Given a DataFrame with a default index, when rendered, - then a "Row" index column should be visible. + Given a DataFrame with a default index, when the TableWidget is rendered, + then an index column should be visible with an empty header. """ + import re + from bigframes.display.anywidget import TableWidget with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 2): widget = TableWidget(paginated_bf_df) html = widget.table_html - # The header for the index should now be "Row". + # The header for the index should be present but empty, matching the + # internal rendering logic. thead = html.split("")[1].split("")[0] - assert "Row" in thead - - # The body rows should contain one header cell (``) for the "Row" index. - tbody = html.split("")[1].split("")[0] - first_row = tbody.split("")[1].split("")[0] - assert "]*>]*>([^<]*)", thead) + assert match is not None, "Could not find table header cell in output." + assert ( + match.group(1) == "" + ), f"Expected empty index header, but found: {match.group(1)}" def test_widget_with_custom_index_should_display_index_column( From e6549743f30af69874695e5dd0e3168485d60c2b Mon Sep 17 00:00:00 2001 From: Shuowei Li Date: Fri, 12 Dec 2025 22:18:33 +0000 Subject: [PATCH 6/6] bug id fix --- bigframes/display/anywidget.py | 2 +- noxfile.py | 19 ++++++------------- tests/system/small/test_anywidget.py | 2 +- 3 files changed, 8 insertions(+), 15 deletions(-) diff --git a/bigframes/display/anywidget.py b/bigframes/display/anywidget.py index 5bf8f62bc5..5c1db93dce 100644 --- a/bigframes/display/anywidget.py +++ b/bigframes/display/anywidget.py @@ -297,7 +297,7 @@ def _set_table_html(self) -> None: page_data = cached_data.iloc[start:end].copy() # Handle index display - # TODO(b/332316283): Add tests for custom multiindex + # TODO(b/438181139): Add tests for custom multiindex if self._dataframe._block.has_index: index_name = page_data.index.name page_data.insert( diff --git a/noxfile.py b/noxfile.py index 36e6d09817..44fc5adede 100644 --- a/noxfile.py +++ b/noxfile.py @@ -66,6 +66,8 @@ UNIT_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] UNIT_TEST_STANDARD_DEPENDENCIES = [ + "mock", + "asyncmock", PYTEST_VERSION, "pytest-asyncio", "pytest-cov", @@ -90,6 +92,7 @@ SYSTEM_TEST_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12", "3.13"] SYSTEM_TEST_STANDARD_DEPENDENCIES = [ "jinja2", + "mock", "openpyxl", PYTEST_VERSION, "pytest-cov", @@ -204,10 +207,7 @@ def lint_setup_py(session): def install_unittest_dependencies(session, install_test_extra, *constraints): standard_deps = UNIT_TEST_STANDARD_DEPENDENCIES + UNIT_TEST_DEPENDENCIES - session.install("setuptools", "wheel") - session.install( - "--extra-index-url", "https://pypi.org/simple/", *standard_deps, *constraints - ) + session.install(*standard_deps, *constraints) if UNIT_TEST_LOCAL_DEPENDENCIES: session.install(*UNIT_TEST_LOCAL_DEPENDENCIES, *constraints) @@ -224,7 +224,6 @@ def install_unittest_dependencies(session, install_test_extra, *constraints): def run_unit(session, install_test_extra): """Run the unit test suite.""" - session.env["PIP_EXTRA_INDEX_URL"] = "https://pypi.org/simple/" constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) @@ -314,13 +313,7 @@ def install_systemtest_dependencies(session, install_test_extra, *constraints): # See https://github.com/grpc/grpc/pull/30642 session.install("--pre", "grpcio!=1.49.0rc1") - session.install("setuptools", "wheel") - session.install( - "--extra-index-url", - "https://pypi.org/simple/", - *SYSTEM_TEST_STANDARD_DEPENDENCIES, - *constraints, - ) + session.install(*SYSTEM_TEST_STANDARD_DEPENDENCIES, *constraints) if SYSTEM_TEST_EXTERNAL_DEPENDENCIES: session.install(*SYSTEM_TEST_EXTERNAL_DEPENDENCIES, *constraints) @@ -356,7 +349,7 @@ def run_system( timeout_seconds=900, num_workers=20, ): - session.env["PIP_EXTRA_INDEX_URL"] = "https://pypi.org/simple/" + """Run the system test suite.""" constraints_path = str( CURRENT_DIRECTORY / "testing" / f"constraints-{session.python}.txt" ) diff --git a/tests/system/small/test_anywidget.py b/tests/system/small/test_anywidget.py index af5939b2ac..b0eeb4a3c2 100644 --- a/tests/system/small/test_anywidget.py +++ b/tests/system/small/test_anywidget.py @@ -1132,6 +1132,6 @@ def test_widget_with_custom_index_matches_pandas_output( assert "row_4" not in html # Verify it respects max_rows -# TODO(b/332316283): Add tests for custom multiindex +# TODO(b/438181139): Add tests for custom multiindex # This may not be necessary for the SQL Cell use case but should be # considered for completeness.