Skip to content

Commit bc01d66

Browse files
committed
type a few functions
1 parent 5d0ff69 commit bc01d66

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

pandas/core/frame.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
import sys
1717
import warnings
1818
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
2020

2121
import numpy as np
2222
import numpy.ma as ma
@@ -358,7 +358,7 @@ class DataFrame(NDFrame):
358358
"""
359359

360360
@property
361-
def _constructor(self):
361+
def _constructor(self) -> Type[DataFrame]:
362362
return DataFrame
363363

364364
_constructor_sliced = Series # type: Type[Series]
@@ -368,14 +368,18 @@ def _constructor(self):
368368
_accessors = set() # type: Set[str]
369369

370370
@property
371-
def _constructor_expanddim(self):
371+
def _constructor_expanddim(self) -> None:
372372
raise NotImplementedError("Not supported for DataFrames!")
373373

374374
# ----------------------------------------------------------------------
375375
# Constructors
376376

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:
379383
if data is None:
380384
data = {}
381385
if dtype is not None:
@@ -471,7 +475,7 @@ def __init__(self, data=None, index=None, columns=None, dtype=None,
471475
# ----------------------------------------------------------------------
472476

473477
@property
474-
def axes(self):
478+
def axes(self) -> List[Index]:
475479
"""
476480
Return a list representing the axes of the DataFrame.
477481
@@ -488,7 +492,7 @@ def axes(self):
488492
return [self.index, self.columns]
489493

490494
@property
491-
def shape(self):
495+
def shape(self) -> Tuple[int, int]:
492496
"""
493497
Return a tuple representing the dimensionality of the DataFrame.
494498
@@ -510,7 +514,7 @@ def shape(self):
510514
return len(self.index), len(self.columns)
511515

512516
@property
513-
def _is_homogeneous_type(self):
517+
def _is_homogeneous_type(self) -> bool:
514518
"""
515519
Whether all the columns in a DataFrame have the same type.
516520

0 commit comments

Comments
 (0)