16
16
import sys
17
17
import warnings
18
18
from textwrap import dedent
19
- from typing import FrozenSet , List , Optional , Set , Type , Union
19
+ from typing import FrozenSet , List , Optional , Set , Tuple , Type , Union
20
20
21
21
import numpy as np
22
22
import numpy .ma as ma
@@ -358,7 +358,7 @@ class DataFrame(NDFrame):
358
358
"""
359
359
360
360
@property
361
- def _constructor (self ):
361
+ def _constructor (self ) -> Type [ DataFrame ] :
362
362
return DataFrame
363
363
364
364
_constructor_sliced = Series # type: Type[Series]
@@ -368,14 +368,18 @@ def _constructor(self):
368
368
_accessors = set () # type: Set[str]
369
369
370
370
@property
371
- def _constructor_expanddim (self ):
371
+ def _constructor_expanddim (self ) -> None :
372
372
raise NotImplementedError ("Not supported for DataFrames!" )
373
373
374
374
# ----------------------------------------------------------------------
375
375
# Constructors
376
376
377
- def __init__ (self , data = None , index = None , columns = None , dtype = None ,
378
- copy = False ):
377
+ def __init__ (self ,
378
+ data = None ,
379
+ index : Index = None ,
380
+ columns : Index = None ,
381
+ dtype = None ,
382
+ copy : bool = False ) -> None :
379
383
if data is None :
380
384
data = {}
381
385
if dtype is not None :
@@ -471,7 +475,7 @@ def __init__(self, data=None, index=None, columns=None, dtype=None,
471
475
# ----------------------------------------------------------------------
472
476
473
477
@property
474
- def axes (self ):
478
+ def axes (self ) -> List [ Index ] :
475
479
"""
476
480
Return a list representing the axes of the DataFrame.
477
481
@@ -488,7 +492,7 @@ def axes(self):
488
492
return [self .index , self .columns ]
489
493
490
494
@property
491
- def shape (self ):
495
+ def shape (self ) -> Tuple [ int , int ] :
492
496
"""
493
497
Return a tuple representing the dimensionality of the DataFrame.
494
498
@@ -510,7 +514,7 @@ def shape(self):
510
514
return len (self .index ), len (self .columns )
511
515
512
516
@property
513
- def _is_homogeneous_type (self ):
517
+ def _is_homogeneous_type (self ) -> bool :
514
518
"""
515
519
Whether all the columns in a DataFrame have the same type.
516
520
0 commit comments