From c09a5a3ccae48c5848ec711d13f597474d8894da Mon Sep 17 00:00:00 2001 From: MarcoGorelli <33491632+MarcoGorelli@users.noreply.github.com> Date: Thu, 26 Oct 2023 11:00:13 +0100 Subject: [PATCH] formatting --- .../dataframe_api/column_object.py | 41 ++++++++++++++++++- .../dataframe_api/dataframe_object.py | 8 +++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/spec/API_specification/dataframe_api/column_object.py b/spec/API_specification/dataframe_api/column_object.py index dff5687e..bef34688 100644 --- a/spec/API_specification/dataframe_api/column_object.py +++ b/spec/API_specification/dataframe_api/column_object.py @@ -32,8 +32,8 @@ def __column_namespace__(self) -> Namespace: attribute. It may contain other public names as well, but it is recommended to only include those names that are part of the specification. - """ + ... @property def column(self) -> Any: @@ -52,6 +52,7 @@ def __len__(self) -> int: """ Return the number of rows. """ + ... def __iter__(self) -> NoReturn: """ @@ -66,10 +67,11 @@ def __iter__(self) -> NoReturn: raise NotImplementedError("'__iter__' is intentionally not implemented.") @property - def dtype(self) -> Any: + def dtype(self) -> DType: """ Return data type of column. """ + ... def get_rows(self, indices: Self) -> Self: """ @@ -213,6 +215,7 @@ def __eq__(self, other: Self | Scalar) -> Self: # type: ignore[override] ------- Column """ + ... def __ne__(self, other: Self | Scalar) -> Self: # type: ignore[override] """ @@ -231,6 +234,7 @@ def __ne__(self, other: Self | Scalar) -> Self: # type: ignore[override] ------- Column """ + ... def __ge__(self, other: Self | Scalar) -> Self: """ @@ -247,6 +251,7 @@ def __ge__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __gt__(self, other: Self | Scalar) -> Self: """ @@ -263,6 +268,7 @@ def __gt__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __le__(self, other: Self | Scalar) -> Self: """ @@ -279,6 +285,7 @@ def __le__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __lt__(self, other: Self | Scalar) -> Self: """ @@ -295,6 +302,7 @@ def __lt__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __and__(self, other: Self | bool) -> Self: """ @@ -316,6 +324,7 @@ def __and__(self, other: Self | bool) -> Self: ValueError If `self` or `other` is not boolean. """ + ... def __or__(self, other: Self | bool) -> Self: """ @@ -337,6 +346,7 @@ def __or__(self, other: Self | bool) -> Self: ValueError If `self` or `other` is not boolean. """ + ... def __add__(self, other: Self | Scalar) -> Self: """ @@ -353,6 +363,7 @@ def __add__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __sub__(self, other: Self | Scalar) -> Self: """ @@ -369,6 +380,7 @@ def __sub__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __mul__(self, other: Self | Scalar) -> Self: """ @@ -385,6 +397,7 @@ def __mul__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __truediv__(self, other: Self | Scalar) -> Self: """ @@ -401,6 +414,7 @@ def __truediv__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __floordiv__(self, other: Self | Scalar) -> Self: """ @@ -417,6 +431,7 @@ def __floordiv__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __pow__(self, other: Self | Scalar) -> Self: """ @@ -437,6 +452,7 @@ def __pow__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __mod__(self, other: Self | Scalar) -> Self: """ @@ -453,6 +469,7 @@ def __mod__(self, other: Self | Scalar) -> Self: ------- Column """ + ... def __divmod__(self, other: Self | Scalar) -> tuple[Column, Column]: """ @@ -469,6 +486,7 @@ def __divmod__(self, other: Self | Scalar) -> tuple[Column, Column]: ------- Column """ + ... def __radd__(self, other: Self | Scalar) -> Self: ... @@ -498,6 +516,7 @@ def __invert__(self) -> Self: ValueError If any of the Column's columns is not boolean. """ + ... def any(self, *, skip_nulls: bool = True) -> bool | NullType: """ @@ -508,6 +527,7 @@ def any(self, *, skip_nulls: bool = True) -> bool | NullType: ValueError If column is not boolean. """ + ... def all(self, *, skip_nulls: bool = True) -> bool | NullType: """ @@ -518,18 +538,21 @@ def all(self, *, skip_nulls: bool = True) -> bool | NullType: ValueError If column is not boolean. """ + ... def min(self, *, skip_nulls: bool = True) -> Scalar | NullType: """ Reduction returns a scalar. Any data type that supports comparisons must be supported. The returned value has the same dtype as the column. """ + ... def max(self, *, skip_nulls: bool = True) -> Scalar | NullType: """ Reduction returns a scalar. Any data type that supports comparisons must be supported. The returned value has the same dtype as the column. """ + ... def sum(self, *, skip_nulls: bool = True) -> Scalar | NullType: """ @@ -537,12 +560,14 @@ def sum(self, *, skip_nulls: bool = True) -> Scalar | NullType: datetime data types. The returned value has the same dtype as the column. """ + ... def prod(self, *, skip_nulls: bool = True) -> Scalar | NullType: """ Reduction returns a scalar. Must be supported for numerical data types. The returned value has the same dtype as the column. """ + ... def median(self, *, skip_nulls: bool = True) -> Scalar | NullType: """ @@ -551,6 +576,7 @@ def median(self, *, skip_nulls: bool = True) -> Scalar | NullType: datetime (with the appropriate timedelta format string) for datetime dtypes. """ + ... def mean(self, *, skip_nulls: bool = True) -> Scalar | NullType: """ @@ -559,6 +585,7 @@ def mean(self, *, skip_nulls: bool = True) -> Scalar | NullType: datetime (with the appropriate timedelta format string) for datetime dtypes. """ + ... def std(self, *, correction: int | float = 1, skip_nulls: bool = True) -> Scalar | NullType: """ @@ -585,6 +612,7 @@ def std(self, *, correction: int | float = 1, skip_nulls: bool = True) -> Scalar skip_nulls Whether to skip null values. """ + ... def var(self, *, correction: int | float = 1, skip_nulls: bool = True) -> Scalar | NullType: """ @@ -602,18 +630,21 @@ def var(self, *, correction: int | float = 1, skip_nulls: bool = True) -> Scalar skip_nulls Whether to skip null values. """ + ... def cumulative_max(self) -> Self: """ Reduction returns a Column. Any data type that supports comparisons must be supported. The returned value has the same dtype as the column. """ + ... def cumulative_min(self) -> Self: """ Reduction returns a Column. Any data type that supports comparisons must be supported. The returned value has the same dtype as the column. """ + ... def cumulative_sum(self) -> Self: """ @@ -621,6 +652,7 @@ def cumulative_sum(self) -> Self: datetime data types. The returned value has the same dtype as the column. """ + ... def cumulative_prod(self) -> Self: """ @@ -628,6 +660,7 @@ def cumulative_prod(self) -> Self: datetime data types. The returned value has the same dtype as the column. """ + ... def is_null(self) -> Self: """ @@ -647,6 +680,7 @@ def is_null(self) -> Self: May optionally include 'NaT' values (if present in an implementation), but note that the Standard makes no guarantees about them. """ + ... def is_nan(self) -> Self: """ @@ -666,6 +700,7 @@ def is_nan(self) -> Self: Does *not* include 'missing' or 'null' entries. In particular, does not check for `np.timedelta64('NaT')`. """ + ... def is_in(self, values: Self) -> Self: """ @@ -684,6 +719,7 @@ def is_in(self, values: Self) -> Self: ------- Column """ + ... def unique_indices(self, *, skip_nulls: bool = True) -> Self: """ @@ -766,6 +802,7 @@ def to_array(self) -> Any: understanding that consuming libraries would then use the ``array-api-compat`` package to convert it to a Standard-compliant array. """ + ... def rename(self, name: str) -> Self: """ diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index c577a853..07876344 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -50,6 +50,7 @@ def __dataframe_namespace__(self) -> Namespace: recommended to only include those names that are part of the specification. """ + ... @property def dataframe(self) -> SupportsDataFrameAPI: @@ -64,6 +65,7 @@ def shape(self) -> tuple[int, int]: """ Return number of rows and number of columns. """ + ... def group_by(self, *keys: str) -> GroupBy: """ @@ -255,7 +257,7 @@ def column_names(self) -> list[str]: ... @property - def schema(self) -> dict[str, Any]: + def schema(self) -> dict[str, DType]: """ Get dataframe's schema. @@ -264,6 +266,7 @@ def schema(self) -> dict[str, Any]: dict[str, Any] Mapping from column name to data type. """ + ... def sort( self, @@ -463,6 +466,7 @@ def __and__(self, other: bool) -> Self: ValueError If `self` or `other` is not boolean. """ + ... def __or__(self, other: bool) -> Self: """ @@ -483,6 +487,7 @@ def __or__(self, other: bool) -> Self: ValueError If `self` or `other` is not boolean. """ + ... def __add__(self, other: Scalar) -> Self: """ @@ -966,3 +971,4 @@ def join( If, apart from `left_on` and `right_on`, there are any column names present in both `self` and `other`. """ + ...