diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index b3e10738..199f91d8 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -1057,3 +1057,13 @@ def persist(self) -> Self: at most once per dataframe, and as late as possible in the pipeline. """ ... + + def cast(self, dtype: DType) -> Self: + """Cast specified columns to specified dtypes. + + The following is not specified and may vary across implementations: + + - Cross-kind casting (e.g. integer to string, or to float) + - Behaviour in the case of overflows + """ + ... diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index 4e423fd2..6255402b 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -925,3 +925,13 @@ def persist(self) -> Self: features.append(column_name) """ ... + + def cast(self, dtypes: Mapping[str, DType]) -> Self: + """Convert specified columns to specified dtypes. + + The following is not specified and may vary across implementations: + + - Cross-kind casting (e.g. integer to string, or to float) + - Behaviour in the case of overflows + """ + ...