Skip to content

Commit

Permalink
remove dtype from to_array (#325)
Browse files Browse the repository at this point in the history
* remove dtype from to_array

* link to promotion doc
  • Loading branch information
MarcoGorelli committed Nov 23, 2023
1 parent bc74191 commit 857608f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
36 changes: 18 additions & 18 deletions spec/API_specification/dataframe_api/dataframe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,26 +813,26 @@ def drop_nulls(
"""
...

def to_array(self, dtype: DType) -> Any:
def to_array(self) -> Any:
"""Convert to array-API-compliant object.
Parameters
----------
dtype : DType
The dtype of the array-API-compliant object to return.
Must be one of:
- Bool()
- Int8()
- Int16()
- Int32()
- Int64()
- UInt8()
- UInt16()
- UInt32()
- UInt64()
- Float32()
- Float64()
The resulting array will have the corresponding dtype from the
Array API:
- Bool() -> 'bool'
- Int8() -> 'int8'
- Int16() -> 'int16'
- Int32() -> 'int32'
- Int64() -> 'int64'
- UInt8() -> 'uint8'
- UInt16() -> 'uint16'
- UInt32() -> 'uint32'
- UInt64() -> 'uint64'
- Float32() -> 'float32'
- Float64() -> 'float64'
and multiple columns' dtypes are combined according to the
`Array API's type promotion rules <https://data-apis.org/array-api/latest/API_specification/type_promotion.html>`_.
Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion spec/API_specification/examples/04_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def main(df_raw: SupportsDataFrameAPI) -> SupportsDataFrameAPI:
if isinstance(df.col(col_name).dtype, pdx.Int64)
],
)
arr = df.to_array(pdx.Int64())
arr = df.to_array()
arr = some_array_function(arr)
df = pdx.dataframe_from_2d_array(arr, names=["a", "b"])
return df.dataframe

0 comments on commit 857608f

Please sign in to comment.