timsaucer commented on code in PR #916:
URL: https://github.com/apache/datafusion-python/pull/916#discussion_r1798329026
##########
python/datafusion/dataframe.py:
##########
@@ -211,6 +245,19 @@ def sort(self, *exprs: Expr | SortExpr) -> DataFrame:
exprs_raw = [sort_or_default(expr) for expr in exprs]
return DataFrame(self.df.sort(*exprs_raw))
+ def cast(self, mapping: dict[str, pa.DataType[Any]]) -> DataFrame:
+ """Cast all or a subset of columns to new dtype.
Review Comment:
"Cast one or more columns to a different data type."
##########
python/datafusion/dataframe.py:
##########
@@ -211,6 +245,19 @@ def sort(self, *exprs: Expr | SortExpr) -> DataFrame:
exprs_raw = [sort_or_default(expr) for expr in exprs]
return DataFrame(self.df.sort(*exprs_raw))
+ def cast(self, mapping: dict[str, pa.DataType[Any]]) -> DataFrame:
+ """Cast all or a subset of columns to new dtype.
+
+ Args:
+ mapping (dict[str, pa.DataType[Any]]): Mapped with column as key
and column
+ dtype as value.
Review Comment:
Not necessary to have type hints in both the docstring and also the function
declaration.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]