@@ -45,6 +45,8 @@ from pandas.core.indexes.multi import MultiIndex
45
45
from pandas .core .indexes .period import PeriodIndex
46
46
from pandas .core .indexes .timedeltas import TimedeltaIndex
47
47
from pandas .core .indexing import (
48
+ _AtIndexer ,
49
+ _iAtIndexer ,
48
50
_iLocIndexer ,
49
51
_IndexSliceTuple ,
50
52
_LocIndexer ,
@@ -285,6 +287,77 @@ class _LocIndexerFrame(_LocIndexer, Generic[_T]):
285
287
value : Scalar | NAType | NaTType | ArrayLike | Series | list | dict | None ,
286
288
) -> None : ...
287
289
290
+ class _iAtIndexerFrame (_iAtIndexer , Generic [_T ]):
291
+ @overload
292
+ def __getitem__ (self , idx : tuple [int , int ]) -> Scalar : ...
293
+ @overload
294
+ def __getitem__ (self , idx : IndexingInt ) -> Series : ...
295
+ @overload
296
+ def __getitem__ (self , idx : tuple [IndexType | MaskType , int ]) -> Series : ...
297
+ @overload
298
+ def __getitem__ (self , idx : tuple [int , IndexType | MaskType ]) -> Series : ...
299
+ @overload
300
+ def __getitem__ (
301
+ self ,
302
+ idx : (
303
+ IndexType
304
+ | MaskType
305
+ | tuple [IndexType | MaskType , IndexType | MaskType ]
306
+ | tuple [slice ]
307
+ ),
308
+ ) -> _T : ...
309
+ def __setitem__ (
310
+ self ,
311
+ idx : (
312
+ int
313
+ | IndexType
314
+ | tuple [int , int ]
315
+ | tuple [IndexType , int ]
316
+ | tuple [IndexType , IndexType ]
317
+ | tuple [int , IndexType ]
318
+ ),
319
+ value : (
320
+ Scalar
321
+ | Series
322
+ | DataFrame
323
+ | np .ndarray
324
+ | NAType
325
+ | NaTType
326
+ | Mapping [Hashable , Scalar | NAType | NaTType ]
327
+ | None
328
+ ),
329
+ ) -> None : ...
330
+
331
+ class _AtIndexerFrame (_AtIndexer , Generic [_T ]):
332
+ def __getitem__ (
333
+ self ,
334
+ idx : tuple [
335
+ int
336
+ | StrLike
337
+ | Timestamp
338
+ | tuple [Scalar , ...]
339
+ | Callable [[DataFrame ], ScalarT ],
340
+ int | StrLike | tuple [Scalar , ...],
341
+ ],
342
+ ) -> Scalar : ...
343
+ def __setitem__ (
344
+ self ,
345
+ idx : (
346
+ MaskType | StrLike | _IndexSliceTuple | list [ScalarT ] | IndexingInt | slice
347
+ ),
348
+ value : (
349
+ Scalar
350
+ | NAType
351
+ | NaTType
352
+ | ArrayLike
353
+ | Series
354
+ | DataFrame
355
+ | list
356
+ | Mapping [Hashable , Scalar | NAType | NaTType ]
357
+ | None
358
+ ),
359
+ ) -> None : ...
360
+
288
361
# With mypy 1.14.1 and python 3.12, the second overload needs a type-ignore statement
289
362
if sys .version_info >= (3 , 12 ):
290
363
class _GetItemHack :
@@ -1591,13 +1664,13 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
1591
1664
axis : Axis = 0 ,
1592
1665
skipna : _bool = True ,
1593
1666
numeric_only : _bool = False ,
1594
- ) -> Series : ...
1667
+ ) -> Series [ int ] : ...
1595
1668
def idxmin (
1596
1669
self ,
1597
1670
axis : Axis = 0 ,
1598
1671
skipna : _bool = True ,
1599
1672
numeric_only : _bool = False ,
1600
- ) -> Series : ...
1673
+ ) -> Series [ int ] : ...
1601
1674
def mode (
1602
1675
self ,
1603
1676
axis : Axis = 0 ,
@@ -1683,7 +1756,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
1683
1756
def __iter__ (self ) -> Iterator [Hashable ]: ...
1684
1757
# properties
1685
1758
@property
1686
- def at (self ): ... # Not sure what to do with this yet; look at source
1759
+ def at (
1760
+ self ,
1761
+ ) -> _AtIndexerFrame : ... # Not sure what to do with this yet; look at source
1687
1762
@property
1688
1763
def columns (self ) -> Index [str ]: ...
1689
1764
@columns .setter # setter needs to be right next to getter; otherwise mypy complains
@@ -1695,7 +1770,9 @@ class DataFrame(NDFrame, OpsMixin, _GetItemHack):
1695
1770
@property
1696
1771
def empty (self ) -> _bool : ...
1697
1772
@property
1698
- def iat (self ): ... # Not sure what to do with this yet; look at source
1773
+ def iat (
1774
+ self ,
1775
+ ) -> _iAtIndexerFrame : ... # Not sure what to do with this yet; look at source
1699
1776
@property
1700
1777
def iloc (self ) -> _iLocIndexerFrame [Self ]: ...
1701
1778
@property
0 commit comments