Skip to content

Commit a03dec8

Browse files
authored
remove cross-dataframe comparisons (#242)
1 parent b30416b commit a03dec8

File tree

1 file changed

+39
-55
lines changed

1 file changed

+39
-55
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

+39-55
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,15 @@ def sorted_indices(
359359
"""
360360
...
361361

362-
def __eq__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[override]
362+
def __eq__(self, other: Scalar) -> DataFrame: # type: ignore[override]
363363
"""
364364
Compare for equality.
365365
366366
Nulls should follow Kleene Logic.
367367
368368
Parameters
369369
----------
370-
other : DataFrame or Scalar
371-
If DataFrame, must have same length and matching columns.
370+
other : Scalar
372371
"Scalar" here is defined implicitly by what scalar types are allowed
373372
for the operation by the underling dtypes.
374373
@@ -378,16 +377,15 @@ def __eq__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[overri
378377
"""
379378
...
380379

381-
def __ne__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[override]
380+
def __ne__(self, other: Scalar) -> DataFrame: # type: ignore[override]
382381
"""
383382
Compare for non-equality.
384383
385384
Nulls should follow Kleene Logic.
386385
387386
Parameters
388387
----------
389-
other : DataFrame or Scalar
390-
If DataFrame, must have same length and matching columns.
388+
other : Scalar
391389
"Scalar" here is defined implicitly by what scalar types are allowed
392390
for the operation by the underling dtypes.
393391
@@ -397,14 +395,13 @@ def __ne__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[overri
397395
"""
398396
...
399397

400-
def __ge__(self, other: DataFrame | Scalar) -> DataFrame:
398+
def __ge__(self, other: Scalar) -> DataFrame:
401399
"""
402400
Compare for "greater than or equal to" `other`.
403401
404402
Parameters
405403
----------
406-
other : DataFrame or Scalar
407-
If DataFrame, must have same length and matching columns.
404+
other : Scalar
408405
"Scalar" here is defined implicitly by what scalar types are allowed
409406
for the operation by the underling dtypes.
410407
@@ -414,14 +411,13 @@ def __ge__(self, other: DataFrame | Scalar) -> DataFrame:
414411
"""
415412
...
416413

417-
def __gt__(self, other: DataFrame | Scalar) -> DataFrame:
414+
def __gt__(self, other: Scalar) -> DataFrame:
418415
"""
419416
Compare for "greater than" `other`.
420417
421418
Parameters
422419
----------
423-
other : DataFrame or Scalar
424-
If DataFrame, must have same length and matching columns.
420+
other : Scalar
425421
"Scalar" here is defined implicitly by what scalar types are allowed
426422
for the operation by the underling dtypes.
427423
@@ -431,14 +427,13 @@ def __gt__(self, other: DataFrame | Scalar) -> DataFrame:
431427
"""
432428
...
433429

434-
def __le__(self, other: DataFrame | Scalar) -> DataFrame:
430+
def __le__(self, other: Scalar) -> DataFrame:
435431
"""
436432
Compare for "less than or equal to" `other`.
437433
438434
Parameters
439435
----------
440-
other : DataFrame or Scalar
441-
If DataFrame, must have same length and matching columns.
436+
other : Scalar
442437
"Scalar" here is defined implicitly by what scalar types are allowed
443438
for the operation by the underling dtypes.
444439
@@ -448,14 +443,13 @@ def __le__(self, other: DataFrame | Scalar) -> DataFrame:
448443
"""
449444
...
450445

451-
def __lt__(self, other: DataFrame | Scalar) -> DataFrame:
446+
def __lt__(self, other: Scalar) -> DataFrame:
452447
"""
453448
Compare for "less than" `other`.
454449
455450
Parameters
456451
----------
457-
other : DataFrame or Scalar
458-
If DataFrame, must have same length and matching columns.
452+
other : Scalar
459453
"Scalar" here is defined implicitly by what scalar types are allowed
460454
for the operation by the underling dtypes.
461455
@@ -465,16 +459,15 @@ def __lt__(self, other: DataFrame | Scalar) -> DataFrame:
465459
"""
466460
...
467461

468-
def __and__(self, other: DataFrame | bool) -> DataFrame:
462+
def __and__(self, other: bool) -> DataFrame:
469463
"""
470-
Apply logical 'and' to `other` DataFrame (or scalar) and this dataframe.
464+
Apply logical 'and' to `other` scalar and this dataframe.
471465
472466
Nulls should follow Kleene Logic.
473467
474468
Parameters
475469
----------
476-
other : DataFrame[bool] or bool
477-
If DataFrame, must have same length.
470+
other : bool
478471
479472
Returns
480473
-------
@@ -488,14 +481,13 @@ def __and__(self, other: DataFrame | bool) -> DataFrame:
488481

489482
def __or__(self, other: DataFrame | bool) -> DataFrame:
490483
"""
491-
Apply logical 'or' to `other` DataFrame (or scalar) and this DataFrame.
484+
Apply logical 'or' to `other` scalar and this DataFrame.
492485
493486
Nulls should follow Kleene Logic.
494487
495488
Parameters
496489
----------
497-
other : DataFrame[bool] or bool
498-
If DataFrame, must have same length.
490+
other : bool
499491
500492
Returns
501493
-------
@@ -507,14 +499,13 @@ def __or__(self, other: DataFrame | bool) -> DataFrame:
507499
If `self` or `other` is not boolean.
508500
"""
509501

510-
def __add__(self, other: DataFrame | Scalar) -> DataFrame:
502+
def __add__(self, other: Scalar) -> DataFrame:
511503
"""
512-
Add `other` dataframe or scalar to this dataframe.
504+
Add `other` scalar to this dataframe.
513505
514506
Parameters
515507
----------
516-
other : DataFrame or Scalar
517-
If DataFrame, must have same length and matching columns.
508+
other : Scalar
518509
"Scalar" here is defined implicitly by what scalar types are allowed
519510
for the operation by the underling dtypes.
520511
@@ -524,14 +515,13 @@ def __add__(self, other: DataFrame | Scalar) -> DataFrame:
524515
"""
525516
...
526517

527-
def __sub__(self, other: DataFrame | Scalar) -> DataFrame:
518+
def __sub__(self, other: Scalar) -> DataFrame:
528519
"""
529-
Subtract `other` dataframe or scalar from this dataframe.
520+
Subtract `other` scalar from this dataframe.
530521
531522
Parameters
532523
----------
533-
other : DataFrame or Scalar
534-
If DataFrame, must have same length and matching columns.
524+
other : Scalar
535525
"Scalar" here is defined implicitly by what scalar types are allowed
536526
for the operation by the underling dtypes.
537527
@@ -541,14 +531,13 @@ def __sub__(self, other: DataFrame | Scalar) -> DataFrame:
541531
"""
542532
...
543533

544-
def __mul__(self, other: DataFrame | Scalar) -> DataFrame:
534+
def __mul__(self, other: Scalar) -> DataFrame:
545535
"""
546-
Multiply `other` dataframe or scalar with this dataframe.
536+
Multiply `other` scalar with this dataframe.
547537
548538
Parameters
549539
----------
550-
other : DataFrame or Scalar
551-
If DataFrame, must have same length and matching columns.
540+
other : Scalar
552541
"Scalar" here is defined implicitly by what scalar types are allowed
553542
for the operation by the underling dtypes.
554543
@@ -558,14 +547,13 @@ def __mul__(self, other: DataFrame | Scalar) -> DataFrame:
558547
"""
559548
...
560549

561-
def __truediv__(self, other: DataFrame | Scalar) -> DataFrame:
550+
def __truediv__(self, other: Scalar) -> DataFrame:
562551
"""
563-
Divide this dataframe by `other` dataframe or scalar. True division, returns floats.
552+
Divide this dataframe by `other` scalar. True division, returns floats.
564553
565554
Parameters
566555
----------
567-
other : DataFrame or Scalar
568-
If DataFrame, must have same length and matching columns.
556+
other : Scalar
569557
"Scalar" here is defined implicitly by what scalar types are allowed
570558
for the operation by the underling dtypes.
571559
@@ -575,14 +563,13 @@ def __truediv__(self, other: DataFrame | Scalar) -> DataFrame:
575563
"""
576564
...
577565

578-
def __floordiv__(self, other: DataFrame | Scalar) -> DataFrame:
566+
def __floordiv__(self, other: Scalar) -> DataFrame:
579567
"""
580-
Floor-divide (returns integers) this dataframe by `other` dataframe or scalar.
568+
Floor-divide (returns integers) this dataframe by `other` scalar.
581569
582570
Parameters
583571
----------
584-
other : DataFrame or Scalar
585-
If DataFrame, must have same length and matching columns.
572+
other : Scalar
586573
"Scalar" here is defined implicitly by what scalar types are allowed
587574
for the operation by the underling dtypes.
588575
@@ -592,7 +579,7 @@ def __floordiv__(self, other: DataFrame | Scalar) -> DataFrame:
592579
"""
593580
...
594581

595-
def __pow__(self, other: DataFrame | Scalar) -> DataFrame:
582+
def __pow__(self, other: Scalar) -> DataFrame:
596583
"""
597584
Raise this dataframe to the power of `other`.
598585
@@ -602,8 +589,7 @@ def __pow__(self, other: DataFrame | Scalar) -> DataFrame:
602589
603590
Parameters
604591
----------
605-
other : DataFrame or Scalar
606-
If DataFrame, must have same length and matching columns.
592+
other : Scalar
607593
"Scalar" here is defined implicitly by what scalar types are allowed
608594
for the operation by the underling dtypes.
609595
@@ -613,14 +599,13 @@ def __pow__(self, other: DataFrame | Scalar) -> DataFrame:
613599
"""
614600
...
615601

616-
def __mod__(self, other: DataFrame | Scalar) -> DataFrame:
602+
def __mod__(self, other: Scalar) -> DataFrame:
617603
"""
618604
Return modulus of this dataframe by `other` (`%` operator).
619605
620606
Parameters
621607
----------
622-
other : DataFrame or Scalar
623-
If DataFrame, must have same length and matching columns.
608+
other : Scalar
624609
"Scalar" here is defined implicitly by what scalar types are allowed
625610
for the operation by the underling dtypes.
626611
@@ -630,20 +615,19 @@ def __mod__(self, other: DataFrame | Scalar) -> DataFrame:
630615
"""
631616
...
632617

633-
def __divmod__(self, other: DataFrame | Scalar) -> tuple[DataFrame, DataFrame]:
618+
def __divmod__(self, other: Scalar) -> tuple[DataFrame, DataFrame]:
634619
"""
635620
Return quotient and remainder of integer division. See `divmod` builtin function.
636621
637622
Parameters
638623
----------
639-
other : DataFrame or Scalar
640-
If DataFrame, must have same length and matching columns.
624+
other : Scalar
641625
"Scalar" here is defined implicitly by what scalar types are allowed
642626
for the operation by the underling dtypes.
643627
644628
Returns
645629
-------
646-
A tuple of two DataFrame's
630+
A tuple of two `DataFrame`s
647631
"""
648632
...
649633

0 commit comments

Comments
 (0)