Skip to content

Commit 857608f

Browse files
authored
remove dtype from to_array (#325)
* remove dtype from to_array * link to promotion doc
1 parent bc74191 commit 857608f

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -813,26 +813,26 @@ def drop_nulls(
813813
"""
814814
...
815815

816-
def to_array(self, dtype: DType) -> Any:
816+
def to_array(self) -> Any:
817817
"""Convert to array-API-compliant object.
818818
819-
Parameters
820-
----------
821-
dtype : DType
822-
The dtype of the array-API-compliant object to return.
823-
Must be one of:
824-
825-
- Bool()
826-
- Int8()
827-
- Int16()
828-
- Int32()
829-
- Int64()
830-
- UInt8()
831-
- UInt16()
832-
- UInt32()
833-
- UInt64()
834-
- Float32()
835-
- Float64()
819+
The resulting array will have the corresponding dtype from the
820+
Array API:
821+
822+
- Bool() -> 'bool'
823+
- Int8() -> 'int8'
824+
- Int16() -> 'int16'
825+
- Int32() -> 'int32'
826+
- Int64() -> 'int64'
827+
- UInt8() -> 'uint8'
828+
- UInt16() -> 'uint16'
829+
- UInt32() -> 'uint32'
830+
- UInt64() -> 'uint64'
831+
- Float32() -> 'float32'
832+
- Float64() -> 'float64'
833+
834+
and multiple columns' dtypes are combined according to the
835+
`Array API's type promotion rules <https://data-apis.org/array-api/latest/API_specification/type_promotion.html>`_.
836836
837837
Returns
838838
-------

spec/API_specification/examples/04_datatypes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def main(df_raw: SupportsDataFrameAPI) -> SupportsDataFrameAPI:
1818
if isinstance(df.col(col_name).dtype, pdx.Int64)
1919
],
2020
)
21-
arr = df.to_array(pdx.Int64())
21+
arr = df.to_array()
2222
arr = some_array_function(arr)
2323
df = pdx.dataframe_from_2d_array(arr, names=["a", "b"])
2424
return df.dataframe

0 commit comments

Comments
 (0)