File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 71
71
ReadPickleBuffer ,
72
72
StorageOptions ,
73
73
)
74
+ import pandas .core .dtypes .common as pd_dtypes
74
75
import pyarrow as pa
75
76
76
77
import bigframes ._config .bigquery_options as bigquery_options
@@ -1005,6 +1006,13 @@ def _read_pandas(
1005
1006
"bigframes.pandas.DataFrame."
1006
1007
)
1007
1008
1009
+ for column_name , dtype in pandas_dataframe .dtypes .items ():
1010
+ if pd_dtypes .is_object_dtype (dtype ):
1011
+ raise ValueError (
1012
+ f"Column `{ column_name } ` has an unsupported dtype: `{ dtype } `. "
1013
+ + f"{ constants .FEEDBACK_LINK } "
1014
+ )
1015
+
1008
1016
inline_df = self ._read_pandas_inline (pandas_dataframe )
1009
1017
if inline_df is not None :
1010
1018
return inline_df
Original file line number Diff line number Diff line change @@ -421,6 +421,11 @@ def test_read_pandas(session, scalars_dfs):
421
421
pd .testing .assert_frame_equal (result , expected )
422
422
423
423
424
+ def test_read_pandas_w_unsupported_object_dtype (session ):
425
+ with pytest .raises (ValueError , match = "unsupported dtype: `object`" ):
426
+ session .read_pandas (pd .DataFrame ({"a" : [1 , "hello" ]}))
427
+
428
+
424
429
def test_read_pandas_inline_respects_location ():
425
430
options = bigframes .BigQueryOptions (location = "europe-west1" )
426
431
session = bigframes .Session (options )
You can’t perform that action at this time.
0 commit comments