Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit 56383f5

Browse files
committed
chore: suppress JSONDtypeWarning in TableWidget
1 parent 196c111 commit 56383f5

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

bigframes/display/anywidget.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import threading
2424
from typing import Any, Iterator, Optional
2525
import uuid
26+
import warnings
2627

2728
import pandas as pd
2829

@@ -114,11 +115,13 @@ def __init__(self, dataframe: bigframes.dataframe.DataFrame):
114115
# TODO(b/469861913): Nested columns from structs (e.g., 'struct_col.name') are not currently sortable.
115116
# TODO(b/463754889): Support non-string column labels for sorting.
116117
if all(isinstance(col, str) for col in dataframe.columns):
117-
self.orderable_columns = [
118-
str(col_name)
119-
for col_name, dtype in dataframe.dtypes.items()
120-
if dtypes.is_orderable(dtype)
121-
]
118+
with warnings.catch_warnings():
119+
warnings.simplefilter("ignore", bigframes.exceptions.JSONDtypeWarning)
120+
self.orderable_columns = [
121+
str(col_name)
122+
for col_name, dtype in dataframe.dtypes.items()
123+
if dtypes.is_orderable(dtype)
124+
]
122125
else:
123126
self.orderable_columns = []
124127

0 commit comments

Comments
 (0)