From 27a2853f69dcfaa67d6b0e5bab7f97135c971cf9 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Wed, 19 Apr 2023 11:17:20 +0100 Subject: [PATCH 1/2] add from_sequence --- .../dataframe_api/column_object.py | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index 31b610b7..f18279c8 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -1,2 +1,23 @@ +from __future__ import annotations + +from typing import Sequence + +from ._types import dtype + class Column: - pass + @classmethod + def from_sequence(cls, sequence: Sequence[object], dtype: dtype) -> Column: + """ + Construct Column from sequence of elements. + + Parameters + ---------- + sequence : Sequence[object] + Sequence of elements. + dtype : str + Dtype of result. Must be specified. + + Returns + ------- + Column + """ From 1b1b9efd8f1afb1d2533868a3dca2b1fa4dc64ac Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Thu, 27 Apr 2023 11:59:23 +0100 Subject: [PATCH 2/2] Add sentence specifying what dtype elements must have. --- spec/API_specification/dataframe_api/column_object.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index f18279c8..a08b2349 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -13,7 +13,9 @@ def from_sequence(cls, sequence: Sequence[object], dtype: dtype) -> Column: Parameters ---------- sequence : Sequence[object] - Sequence of elements. + Sequence of elements. Each element must be of the specified + ``dtype``, the corresponding Python builtin scalar type, or + coercible to that Python scalar type. dtype : str Dtype of result. Must be specified.