Skip to content

Commit abcb059

Browse files
chore: Amend astype error message and docstring (#1151)
1 parent e1af9f2 commit abcb059

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

bigframes/core/indexes/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def astype(
328328
errors: Literal["raise", "null"] = "raise",
329329
) -> Index:
330330
if errors not in ["raise", "null"]:
331-
raise ValueError("Arg 'error' must be one of 'raise' or 'null'")
331+
raise ValueError("Argument 'errors' must be one of 'raise' or 'null'")
332332
if self.nlevels > 1:
333333
raise TypeError("Multiindex does not support 'astype'")
334334
return self._apply_unary_expr(

bigframes/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ def astype(
356356
errors: Literal["raise", "null"] = "raise",
357357
) -> Series:
358358
if errors not in ["raise", "null"]:
359-
raise ValueError("Arg 'error' must be one of 'raise' or 'null'")
359+
raise ValueError("Argument 'errors' must be one of 'raise' or 'null'")
360360
return self._apply_unary_op(
361361
bigframes.operations.AsTypeOp(to_type=dtype, safe=(errors == "null"))
362362
)

third_party/bigframes_vendored/pandas/core/indexes/base.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,21 @@ def astype(self, dtype):
105105
impossible, a TypeError exception is raised.
106106
107107
Args:
108-
dtype (numpy dtype or pandas type):
109-
A dtype supported by BigQuery DataFrames
108+
dtype (str or pandas.ExtensionDtype):
109+
A dtype supported by BigQuery DataFrame include ``'boolean'``,
110+
``'Float64'``, ``'Int64'``, ``'int64\\[pyarrow\\]'``,
111+
``'string'``, ``'string\\[pyarrow\\]'``,
112+
``'timestamp\\[us, tz=UTC\\]\\[pyarrow\\]'``,
113+
``'timestamp\\[us\\]\\[pyarrow\\]'``,
114+
``'date32\\[day\\]\\[pyarrow\\]'``,
115+
``'time64\\[us\\]\\[pyarrow\\]'``.
116+
A pandas.ExtensionDtype include ``pandas.BooleanDtype()``,
117+
``pandas.Float64Dtype()``, ``pandas.Int64Dtype()``,
118+
``pandas.StringDtype(storage="pyarrow")``,
119+
``pd.ArrowDtype(pa.date32())``,
120+
``pd.ArrowDtype(pa.time64("us"))``,
121+
``pd.ArrowDtype(pa.timestamp("us"))``,
122+
``pd.ArrowDtype(pa.timestamp("us", tz="UTC"))``.
110123
errors ({'raise', 'null'}, default 'raise'):
111124
Control raising of exceptions on invalid data for provided dtype.
112125
If 'raise', allow exceptions to be raised if any value fails cast

0 commit comments

Comments
 (0)