Skip to content

Commit 8769366

Browse files
committed
Add type hints for (NDFrame|Series)._data
1 parent 430f0fd commit 8769366

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

pandas/core/generic.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import operator
77
import pickle
88
from textwrap import dedent
9-
from typing import Callable, FrozenSet, List, Set
9+
from typing import Callable, FrozenSet, List, Optional, Set
1010
import warnings
1111
import weakref
1212

@@ -35,6 +35,7 @@
3535
from pandas.core.dtypes.missing import isna, notna
3636

3737
import pandas as pd
38+
from pandas._typing import Dtype
3839
from pandas.core import missing, nanops
3940
import pandas.core.algorithms as algos
4041
from pandas.core.base import PandasObject, SelectionMixin
@@ -118,12 +119,17 @@ class NDFrame(PandasObject, SelectionMixin):
118119
]) # type: FrozenSet[str]
119120
_metadata = [] # type: List[str]
120121
_is_copy = None
122+
_data = None # type: BlockManager
121123

122124
# ----------------------------------------------------------------------
123125
# Constructors
124126

125-
def __init__(self, data, axes=None, copy=False, dtype=None,
126-
fastpath=False):
127+
def __init__(self,
128+
data: BlockManager,
129+
axes: Optional[List[Index]] = None,
130+
copy: bool = False,
131+
dtype: Optional[Dtype] = None,
132+
fastpath: bool = False):
127133

128134
if not fastpath:
129135
if dtype is not None:

pandas/core/series.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class Series(base.IndexOpsMixin, generic.NDFrame):
142142
# Override cache_readonly bc Series is mutable
143143
hasnans = property(base.IndexOpsMixin.hasnans.func,
144144
doc=base.IndexOpsMixin.hasnans.__doc__)
145+
_data = None # type: SingleBlockManager
145146

146147
# ----------------------------------------------------------------------
147148
# Constructors

0 commit comments

Comments
 (0)