Skip to content

Commit

Permalink
Add cast (#338)
Browse files Browse the repository at this point in the history
* add cast

* note what may vary across implementations
  • Loading branch information
MarcoGorelli committed Dec 8, 2023
1 parent cf6eab6 commit 07dbf57
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions spec/API_specification/dataframe_api/column_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,3 +1068,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
"""
...
10 changes: 10 additions & 0 deletions spec/API_specification/dataframe_api/dataframe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -926,3 +926,13 @@ def persist(self) -> Self:
]
"""
...

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
"""
...

0 comments on commit 07dbf57

Please sign in to comment.