80
80
)
81
81
from pandas .core .dtypes .missing import isna , notna
82
82
83
+ from pandas ._typing import Axes , Dtype
83
84
from pandas .core import algorithms , common as com , nanops , ops
84
85
from pandas .core .accessor import CachedAccessor
85
86
from pandas .core .arrays import Categorical , ExtensionArray
@@ -370,7 +371,7 @@ class DataFrame(NDFrame):
370
371
"""
371
372
372
373
@property
373
- def _constructor (self ):
374
+ def _constructor (self ) -> Type [ "DataFrame" ] :
374
375
return DataFrame
375
376
376
377
_constructor_sliced = Series # type: Type[Series]
@@ -386,7 +387,14 @@ def _constructor_expanddim(self):
386
387
# ----------------------------------------------------------------------
387
388
# Constructors
388
389
389
- def __init__ (self , data = None , index = None , columns = None , dtype = None , copy = False ):
390
+ def __init__ (
391
+ self ,
392
+ data = None ,
393
+ index : Optional [Axes ] = None ,
394
+ columns : Optional [Axes ] = None ,
395
+ dtype : Optional [Dtype ] = None ,
396
+ copy : bool = False ,
397
+ ):
390
398
if data is None :
391
399
data = {}
392
400
if dtype is not None :
@@ -481,7 +489,7 @@ def __init__(self, data=None, index=None, columns=None, dtype=None, copy=False):
481
489
# ----------------------------------------------------------------------
482
490
483
491
@property
484
- def axes (self ):
492
+ def axes (self ) -> List [ Index ] :
485
493
"""
486
494
Return a list representing the axes of the DataFrame.
487
495
@@ -498,7 +506,7 @@ def axes(self):
498
506
return [self .index , self .columns ]
499
507
500
508
@property
501
- def shape (self ):
509
+ def shape (self ) -> Tuple [ int , int ] :
502
510
"""
503
511
Return a tuple representing the dimensionality of the DataFrame.
504
512
@@ -520,7 +528,7 @@ def shape(self):
520
528
return len (self .index ), len (self .columns )
521
529
522
530
@property
523
- def _is_homogeneous_type (self ):
531
+ def _is_homogeneous_type (self ) -> bool :
524
532
"""
525
533
Whether all the columns in a DataFrame have the same type.
526
534
0 commit comments