Skip to content

Commit 5acacc7

Browse files
committed
remove cross-dataframe comparisons
1 parent 77bc66b commit 5acacc7

File tree

1 file changed

+39
-55
lines changed

1 file changed

+39
-55
lines changed

spec/API_specification/dataframe_api/dataframe_object.py

Lines changed: 39 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -326,16 +326,15 @@ def sorted_indices(
326326
"""
327327
...
328328

329-
def __eq__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[override]
329+
def __eq__(self, other: Scalar) -> DataFrame: # type: ignore[override]
330330
"""
331331
Compare for equality.
332332
333333
Nulls should follow Kleene Logic.
334334
335335
Parameters
336336
----------
337-
other : DataFrame or Scalar
338-
If DataFrame, must have same length and matching columns.
337+
other : Scalar
339338
"Scalar" here is defined implicitly by what scalar types are allowed
340339
for the operation by the underling dtypes.
341340
@@ -345,16 +344,15 @@ def __eq__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[overri
345344
"""
346345
...
347346

348-
def __ne__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[override]
347+
def __ne__(self, other: Scalar) -> DataFrame: # type: ignore[override]
349348
"""
350349
Compare for non-equality.
351350
352351
Nulls should follow Kleene Logic.
353352
354353
Parameters
355354
----------
356-
other : DataFrame or Scalar
357-
If DataFrame, must have same length and matching columns.
355+
other : Scalar
358356
"Scalar" here is defined implicitly by what scalar types are allowed
359357
for the operation by the underling dtypes.
360358
@@ -364,14 +362,13 @@ def __ne__(self, other: DataFrame | Scalar) -> DataFrame: # type: ignore[overri
364362
"""
365363
...
366364

367-
def __ge__(self, other: DataFrame | Scalar) -> DataFrame:
365+
def __ge__(self, other: Scalar) -> DataFrame:
368366
"""
369367
Compare for "greater than or equal to" `other`.
370368
371369
Parameters
372370
----------
373-
other : DataFrame or Scalar
374-
If DataFrame, must have same length and matching columns.
371+
other : Scalar
375372
"Scalar" here is defined implicitly by what scalar types are allowed
376373
for the operation by the underling dtypes.
377374
@@ -381,14 +378,13 @@ def __ge__(self, other: DataFrame | Scalar) -> DataFrame:
381378
"""
382379
...
383380

384-
def __gt__(self, other: DataFrame | Scalar) -> DataFrame:
381+
def __gt__(self, other: Scalar) -> DataFrame:
385382
"""
386383
Compare for "greater than" `other`.
387384
388385
Parameters
389386
----------
390-
other : DataFrame or Scalar
391-
If DataFrame, must have same length and matching columns.
387+
other : Scalar
392388
"Scalar" here is defined implicitly by what scalar types are allowed
393389
for the operation by the underling dtypes.
394390
@@ -398,14 +394,13 @@ def __gt__(self, other: DataFrame | Scalar) -> DataFrame:
398394
"""
399395
...
400396

401-
def __le__(self, other: DataFrame | Scalar) -> DataFrame:
397+
def __le__(self, other: Scalar) -> DataFrame:
402398
"""
403399
Compare for "less than or equal to" `other`.
404400
405401
Parameters
406402
----------
407-
other : DataFrame or Scalar
408-
If DataFrame, must have same length and matching columns.
403+
other : Scalar
409404
"Scalar" here is defined implicitly by what scalar types are allowed
410405
for the operation by the underling dtypes.
411406
@@ -415,14 +410,13 @@ def __le__(self, other: DataFrame | Scalar) -> DataFrame:
415410
"""
416411
...
417412

418-
def __lt__(self, other: DataFrame | Scalar) -> DataFrame:
413+
def __lt__(self, other: Scalar) -> DataFrame:
419414
"""
420415
Compare for "less than" `other`.
421416
422417
Parameters
423418
----------
424-
other : DataFrame or Scalar
425-
If DataFrame, must have same length and matching columns.
419+
other : Scalar
426420
"Scalar" here is defined implicitly by what scalar types are allowed
427421
for the operation by the underling dtypes.
428422
@@ -432,16 +426,15 @@ def __lt__(self, other: DataFrame | Scalar) -> DataFrame:
432426
"""
433427
...
434428

435-
def __and__(self, other: DataFrame | bool) -> DataFrame:
429+
def __and__(self, other: bool) -> DataFrame:
436430
"""
437-
Apply logical 'and' to `other` DataFrame (or scalar) and this dataframe.
431+
Apply logical 'and' to `other` scalar and this dataframe.
438432
439433
Nulls should follow Kleene Logic.
440434
441435
Parameters
442436
----------
443-
other : DataFrame[bool] or bool
444-
If DataFrame, must have same length.
437+
other : bool
445438
446439
Returns
447440
-------
@@ -455,14 +448,13 @@ def __and__(self, other: DataFrame | bool) -> DataFrame:
455448

456449
def __or__(self, other: DataFrame | bool) -> DataFrame:
457450
"""
458-
Apply logical 'or' to `other` DataFrame (or scalar) and this DataFrame.
451+
Apply logical 'or' to `other` scalar and this DataFrame.
459452
460453
Nulls should follow Kleene Logic.
461454
462455
Parameters
463456
----------
464-
other : DataFrame[bool] or bool
465-
If DataFrame, must have same length.
457+
other : bool
466458
467459
Returns
468460
-------
@@ -474,14 +466,13 @@ def __or__(self, other: DataFrame | bool) -> DataFrame:
474466
If `self` or `other` is not boolean.
475467
"""
476468

477-
def __add__(self, other: DataFrame | Scalar) -> DataFrame:
469+
def __add__(self, other: Scalar) -> DataFrame:
478470
"""
479-
Add `other` dataframe or scalar to this dataframe.
471+
Add `other` scalar to this dataframe.
480472
481473
Parameters
482474
----------
483-
other : DataFrame or Scalar
484-
If DataFrame, must have same length and matching columns.
475+
other : Scalar
485476
"Scalar" here is defined implicitly by what scalar types are allowed
486477
for the operation by the underling dtypes.
487478
@@ -491,14 +482,13 @@ def __add__(self, other: DataFrame | Scalar) -> DataFrame:
491482
"""
492483
...
493484

494-
def __sub__(self, other: DataFrame | Scalar) -> DataFrame:
485+
def __sub__(self, other: Scalar) -> DataFrame:
495486
"""
496-
Subtract `other` dataframe or scalar from this dataframe.
487+
Subtract `other` scalar from this dataframe.
497488
498489
Parameters
499490
----------
500-
other : DataFrame or Scalar
501-
If DataFrame, must have same length and matching columns.
491+
other : Scalar
502492
"Scalar" here is defined implicitly by what scalar types are allowed
503493
for the operation by the underling dtypes.
504494
@@ -508,14 +498,13 @@ def __sub__(self, other: DataFrame | Scalar) -> DataFrame:
508498
"""
509499
...
510500

511-
def __mul__(self, other: DataFrame | Scalar) -> DataFrame:
501+
def __mul__(self, other: Scalar) -> DataFrame:
512502
"""
513-
Multiply `other` dataframe or scalar with this dataframe.
503+
Multiply `other` scalar with this dataframe.
514504
515505
Parameters
516506
----------
517-
other : DataFrame or Scalar
518-
If DataFrame, must have same length and matching columns.
507+
other : Scalar
519508
"Scalar" here is defined implicitly by what scalar types are allowed
520509
for the operation by the underling dtypes.
521510
@@ -525,14 +514,13 @@ def __mul__(self, other: DataFrame | Scalar) -> DataFrame:
525514
"""
526515
...
527516

528-
def __truediv__(self, other: DataFrame | Scalar) -> DataFrame:
517+
def __truediv__(self, other: Scalar) -> DataFrame:
529518
"""
530-
Divide this dataframe by `other` dataframe or scalar. True division, returns floats.
519+
Divide this dataframe by `other` scalar. True division, returns floats.
531520
532521
Parameters
533522
----------
534-
other : DataFrame or Scalar
535-
If DataFrame, must have same length and matching columns.
523+
other : Scalar
536524
"Scalar" here is defined implicitly by what scalar types are allowed
537525
for the operation by the underling dtypes.
538526
@@ -542,14 +530,13 @@ def __truediv__(self, other: DataFrame | Scalar) -> DataFrame:
542530
"""
543531
...
544532

545-
def __floordiv__(self, other: DataFrame | Scalar) -> DataFrame:
533+
def __floordiv__(self, other: Scalar) -> DataFrame:
546534
"""
547-
Floor-divide (returns integers) this dataframe by `other` dataframe or scalar.
535+
Floor-divide (returns integers) this dataframe by `other` scalar.
548536
549537
Parameters
550538
----------
551-
other : DataFrame or Scalar
552-
If DataFrame, must have same length and matching columns.
539+
other : Scalar
553540
"Scalar" here is defined implicitly by what scalar types are allowed
554541
for the operation by the underling dtypes.
555542
@@ -559,7 +546,7 @@ def __floordiv__(self, other: DataFrame | Scalar) -> DataFrame:
559546
"""
560547
...
561548

562-
def __pow__(self, other: DataFrame | Scalar) -> DataFrame:
549+
def __pow__(self, other: Scalar) -> DataFrame:
563550
"""
564551
Raise this dataframe to the power of `other`.
565552
@@ -569,8 +556,7 @@ def __pow__(self, other: DataFrame | Scalar) -> DataFrame:
569556
570557
Parameters
571558
----------
572-
other : DataFrame or Scalar
573-
If DataFrame, must have same length and matching columns.
559+
other : Scalar
574560
"Scalar" here is defined implicitly by what scalar types are allowed
575561
for the operation by the underling dtypes.
576562
@@ -580,14 +566,13 @@ def __pow__(self, other: DataFrame | Scalar) -> DataFrame:
580566
"""
581567
...
582568

583-
def __mod__(self, other: DataFrame | Scalar) -> DataFrame:
569+
def __mod__(self, other: Scalar) -> DataFrame:
584570
"""
585571
Return modulus of this dataframe by `other` (`%` operator).
586572
587573
Parameters
588574
----------
589-
other : DataFrame or Scalar
590-
If DataFrame, must have same length and matching columns.
575+
other : Scalar
591576
"Scalar" here is defined implicitly by what scalar types are allowed
592577
for the operation by the underling dtypes.
593578
@@ -597,20 +582,19 @@ def __mod__(self, other: DataFrame | Scalar) -> DataFrame:
597582
"""
598583
...
599584

600-
def __divmod__(self, other: DataFrame | Scalar) -> tuple[DataFrame, DataFrame]:
585+
def __divmod__(self, other: Scalar) -> tuple[DataFrame, DataFrame]:
601586
"""
602587
Return quotient and remainder of integer division. See `divmod` builtin function.
603588
604589
Parameters
605590
----------
606-
other : DataFrame or Scalar
607-
If DataFrame, must have same length and matching columns.
591+
other : Scalar
608592
"Scalar" here is defined implicitly by what scalar types are allowed
609593
for the operation by the underling dtypes.
610594
611595
Returns
612596
-------
613-
A tuple of two DataFrame's
597+
A tuple of two `DataFrame`s
614598
"""
615599
...
616600

0 commit comments

Comments
 (0)