67
67
Manager ,
68
68
NaPosition ,
69
69
NDFrameT ,
70
+ NDFrameTb ,
70
71
RandomState ,
71
72
Renamer ,
72
73
Scalar ,
198
199
from pandas .core .indexers .objects import BaseIndexer
199
200
from pandas .core .resample import Resampler
200
201
201
-
202
202
# goal is to be able to define the docs close to function, while still being
203
203
# able to share
204
204
_shared_docs = {** _shared_docs }
@@ -9297,7 +9297,7 @@ def compare(
9297
9297
@doc (** _shared_doc_kwargs )
9298
9298
def align (
9299
9299
self : NDFrameT ,
9300
- other : NDFrameT ,
9300
+ other : NDFrameTb ,
9301
9301
join : AlignJoin = "outer" ,
9302
9302
axis : Axis | None = None ,
9303
9303
level : Level = None ,
@@ -9307,7 +9307,7 @@ def align(
9307
9307
limit : int | None = None ,
9308
9308
fill_axis : Axis = 0 ,
9309
9309
broadcast_axis : Axis | None = None ,
9310
- ) -> NDFrameT :
9310
+ ) -> tuple [ NDFrameT , NDFrameTb ] :
9311
9311
"""
9312
9312
Align two objects on their axes with the specified join method.
9313
9313
@@ -9428,8 +9428,10 @@ def align(
9428
9428
df = cons (
9429
9429
{c : self for c in other .columns }, ** other ._construct_axes_dict ()
9430
9430
)
9431
- return df ._align_frame (
9432
- other ,
9431
+ # error: Incompatible return value type (got "Tuple[DataFrame,
9432
+ # DataFrame]", expected "Tuple[NDFrameT, NDFrameTb]")
9433
+ return df ._align_frame ( # type: ignore[return-value]
9434
+ other , # type: ignore[arg-type]
9433
9435
join = join ,
9434
9436
axis = axis ,
9435
9437
level = level ,
@@ -9446,7 +9448,9 @@ def align(
9446
9448
df = cons (
9447
9449
{c : other for c in self .columns }, ** self ._construct_axes_dict ()
9448
9450
)
9449
- return self ._align_frame (
9451
+ # error: Incompatible return value type (got "Tuple[NDFrameT,
9452
+ # DataFrame]", expected "Tuple[NDFrameT, NDFrameTb]")
9453
+ return self ._align_frame ( # type: ignore[return-value]
9450
9454
df ,
9451
9455
join = join ,
9452
9456
axis = axis ,
@@ -9461,7 +9465,9 @@ def align(
9461
9465
if axis is not None :
9462
9466
axis = self ._get_axis_number (axis )
9463
9467
if isinstance (other , ABCDataFrame ):
9464
- return self ._align_frame (
9468
+ # error: Incompatible return value type (got "Tuple[NDFrameT, DataFrame]",
9469
+ # expected "Tuple[NDFrameT, NDFrameTb]")
9470
+ return self ._align_frame ( # type: ignore[return-value]
9465
9471
other ,
9466
9472
join = join ,
9467
9473
axis = axis ,
@@ -9473,7 +9479,9 @@ def align(
9473
9479
fill_axis = fill_axis ,
9474
9480
)
9475
9481
elif isinstance (other , ABCSeries ):
9476
- return self ._align_series (
9482
+ # error: Incompatible return value type (got "Tuple[NDFrameT, Series]",
9483
+ # expected "Tuple[NDFrameT, NDFrameTb]")
9484
+ return self ._align_series ( # type: ignore[return-value]
9477
9485
other ,
9478
9486
join = join ,
9479
9487
axis = axis ,
@@ -9489,8 +9497,8 @@ def align(
9489
9497
9490
9498
@final
9491
9499
def _align_frame (
9492
- self ,
9493
- other ,
9500
+ self : NDFrameT ,
9501
+ other : DataFrame ,
9494
9502
join : AlignJoin = "outer" ,
9495
9503
axis : Axis | None = None ,
9496
9504
level = None ,
@@ -9499,7 +9507,7 @@ def _align_frame(
9499
9507
method = None ,
9500
9508
limit = None ,
9501
9509
fill_axis : Axis = 0 ,
9502
- ):
9510
+ ) -> tuple [ NDFrameT , DataFrame ] :
9503
9511
# defaults
9504
9512
join_index , join_columns = None , None
9505
9513
ilidx , iridx = None , None
@@ -9553,8 +9561,8 @@ def _align_frame(
9553
9561
9554
9562
@final
9555
9563
def _align_series (
9556
- self ,
9557
- other ,
9564
+ self : NDFrameT ,
9565
+ other : Series ,
9558
9566
join : AlignJoin = "outer" ,
9559
9567
axis : Axis | None = None ,
9560
9568
level = None ,
@@ -9563,7 +9571,7 @@ def _align_series(
9563
9571
method = None ,
9564
9572
limit = None ,
9565
9573
fill_axis : Axis = 0 ,
9566
- ):
9574
+ ) -> tuple [ NDFrameT , Series ] :
9567
9575
is_series = isinstance (self , ABCSeries )
9568
9576
if copy and using_copy_on_write ():
9569
9577
copy = False
@@ -12798,8 +12806,8 @@ def _doc_params(cls):
12798
12806
12799
12807
12800
12808
def _align_as_utc (
12801
- left : NDFrameT , right : NDFrameT , join_index : Index | None
12802
- ) -> tuple [NDFrameT , NDFrameT ]:
12809
+ left : NDFrameT , right : NDFrameTb , join_index : Index | None
12810
+ ) -> tuple [NDFrameT , NDFrameTb ]:
12803
12811
"""
12804
12812
If we are aligning timezone-aware DatetimeIndexes and the timezones
12805
12813
do not match, convert both to UTC.
0 commit comments