Skip to content

Commit 3b6ae24

Browse files
authored
rename to_array_object to to_array, remove dtype argument in Column case (#293)
* remove dtype from to_array * fixup
1 parent 78c8e5d commit 3b6ae24

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

spec/API_specification/dataframe_api/column_object.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -733,27 +733,26 @@ def fill_null(self, value: Scalar, /) -> Self:
733733
"""
734734
...
735735

736-
def to_array_object(self, dtype: DType) -> Any:
736+
def to_array(self) -> Any:
737737
"""
738738
Convert to array-API-compliant object.
739739
740-
Parameters
741-
----------
742-
dtype : DType
743-
The dtype of the array-API-compliant object to return.
744-
Must be one of:
745-
746-
- Bool()
747-
- Int8()
748-
- Int16()
749-
- Int32()
750-
- Int64()
751-
- UInt8()
752-
- UInt16()
753-
- UInt32()
754-
- UInt64()
755-
- Float32()
756-
- Float64()
740+
The resulting array will have the corresponding dtype from the
741+
Array API:
742+
743+
- Bool() -> 'bool'
744+
- Int8() -> 'int8'
745+
- Int16() -> 'int16'
746+
- Int32() -> 'int32'
747+
- Int64() -> 'int64'
748+
- UInt8() -> 'uint8'
749+
- UInt16() -> 'uint16'
750+
- UInt32() -> 'uint32'
751+
- UInt64() -> 'uint64'
752+
- Float32() -> 'float32'
753+
- Float64() -> 'float64'
754+
755+
Null values are not supported and must be filled prior to conversion.
757756
758757
Returns
759758
-------

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ def fill_null(
890890
"""
891891
...
892892

893-
def to_array_object(self, dtype: DType) -> Any:
893+
def to_array(self, dtype: DType) -> Any:
894894
"""
895895
Convert to array-API-compliant object.
896896

spec/API_specification/examples/02_plotting.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ def group_by_and_plot(
2424
x.rename('x'), y.rename('y'), color.rename('color')
2525
)
2626

27-
agg = df.group_by("color").mean()
28-
x = agg.get_column_by_name("x").to_array_object(namespace.Float64())
29-
y = agg.get_column_by_name("y").to_array_object(namespace.Float64())
27+
agg = df.group_by("color").mean().fill_null(float('nan'))
28+
x = agg.get_column_by_name("x").to_array()
29+
y = agg.get_column_by_name("y").to_array()
3030

3131
my_plotting_function(x, y)

0 commit comments

Comments
 (0)