From 578ac2fc4f1f62cafc9754390afccbe21272586a Mon Sep 17 00:00:00 2001 From: MarcoGorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Tue, 1 Aug 2023 12:28:10 +0100 Subject: [PATCH 1/4] use str in to_array_object --- .../dataframe_api/column_object.py | 17 +++++++++++++++-- .../dataframe_api/dataframe_object.py | 19 ++++++++++++++++--- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index e0bef139..60bf0f6e 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -701,14 +701,27 @@ def fill_null(self: Column[DType], value: Scalar, /) -> Column[DType]: """ ... - def to_array_object(self, dtype: Any) -> Any: + def to_array_object(self, dtype: str) -> Any: """ Convert to array-API-compliant object. Parameters ---------- - dtype : Any + dtype : str 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 Returns ------- diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index d487cc98..947ef380 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -817,14 +817,27 @@ def fill_null( """ ... - def to_array_object(self, dtype: Any) -> Any: + def to_array_object(self, dtype: str) -> Any: """ Convert to array-API-compliant object. Parameters ---------- - dtype : Any - The dtype of the array-API-compliant object to return. + dtype : str + 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 Returns ------- From ce62c44ded235eaa8e40b749eb05f7d940092643 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:28:34 +0100 Subject: [PATCH 2/4] keep dtype, but document accepted types --- .../dataframe_api/column_object.py | 26 +++++++++---------- .../dataframe_api/dataframe_object.py | 26 +++++++++---------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index 60bf0f6e..7be3720f 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -701,27 +701,27 @@ def fill_null(self: Column[DType], value: Scalar, /) -> Column[DType]: """ ... - def to_array_object(self, dtype: str) -> Any: + def to_array_object(self, dtype: Any) -> Any: """ Convert to array-API-compliant object. Parameters ---------- - dtype : str + 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 + - namespace.Bool() + - namespace.Int8() + - namespace.Int16() + - namespace.Int32() + - namespace.Int64() + - namespace.UInt8() + - namespace.UInt16() + - namespace.UInt32() + - namespace.UInt64() + - namespace.Float32() + - namespace.Float64() Returns ------- diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index 947ef380..1c07a04f 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -817,27 +817,27 @@ def fill_null( """ ... - def to_array_object(self, dtype: str) -> Any: + def to_array_object(self, dtype: Any) -> Any: """ Convert to array-API-compliant object. Parameters ---------- - dtype : str + 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 + - namespace.Bool() + - namespace.Int8() + - namespace.Int16() + - namespace.Int32() + - namespace.Int64() + - namespace.UInt8() + - namespace.UInt16() + - namespace.UInt32() + - namespace.UInt64() + - namespace.Float32() + - namespace.Float64() Returns ------- From 7226c7056f46efc10fb6e6630cf9c04b1af2341e Mon Sep 17 00:00:00 2001 From: MarcoGorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Wed, 2 Aug 2023 15:00:36 +0100 Subject: [PATCH 3/4] remove namespace --- .../dataframe_api/column_object.py | 22 +++++++++---------- .../dataframe_api/dataframe_object.py | 22 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index b32e4652..8667e6e0 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -699,17 +699,17 @@ def to_array_object(self, dtype: Any) -> Any: The dtype of the array-API-compliant object to return. Must be one of: - - namespace.Bool() - - namespace.Int8() - - namespace.Int16() - - namespace.Int32() - - namespace.Int64() - - namespace.UInt8() - - namespace.UInt16() - - namespace.UInt32() - - namespace.UInt64() - - namespace.Float32() - - namespace.Float64() + - Bool() + - Int8() + - Int16() + - Int32() + - Int64() + - UInt8() + - UInt16() + - UInt32() + - UInt64() + - Float32() + - Float64() Returns ------- diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index 05ef8ad1..99049a53 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -827,17 +827,17 @@ def to_array_object(self, dtype: Any) -> Any: The dtype of the array-API-compliant object to return: Must be one of: - - namespace.Bool() - - namespace.Int8() - - namespace.Int16() - - namespace.Int32() - - namespace.Int64() - - namespace.UInt8() - - namespace.UInt16() - - namespace.UInt32() - - namespace.UInt64() - - namespace.Float32() - - namespace.Float64() + - Bool() + - Int8() + - Int16() + - Int32() + - Int64() + - UInt8() + - UInt16() + - UInt32() + - UInt64() + - Float32() + - Float64() Returns ------- From a90e195d23949b722859f4d73ad939999d9da41f Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Thu, 3 Aug 2023 11:40:00 +0200 Subject: [PATCH 4/4] Fix a typo --- spec/API_specification/dataframe_api/dataframe_object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index 99049a53..8a25a8c1 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -824,7 +824,7 @@ def to_array_object(self, dtype: Any) -> Any: Parameters ---------- dtype : DType - The dtype of the array-API-compliant object to return: + The dtype of the array-API-compliant object to return. Must be one of: - Bool()