Skip to content

Remove cross-dataframe comparisons #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 39 additions & 55 deletions spec/API_specification/dataframe_api/dataframe_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,16 +326,15 @@ def sorted_indices(
"""
...

def __eq__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[override]
def __eq__(self, other: Scalar) -> DataFrame: # type: ignore[override]
"""
Compare for equality.

Nulls should follow Kleene Logic.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -345,16 +344,15 @@ def __eq__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[overri
"""
...

def __ne__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[override]
def __ne__(self, other: Scalar) -> DataFrame: # type: ignore[override]
"""
Compare for non-equality.

Nulls should follow Kleene Logic.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -364,14 +362,13 @@ def __ne__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[overri
"""
...

def __ge__(self, other: DataFrame | Scalar) -> DataFrame:
def __ge__(self, other: Scalar) -> DataFrame:
"""
Compare for "greater than or equal to" `other`.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -381,14 +378,13 @@ def __ge__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __gt__(self, other: DataFrame | Scalar) -> DataFrame:
def __gt__(self, other: Scalar) -> DataFrame:
"""
Compare for "greater than" `other`.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -398,14 +394,13 @@ def __gt__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __le__(self, other: DataFrame | Scalar) -> DataFrame:
def __le__(self, other: Scalar) -> DataFrame:
"""
Compare for "less than or equal to" `other`.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -415,14 +410,13 @@ def __le__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __lt__(self, other: DataFrame | Scalar) -> DataFrame:
def __lt__(self, other: Scalar) -> DataFrame:
"""
Compare for "less than" `other`.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -432,16 +426,15 @@ def __lt__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __and__(self, other: DataFrame | bool) -> DataFrame:
def __and__(self, other: bool) -> DataFrame:
"""
Apply logical 'and' to `other` DataFrame (or scalar) and this dataframe.
Apply logical 'and' to `other` scalar and this dataframe.

Nulls should follow Kleene Logic.

Parameters
----------
other : DataFrame[bool] or bool
If DataFrame, must have same length.
other : bool

Returns
-------
Expand All @@ -455,14 +448,13 @@ def __and__(self, other: DataFrame | bool) -> DataFrame:

def __or__(self, other: DataFrame | bool) -> DataFrame:
"""
Apply logical 'or' to `other` DataFrame (or scalar) and this DataFrame.
Apply logical 'or' to `other` scalar and this DataFrame.

Nulls should follow Kleene Logic.

Parameters
----------
other : DataFrame[bool] or bool
If DataFrame, must have same length.
other : bool

Returns
-------
Expand All @@ -474,14 +466,13 @@ def __or__(self, other: DataFrame | bool) -> DataFrame:
If `self` or `other` is not boolean.
"""

def __add__(self, other: DataFrame | Scalar) -> DataFrame:
def __add__(self, other: Scalar) -> DataFrame:
"""
Add `other` dataframe or scalar to this dataframe.
Add `other` scalar to this dataframe.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -491,14 +482,13 @@ def __add__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __sub__(self, other: DataFrame | Scalar) -> DataFrame:
def __sub__(self, other: Scalar) -> DataFrame:
"""
Subtract `other` dataframe or scalar from this dataframe.
Subtract `other` scalar from this dataframe.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -508,14 +498,13 @@ def __sub__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __mul__(self, other: DataFrame | Scalar) -> DataFrame:
def __mul__(self, other: Scalar) -> DataFrame:
"""
Multiply `other` dataframe or scalar with this dataframe.
Multiply `other` scalar with this dataframe.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -525,14 +514,13 @@ def __mul__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __truediv__(self, other: DataFrame | Scalar) -> DataFrame:
def __truediv__(self, other: Scalar) -> DataFrame:
"""
Divide this dataframe by `other` dataframe or scalar. True division, returns floats.
Divide this dataframe by `other` scalar. True division, returns floats.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -542,14 +530,13 @@ def __truediv__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __floordiv__(self, other: DataFrame | Scalar) -> DataFrame:
def __floordiv__(self, other: Scalar) -> DataFrame:
"""
Floor-divide (returns integers) this dataframe by `other` dataframe or scalar.
Floor-divide (returns integers) this dataframe by `other` scalar.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -559,7 +546,7 @@ def __floordiv__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __pow__(self, other: DataFrame | Scalar) -> DataFrame:
def __pow__(self, other: Scalar) -> DataFrame:
"""
Raise this dataframe to the power of `other`.

Expand All @@ -569,8 +556,7 @@ def __pow__(self, other: DataFrame | Scalar) -> DataFrame:

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -580,14 +566,13 @@ def __pow__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __mod__(self, other: DataFrame | Scalar) -> DataFrame:
def __mod__(self, other: Scalar) -> DataFrame:
"""
Return modulus of this dataframe by `other` (`%` operator).

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Expand All @@ -597,20 +582,19 @@ def __mod__(self, other: DataFrame | Scalar) -> DataFrame:
"""
...

def __divmod__(self, other: DataFrame | Scalar) -> tuple[DataFrame, DataFrame]:
def __divmod__(self, other: Scalar) -> tuple[DataFrame, DataFrame]:
"""
Return quotient and remainder of integer division. See `divmod` builtin function.

Parameters
----------
other : DataFrame or Scalar
If DataFrame, must have same length and matching columns.
other : Scalar
"Scalar" here is defined implicitly by what scalar types are allowed
for the operation by the underling dtypes.

Returns
-------
A tuple of two DataFrame's
A tuple of two `DataFrame`s
"""
...

Expand Down